Skip to content

fix: forward options from the mp4 CaptionParser to its CaptionStream - #452

Open
Essk wants to merge 1 commit into
mainfrom
fix/mp4-caption-parser-options
Open

fix: forward options from the mp4 CaptionParser to its CaptionStream#452
Essk wants to merge 1 commit into
mainfrom
fix/mp4-caption-parser-options

Conversation

@Essk

@Essk Essk commented Aug 12, 2026

Copy link
Copy Markdown

parse708captions and captionServices have never applied to fMP4/CMAF content. The mp4 CaptionParser.init(options) builds its CaptionStream with no arguments (lib/mp4/caption-parser.js), reading only options.isPartial and discarding the rest. Since CaptionStream defaults parse708captions to true and only forwards captionServices to Cea708Stream when 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:33 and lib/flv/transmuxer.js:376 all do new m2ts.CaptionStream(options) — so the mp4 CaptionParser was 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 passes options straight through to CaptionStream. CaptionStream already tolerates undefined/empty options, so default behaviour is unchanged.
  • Added three tests in test/caption-parser.test.js driving 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: false leaves only the 608 caption, and a captionServices euc-kr encoding changes how multi-byte 708 characters are decoded. The two option tests fail on main and 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: false suppressed the 708 text track, true restored it.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant