mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-04-21 13:39:56 +00:00
[PR #1842] [MERGED] fix: Fix garbled captions from HDHomeRun and I/P-only H.264 streams #2607
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/1842
Author: @cfsmp3
Created: 12/18/2025
Status: ✅ Merged
Merged: 12/18/2025
Merged by: @cfsmp3
Base:
master← Head:fix/issue-1109-garbled-srt-hdhomerun📝 Commits (2)
c8f6b56fix: Fix garbled captions from HDHomeRun and I/P-only H.264 streams9fe2dabstyle: Remove unused mut from current_index variable📊 Changes
2 files changed (+73 additions, -15 deletions)
View changed files
📝
src/lib_ccx/avc_functions.c(+32 -3)📝
src/rust/src/avc/nal.rs(+41 -12)📄 Description
Summary
Fixes #1109 - Garbled SRT from transport stream
For I/P-only streams (like HDHomeRun recordings), the caption buffer was being flushed on every reference frame. Since ALL frames in these streams are reference frames, this defeated the caption reordering mechanism, causing garbled output like:
Root Cause
The stream has no B-frames (only I/P frames), but frames arrive in decode order rather than display order. The original code flushed the buffer on every reference frame (I and P), which meant:
The Fix
currefptson first frame to avoid huge indices at stream startThis allows P-frames to accumulate in the buffer and be sorted by their PTS-based indices before output.
Before/After
The output now matches FFmpeg's extraction exactly.
Test plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.