Skip to content

Commit

Permalink
readme: add missing documentation
Browse files Browse the repository at this point in the history
Co-authored-by: Oneric <oneric@oneric.stub>
  • Loading branch information
dmitrylyzo and TheOneric committed Oct 18, 2021
1 parent c2b711a commit 40da83b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ When creating an instance of SubtitleOctopus, you can set the following options:
occurs if browser doesn't support web workers). (Optional)
- `debug`: Whether performance info is printed in the console. (Default:
`false`)
- `renderMode`: Rendering mode. (If not set, the rendering mode is determined by the `blendRender` and `lossyRender` options)
- `normal` - Default
- `blend` - WASM Blending
- `fast` - Fast Render Mode (Lossy) (EXPERIMENTAL)
- `dropAllAnimations`: Remove all animation tags, such as karaoke, move, fade, etc. (Default: `false`)
- `libassMemoryLimit`: libass bitmap cache memory limit in MiB (approximate) (Default: `0` - no limit)
- `libassGlyphLimit`: libass glyph cache memory limit in MiB (approximate) (Default: `0` - no limit)
- `targetFps`: Target FPS (Default: `30`)
- `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)
- `softHeightLimit`: The height to which the subtitles canvas will be scaled. (Default: `1080`)
- `hardHeightLimit`: The maximum height of the subtitles canvas. (Default: `0` - no limit)
- `renderAhead`: How many MiB (approximate) of subtitles to render ahead and store. (Default: `0` - don't render ahead)
- `resizeVariation`: The resize threshold at which the cache of pre-rendered events is cleared. (Default: `0.2`)

Additionally there are options to choose between different rendering modes, which are detailed
below. If multiple rendering options are set any of them may be used, they are not additive.
Expand All @@ -142,6 +155,24 @@ The Fast Render mode has been created by @no1d as a suggestion for fix browser f

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

#### Render Ahead (WASM Blending with pre-rendering) (EXPERIMENTAL)
Upon creating the SubtitleOctopus instance, set `renderAhead` in the options to a positive value to use this mode.
In this mode, SubtitleOctopus renders events in advance (using WASM blending) so that they are ready in time.
The amount of pre-rendered events is controlled by the `renderAhead` option.
Each pre-rendered event is provided with information about its start time, end time, and end time of the gap after (if any).
This mode will analyse the events to avoid rendering empty sections or rerendering non-animated events.
Resizing the video player clears the cache of pre-rendered events (the threshold is set by `resizeVariation`).

> The `renderMode`, `blendRender` and `lossyRender` options are ignored.
> **WARNING: Experimental, may stall on heavily animated subtitles**
This mode tries to render every transition - at worst, every frame - in advance.
If the rendering of many frames takes too long and the cache of prepared frames gets depleted
(e.g. during a long section with heavy animations), the current subtitle-frame will continue to
be displayed until the prerendering can catch up again.
Adjusting `prescaleTradeoff`, `softHeightLimit` and `hardHeightLimit` to lower the resolution of
the rendering canvas can work around this at the expense of visual quality.


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

0 comments on commit 40da83b

Please sign in to comment.