Skip to content

Commit 40da83b

Browse files
dmitrylyzoTheOneric
andcommitted
readme: add missing documentation
Co-authored-by: Oneric <[email protected]>
1 parent c2b711a commit 40da83b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ When creating an instance of SubtitleOctopus, you can set the following options:
118118
occurs if browser doesn't support web workers). (Optional)
119119
- `debug`: Whether performance info is printed in the console. (Default:
120120
`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`)
121134

122135
Additionally there are options to choose between different rendering modes, which are detailed
123136
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
142155

143156
**WARNING: Experimental, not stable and not working in Safari**
144157

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+
145176

146177
### Brotli Compressed Subtitles
147178
The SubtitleOctopus allow the use of compressed subtitles in brotli format, saving bandwidth and reducing library startup time

0 commit comments

Comments
 (0)