Skip to content

Prefer video streams over private VBI streams for ATSC_CC selection - #2518

Open
yasar710 wants to merge 1 commit into
CCExtractor:masterfrom
yasar710:fix/atsc-cc-video-stream-priority
Open

yasar710 wants to merge 1 commit into
CCExtractor:masterfrom
yasar710:fix/atsc-cc-video-stream-priority

Conversation

@yasar710

@yasar710 yasar710 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

This is essential. We will not merge ANY PR that doesn't come with detailed instructions, including a sample. We don't want
"fixes" for theoretical issues that an AI agent found, without context. If you can't reproduce the bug, don't send a PR.

Creating PRs with AI is very quick, but we still have humans (even if AI assisted) going over each.

Be mindful of reviewers' time.


Problem

When a Transport Stream contains both a Teletext/VBI private stream (CCX_STREAM_TYPE_PRIVATE_MPEG2 with VBI descriptor 0x45, e.g., PID 272) and an MPEG-2/H.264/HEVC video stream carrying EIA-608/708 captions (e.g., PID 49), passing --no-teletext fails to extract captions:

  1. ts_tables.c re-registers the disabled Teletext/VBI PID as CCX_CODEC_ATSC_CC.
  2. get_sib_stream_by_type() and get_best_stream() in src/lib_ccx/ts_info.c pick the first CCX_CODEC_ATSC_CC entry in the list (or lock onto the private VBI PID before the video stream's first PES start arrives), causing the actual video stream to be ignored and producing 0 frames.

Fix

  • Updated get_sib_stream_by_type() in src/lib_ccx/ts_info.c to prioritize actual video streams (CCX_STREAM_TYPE_VIDEO_MPEG2, CCX_STREAM_TYPE_VIDEO_H264, CCX_STREAM_TYPE_VIDEO_HEVC) when selecting CCX_CODEC_ATSC_CC, falling back to non-video private streams only when no video stream is available.
  • Updated get_best_stream() to wait for pending video streams before falling back to non-video CCX_CODEC_ATSC_CC streams.

Reproduction & Verification

  • Sample: ccExtractor_subtitle.mpg (SamplePlatform Regression Test 3)
  • Command:
    ./ccextractor --out=srt --latin1 --autoprogram --no-teletext ccExtractor_subtitle.mpg

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 26/28
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 68/86
Teletext 0/21
WTV 12/13
XDS 32/34

67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 10180, commit 2c1c1c6:

  • 0 pass there and fail here
  • 0 fail there and pass here
  • 0 fail on both, with different output
  • 67 fail on both, byte for byte the same

Compared with the commit this branch was cut from: the same run as the tip of master (test 10180), so the comparison above already covers it.


No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on windows. 171/238 tests matched the approved output:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 26/28
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 68/86
Teletext 0/21
WTV 12/13
XDS 32/34

67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 10179, commit f56427e:

  • 0 pass there and fail here
  • 0 fail there and pass here
  • 0 fail on both, with different output
  • 67 fail on both, byte for byte the same

Compared with the commit this branch was cut from — test 10181, commit 2c1c1c6:

  • 0 pass there and fail here
  • 0 fail there and pass here
  • 0 fail on both, with different output
  • 67 fail on both, byte for byte the same

No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch.

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.

2 participants