Feat: Add ASS/SSA subtitle support via jassub-embedded#138
Open
mrcanelas wants to merge 2 commits intoStremio:masterfrom
Open
Feat: Add ASS/SSA subtitle support via jassub-embedded#138mrcanelas wants to merge 2 commits intoStremio:masterfrom
mrcanelas wants to merge 2 commits intoStremio:masterfrom
Conversation
mrcanelas
commented
Apr 27, 2026
|
|
||
| subtitlesElement.style.display = 'none'; | ||
| var urls = ensureAssetUrls(); | ||
| assSubtitlesInstance = new JASSUB({ |
Contributor
Author
There was a problem hiding this comment.
Testing with custom fonts
For the example addon used in this PR, the KUSURIYA_S2_OP1_ASS subtitle may require additional fonts to render as intended.
To validate this case locally, test fonts can be temporarily passed directly into the JASSUB instance through the fonts option:
assSubtitlesInstance = new JASSUB({
video: videoElement,
subContent: text,
workerUrl: urls.workerUrl,
wasmUrl: urls.wasmUrl,
modernWasmUrl: urls.wasmModernBinary,
fonts: [
'https://raw.githubusercontent.com/ThaUnknown/jassub/gh-pages/static/fonts/FOT-TsukuCOldMinPr6NR.OTF',
'https://raw.githubusercontent.com/ThaUnknown/jassub/gh-pages/static/fonts/RoughFlowers.TTF'
],
availableFonts: {
'liberation sans': urls.defaultFontUrl
},
defaultFont: 'liberation sans',
queryFonts: 'local'
});This is only intended for the KUSURIYA_S2_OP1_ASS example used during testing. It is not part of the proposed production flow.
In a proper production setup, font attachments should ideally come from the media source itself. A possible follow-up would be to use stremio-server to extract MKV font attachments and expose them as URLs that can be passed to JASSUB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds ASS/SSA subtitle support to
withHTMLSubtitlesusing@mrcanelas/jassub-embedded.Non-ASS subtitles still use the existing HTML subtitle flow unchanged.
What changed
@mrcanelas/jassub-embeddedstremio-video, with nostremio-webchanges or external worker/wasm asset setupFor ASS/SSA subtitles:
Delayis supportedSizeis not appliedVertical Positionis not appliedThis is intentional, since ASS/SSA subtitles usually define their own styling, positioning, and typesetting. Applying the HTML subtitle controls on top of them would likely break rendering.
For SRT/VTT subtitles, existing behavior remains unchanged.
Font note
ASS/SSA subtitles may depend on embedded fonts for correct rendering.
jassubexpects font sources as URLs or binary font data. A possible follow-up improvement is to usestremio-serverto extract MKV attachments and serve those fonts as URLs, so they can be passed into the ASS renderer when needed.Without that, some ASS subtitles may still render with fallback fonts when the original attached fonts are not available.
Related issues
Closes #46, closes Stremio/stremio-features#232
How we tested (local addon example)
The Apothecary Diaries (S2 OP1)and select the ASS subtitle track.Delayaffects ASS timingSizedoes not affect ASS renderingVertical Positiondoes not affect ASS renderingDelay,Size, andVertical Positionstill work as beforeNotes
This is a conservative patch focused only on adding ASS/SSA support safely while preserving the existing subtitle flow and minimizing unrelated changes.