mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
[PR #1857] fix(avc): Handle streams that don't start with NAL start codes #2626
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/1857
State: closed
Merged: Yes
Summary
Problem
The AVC parser would fail with "Leading bytes are non-zero" error when processing HLS/Twitch stream segments. These segments often start mid-stream without proper NAL unit headers at the beginning.
Root cause: When
process_avcencountered non-zero leading bytes, it returned an error with 0 bytes processed. The C code would not remove any bytes from the buffer, causing subsequent data to accumulate with the corrupt beginning, leading to infinite errors and no caption extraction.Solution
find_nal_start_code()function to search for valid NAL start codes (3-byte or 4-byte)0x00 0x00, search for first NAL start codeTest plan
find_nal_start_code)Before fix:
After fix:
Extracted captions:
🤖 Generated with Claude Code