Skip to content

Live TS: A53/SEI-embedded CEA-608 captions are invisible — the #77 CC tap only arms on demuxable caption streams #131

Closed

Description

@dlev02

Context

Working on a potential Live TV feature that plays broadcast-style MPEG-TS channels (IPTV / OTA re-streams, FFmpeg ingest path). On US broadcast and cable-sourced feeds, closed captions are not a demuxable caption track — they ride inside the H.264/H.265 picture as ATSC A/53 cc_data in user_data_registered_itu_t_t35 SEI messages. Today those captions are invisible to the engine, so a whole class of live channels plays with no subtitle option at all.

Current state (audited at d9abd79)

  • Render embedded CEA-608/708 closed captions (eia_608) — currently no decode or passthrough path #77's ClosedCaptionTap is exactly the right consumer, but it only ingests packets from a demuxable caption stream: isEmbeddedClosedCaptionCodec matches eia_608 / c608-style stream codecs, and the producer hands the tap that stream's packets (AetherEngine+ClosedCaptions.swift, AetherEngine+Loading.swift:431-470).
  • FFmpeg's mpegts demuxer never synthesizes such a stream for A53-in-video captions — they only exist as SEI in the video packets (or as AV_FRAME_DATA_A53_CC after decode). So on live TS the tap never arms, even though the channel is captioned.
  • I found no other A53/CC side-data handling in the engine: packet side-data scanning covers AV_PKT_DATA_DOVI_CONF, AV_PKT_DATA_NEW_EXTRADATA, and the HDR10+ T.35 SEI prefix detection only.

Ask

Extend the #77 pipeline with a second cue source for live/TS sessions: extract cc_data from video-packet SEI and feed it into the existing CEA608Decoder + cue-buffer machinery.

Two plausible extraction points, in preference order:

  1. Producer pump, packet-level — parse user_data_registered_itu_t_t35 (provider 0x31 GA94, user_data_type_code 0x03) from video packet NALs on the pump thread. The producer already scans video packets for the HDR10+ T.35 prefix (HLSSegmentProducer.swift:414), so the plumbing precedent exists; this works for the VideoToolbox path where no FFmpeg decode happens. Bitstream caveat: SEI order relative to presentation differs from decode order on B-frame content, so cues should be keyed by packet PTS like the existing tap already does.
  2. Decoder-side AV_FRAME_DATA_A53_CC on the software path (FFmpeg surfaces it for free there), as a complement.

Host side needs nothing new: once the track/cues surface through the existing subtitleTracks + subtitleCues contract, Prism's subtitle menu already labels eia_608/eia_708 tracks ("CEA-608"/"CEA-708") and renders cues through its overlay.

CEA-708 (the native ATSC service, richer styling) could stay out of scope initially, matching #77's "608 field-1/CC1 first cut" — A53 cc_data carries both, so the extraction layer is shared and 708 decode can layer on later.

Why engine-level

The host never touches demux/decode on the internal path, so there is no app-side workaround — packet SEI is only visible inside the engine.

Activity

  1. superuser404notfound commented on Jul 17, 2026

    @superuser404notfound
    Owner

    Shipped in 5.6.0. Both extraction points from the issue landed, in your preference order:

    • Producer pump, packet-level (native path): video packets are scanned for GA94 T.35 SEI next to the existing HDR10+ T.35 scan, H.264 and HEVC, Annex B and length-prefixed framing (so TS live channels and MKV/MP4 recordings both work). On the bitstream caveat you flagged: correct, and keying by packet PTS alone was not enough. The 608 decoder is stateful and order-sensitive, so decode-order feeding would garble roll-up text on B-frame content. Caption groups are buffered per packet PTS and drained once the packet DTS watermark passes them, which restores presentation order and adds zero latency on B-frame-free streams.
    • Decoder-side AV_FRAME_DATA_A53_CC (software path): MPEG-2 and the other FFmpeg-decoded codecs feed the same tap from decoded-frame side data, so true ATSC OTA feeds are covered too.

    Since no caption AVStream exists, the engine surfaces a synthetic eia_608 track (id 99608) into subtitleTracks lazily on the first real (non-padding) caption pair, typically moments after joining a captioned channel; padding-only cc_data never surfaces a track, so uncaptioned channels keep a clean menu. As you predicted, the host side needs nothing: the track rides the existing subtitleTracks + subtitleCues contract, and Prism's existing eia_608 labeling and overlay rendering should just work. One heads-up: the entry appears shortly after playback starts rather than at load time, so the subtitle menu needs to react to subtitleTracks changes (it sounds like it already does).

    Scope matches your suggestion: 608 field-1/CC1 first cut, and CEA-708 can layer on later since the extraction layer already carries both. Current limitation: overlay-only, the synthetic track gets no native WebVTT rendition yet, so no PiP/AirPlay captions on this path.

    Verified locally end to end on an H.264+A53 sample (tap arms, track surfaces exactly once, cues render). Would appreciate a retest on your live channel matrix, IPTV and OTA re-streams both, whenever you get a chance.

    Thanks for the audit, it was precise enough to serve as the implementation spec: the arming gap, both extraction points, and the reordering caveat were all exactly right.

  2. dlev02 commented on Jul 21, 2026

    @dlev02
    ContributorAuthor

    Happy to close this out for now, thanks for getting this in, and for landing both extraction points from the issue. Live TV is still in active development on my side, so I haven't exercised every caption path yet; if I hit anything new as that work continues I'll open fresh issues rather than reopening this one. Appreciate the quick turnaround!

  3. superuser404notfound commented on Jul 21, 2026

    @superuser404notfound
    Owner

    Sounds good, closing on that basis. The 708 layer, field 2/CC2+, and a native rendition for PiP/AirPlay captions on this path are all natural follow-ups once your Live TV work exercises them, so fresh issues are exactly the right shape for whatever surfaces. Thanks again for the audit-grade report, it made this one straightforward to land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions