mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
[PR #1857] [MERGED] fix(avc): Handle streams that don't start with NAL start codes #2623
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?
📋 Pull Request Information
Original PR: https://github.com/CCExtractor/ccextractor/pull/1857
Author: @cfsmp3
Created: 12/20/2025
Status: ✅ Merged
Merged: 12/20/2025
Merged by: @cfsmp3
Base:
master← Head:fix/issue-1626-broken-avc-stream📝 Commits (1)
73db3a2fix(avc): Handle streams that don't start with NAL start codes (#1626)📊 Changes
1 file changed (+161 additions, -46 deletions)
View changed files
📝
src/rust/src/avc/core.rs(+161 -46)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.