-
Notifications
You must be signed in to change notification settings - Fork 517
[FIX ]Captions fail to extract on HEVC video stream #1690 #1735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX ]Captions fail to extract on HEVC video stream #1690 #1735
Conversation
Co-authored-by: trufio465 <[email protected]>
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit a34ba0f...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
|
@trufio465-bot Do you have a sample for this that you can share? |
cfsmp3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on HEVC support. I've done a deep review and found some issues:
Current Status
- ❌ Has merge conflicts with current master
- ❌ Breaks one CEA-708 test (sample 115) which is unrelated to HEVC
⚠️ Master already has partial HEVC support (merged after this PR was created)
What Master Already Has
Since this PR was created, master has gained:
CCX_STREAM_TYPE_VIDEO_HEVC = 0x24in the stream type enum- HEVC handling in
get_buffer_type()(returnsCCX_H264to reuse the AVC path) - PMT parsing for HEVC streams in
ts_tables.c - HEVC description in
init_ts()
Valuable Changes That Master May Still Need
Your PR correctly identifies that several functions only check for MPEG2 when they should also check for H.264 and HEVC:
ts_info.c:get_video_stream()- Currently only returns PIDs for MPEG2 streams, missing H.264 and HEVCts_functions.c:copy_payload_to_capbuf()- The "don't ignore if analyzing video" check only exempts MPEG2ts_functions.c:ts_readstream()- Same issue
These could cause problems when --analyze_video_stream is used with H.264/HEVC content.
Suggested Approach
Rather than adding a new CCX_HEVC buffer type, I recommend keeping master's approach of routing HEVC through the CCX_H264 code path (since both use similar SEI mechanisms for caption embedding). The fixes needed are simpler:
- Update
get_video_stream()to include H.264 and HEVC - Update
copy_payload_to_capbuf()check to include H.264 and HEVC - Update
ts_readstream()similarly
This avoids adding new enum values and separate handling in process_data() for what is essentially the same processing path.
Questions
- Do you have an HEVC sample with captions you can share for testing? (Asked previously on Dec 14)
- Can you investigate why the CEA-708 MPEG-PS test (sample 115) fails with your changes? This file is not HEVC, so the regression suggests an unintended side effect.
Next Steps
If you'd like to continue with this PR:
- Rebase onto current master
- Remove the
CCX_HEVCbuffer type addition (master'sCCX_H264reuse is cleaner) - Keep just the 3 function fixes mentioned above
- Investigate the test regression
Alternatively, I can create a simpler PR with just the needed fixes based on your analysis, and credit you for identifying the issue.
Fixes #1690 - Captions fail to extract on HEVC video stream HEVC video streams with embedded EIA-608/708 captions weren't being extracted, even though VLC/MPV could display them. Root causes fixed: 1. HEVC stream type (0x24) wasn't recognized for CC extraction 2. HEVC NAL parsing used H.264 format (1-byte) instead of HEVC (2-byte) 3. HEVC SEI types (39/40) weren't handled (only H.264 SEI type 6) 4. CC data accumulation across SEIs caused u8 overflow/garbled output Changes: - C code: Add HEVC stream detection, CCX_HEVC buffer type, is_hevc flag - Rust code: HEVC NAL header parsing (2-byte, type=(byte[0]>>1)&0x3F), HEVC SEI handling (PREFIX_SEI=39, SUFFIX_SEI=40), immediate CC flush Thanks to @trufio465-bot for the initial research in PR #1735. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Closing in favor of #1852 which provides a complete fix for issue #1690. Thank you @trufio465-bot for the initial research - it helped identify the key areas that needed modification. |
Fixes #1690 - Captions fail to extract on HEVC video stream HEVC video streams with embedded EIA-608/708 captions weren't being extracted, even though VLC/MPV could display them. Root causes fixed: 1. HEVC stream type (0x24) wasn't recognized for CC extraction 2. HEVC NAL parsing used H.264 format (1-byte) instead of HEVC (2-byte) 3. HEVC SEI types (39/40) weren't handled (only H.264 SEI type 6) 4. CC data accumulation across SEIs caused u8 overflow/garbled output Changes: - C code: Add HEVC stream detection, CCX_HEVC buffer type, is_hevc flag - Rust code: HEVC NAL header parsing (2-byte, type=(byte[0]>>1)&0x3F), HEVC SEI handling (PREFIX_SEI=39, SUFFIX_SEI=40), immediate CC flush Thanks to @trufio465-bot for the initial research in PR #1735. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fixes #1690 - Captions fail to extract on HEVC video stream HEVC video streams with embedded EIA-608/708 captions weren't being extracted, even though VLC/MPV could display them. Root causes fixed: 1. HEVC stream type (0x24) wasn't recognized for CC extraction 2. HEVC NAL parsing used H.264 format (1-byte) instead of HEVC (2-byte) 3. HEVC SEI types (39/40) weren't handled (only H.264 SEI type 6) 4. CC data accumulation across SEIs caused u8 overflow/garbled output Changes: - C code: Add HEVC stream detection, CCX_HEVC buffer type, is_hevc flag - Rust code: HEVC NAL header parsing (2-byte, type=(byte[0]>>1)&0x3F), HEVC SEI handling (PREFIX_SEI=39, SUFFIX_SEI=40), immediate CC flush Thanks to @trufio465-bot for the initial research in PR #1735. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
[FIX]
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
This PR fixes an issue where CCExtractor failed to extract EIA-608 captions from HEVC (H.265) transport streams.
Problem:
CCExtractor's transport stream parser did not recognize HEVC (stream type 0x24) as a valid video stream type capable of carrying embedded captions. This resulted in "No captions were found in input" for HEVC files, even when captions were present and playable in other media players.
Solution:
Comprehensive HEVC support has been added across the codebase:
CCX_STREAM_TYPE_VIDEO_HEVC(0x24) andCCX_HEVCbuffer type.Impact:
CCExtractor can now successfully detect and extract EIA-608 captions from HEVC transport stream files.