mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1769] [FIX]: Add HEVC/H.265 stream type recognition to prevent crashes on ATSC 3.0 streams #2497
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1769
State: closed
Merged: Yes
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Summary
This PR adds recognition for HEVC/H.265 video streams (stream type
0x24) in MPEG-TS files, fixing crashes when processing ATSC 3.0 broadcasts. This is a partial fix for issue #1639.Problem
When CCExtractor encounters HEVC-encoded streams (commonly used in ATSC 3.0 broadcasts), it crashes with:
This occurs because the codebase did not recognize stream type
0x24(HEVC/H.265), causing it to be treated as an unknown stream type.Changes Made
1. Added HEVC enum constant (
ccx_common_constants.h)CCX_STREAM_TYPE_VIDEO_HEVC = 0x24to the stream type enumeration2. Updated stream type handling (
ts_functions.c)get_buffer_type_str(): Returns"HEVC"for HEVC streams (for logging/display)get_buffer_type(): Maps HEVC toCCX_H264buffer type (HEVC uses similar NAL unit structure)init_ts(): Added"HEVC video"description to the stream type lookup table3. Updated PMT parsing (
ts_tables.c)get_printable_stream_type(): Converts raw0x24stream type toCCX_STREAM_TYPE_VIDEO_HEVCparse_PMT(): Extended video stream detection to include HEVC alongside H.264 and MPEG2"Detected HEVC video stream (0x24) - enabling ATSC CC parsing."Testing
Tested with ATSC 3.0 TS file from issue #1639. Results:
Before:
After:
The crash is fixed and HEVC streams are properly recognized.
Limitations
Important: While this PR fixes the crash and enables HEVC stream recognition, it does not extract captions from HEVC streams. Users will see:
This is because:
codec_tag=0x50505453per ffprobe), which requires a separate parserThis PR is foundational work - as currently CCextractor cannot extract captions from HEVC if the system doesn't even recognize HEVC streams. This prevents crashes and enables future caption extraction work.
Files Changed
src/lib_ccx/ccx_common_constants.h- Added HEVC enum valuesrc/lib_ccx/ts_functions.c- Added HEVC handling in 3 functionssrc/lib_ccx/ts_tables.c- Added HEVC detection and PMT parsing supportNote to maintainers: This is a stepping-stone PR. It doesn't solve the full caption extraction problem, but it's a necessary prerequisite. ATSC 3.0 adoption is growing in the US, and at minimum, CCExtractor should not crash when encountering these streams. I'm happy to address any feedback or make adjustments as needed.