You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+31
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,19 @@ When creating an instance of SubtitleOctopus, you can set the following options:
118
118
occurs if browser doesn't support web workers). (Optional)
119
119
-`debug`: Whether performance info is printed in the console. (Default:
120
120
`false`)
121
+
-`renderMode`: Rendering mode. (If not set, the rendering mode is determined by the `blendRender` and `lossyRender` options)
122
+
-`normal` - Default
123
+
-`blend` - WASM Blending
124
+
-`fast` - Fast Render Mode (Lossy) (EXPERIMENTAL)
125
+
-`dropAllAnimations`: Remove all animation tags, such as karaoke, move, fade, etc. (Default: `false`)
126
+
-`libassMemoryLimit`: libass bitmap cache memory limit in MiB (approximate) (Default: `0` - no limit)
127
+
-`libassGlyphLimit`: libass glyph cache memory limit in MiB (approximate) (Default: `0` - no limit)
128
+
-`targetFps`: Target FPS (Default: `30`)
129
+
-`prescaleTradeoff`: Scale down (`< 1.0`) the subtitles canvas to `softHeightLimit` to improve speed, or scale it up (`> 1.0`) to improve quality. (Default: `null` - no scaling)
130
+
-`softHeightLimit`: The height to which the subtitles canvas will be scaled. (Default: `1080`)
131
+
-`hardHeightLimit`: The maximum height of the subtitles canvas. (Default: `0` - no limit)
132
+
-`renderAhead`: How many MiB (approximate) of subtitles to render ahead and store. (Default: `0` - don't render ahead)
133
+
-`resizeVariation`: The resize threshold at which the cache of pre-rendered events is cleared. (Default: `0.2`)
121
134
122
135
Additionally there are options to choose between different rendering modes, which are detailed
123
136
below. If multiple rendering options are set any of them may be used, they are not additive.
@@ -142,6 +155,24 @@ The Fast Render mode has been created by @no1d as a suggestion for fix browser f
142
155
143
156
**WARNING: Experimental, not stable and not working in Safari**
144
157
158
+
#### Render Ahead (WASM Blending with pre-rendering) (EXPERIMENTAL)
159
+
Upon creating the SubtitleOctopus instance, set `renderAhead` in the options to a positive value to use this mode.
160
+
In this mode, SubtitleOctopus renders events in advance (using WASM blending) so that they are ready in time.
161
+
The amount of pre-rendered events is controlled by the `renderAhead` option.
162
+
Each pre-rendered event is provided with information about its start time, end time, and end time of the gap after (if any).
163
+
This mode will analyse the events to avoid rendering empty sections or rerendering non-animated events.
164
+
Resizing the video player clears the cache of pre-rendered events (the threshold is set by `resizeVariation`).
165
+
166
+
> The `renderMode`, `blendRender` and `lossyRender` options are ignored.
167
+
168
+
> **WARNING: Experimental, may stall on heavily animated subtitles**
169
+
This mode tries to render every transition - at worst, every frame - in advance.
170
+
If the rendering of many frames takes too long and the cache of prepared frames gets depleted
171
+
(e.g. during a long section with heavy animations), the current subtitle-frame will continue to
172
+
be displayed until the prerendering can catch up again.
173
+
Adjusting `prescaleTradeoff`, `softHeightLimit` and `hardHeightLimit` to lower the resolution of
174
+
the rendering canvas can work around this at the expense of visual quality.
175
+
145
176
146
177
### Brotli Compressed Subtitles
147
178
The SubtitleOctopus allow the use of compressed subtitles in brotli format, saving bandwidth and reducing library startup time
0 commit comments