fix: forward options from the mp4 CaptionParser to its CaptionStream - #452
Open
Essk wants to merge 1 commit into
Open
fix: forward options from the mp4 CaptionParser to its CaptionStream#452Essk wants to merge 1 commit into
Essk wants to merge 1 commit into
Conversation
The mp4 CaptionParser constructed its CaptionStream with no arguments, so every option passed to init() other than isPartial was discarded. Because CaptionStream defaults parse708captions to true and only passes captionServices through when it receives options, neither option has ever had any effect on fMP4/CMAF in-band captions. The TS, partial and FLV pipelines all forward their options, so this was the only gap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Essk
marked this pull request as ready for review
August 12, 2026 13:06
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.
parse708captionsandcaptionServiceshave never applied to fMP4/CMAF content. The mp4CaptionParser.init(options)builds itsCaptionStreamwith no arguments (lib/mp4/caption-parser.js), reading onlyoptions.isPartialand discarding the rest. SinceCaptionStreamdefaultsparse708captionstotrueand only forwardscaptionServicestoCea708Streamwhen it is given an options object, both options are silently ignored on the fMP4 path. Every other pipeline forwards them —lib/mp4/transmuxer.js:1014,lib/partial/transmuxer.js:33andlib/flv/transmuxer.js:376all donew m2ts.CaptionStream(options)— so the mp4CaptionParserwas the only gap.The practical effect: on a CMAF/fMP4 HLS stream carrying both CEA-608 and CEA-708 renditions of the same captions, there is no way to suppress the duplicate 708 text track.
CaptionParser.init(options)now passesoptionsstraight through toCaptionStream.CaptionStreamalready toleratesundefined/empty options, so default behaviour is unchanged.test/caption-parser.test.jsdriving a synthetic fMP4 segment whose SEI NALs carry both a CEA-608 CC1 caption and a 708 service 1 caption: both parse by default,parse708captions: falseleaves only the 608 caption, and acaptionServiceseuc-krencoding changes how multi-byte 708 characters are decoded. The two option tests fail onmainand pass with this change.A companion PR passes these options at the call site: videojs/http-streaming#1611.
Validated end-to-end in a patched player build against a live CMAF stream carrying CEA-608 CC1 and CEA-708 Service 1:
parse708captions: falsesuppressed the 708 text track,truerestored it.