Repository navigation
Player: an H.264 non-IDR I-slice at a random access point is a keyframe (seeks in Blu-ray remuxes stuck on Buffering) - #1085
Merged
GLinnik21 merged 2 commits intoOct 29, 2026
Conversation
A Blu-ray remux has one IDR, its first frame; every later random access point is an I-slice behind a recovery point, flagged a keyframe by the container and indexed by its Cues, with the SPS/PPS repeated in band. Only IDR counted as a keyframe, so after a seek the post-seek rebase dropped every AU waiting for one and the player stayed on Buffering through both stuck-seek retries and the reload. packet_to_annexb now also counts a non-IDR I-slice when the packet carries AV_PKT_FLAG_KEY or an SPS ahead of it in the same AU; P- and B-slices never count. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KBgjCe8KH6Nnp3K51Fybrv
…cess point The keyframe rule in the demuxer contract (docs/ffmpeg-demuxer-plan.md) and in the opening sentence of packet_to_annexb's doc comment named only the IDR; a non-IDR I-slice flagged AV_PKT_FLAG_KEY, or behind an in-band SPS, is a keyframe too. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Collaborator
|
Merged, thank you! I only updated two doc lines that still said a keyframe is IDR-only. |
danzig666
pushed a commit
to danzig666/plx-native
that referenced
this pull request
Nov 4, 2026
Upstream rebuilt the player HUD as packages (appkit/player_hud.rs is now a directory), merged this fork's plxnative#986 (edge scrolling) and plxnative#1085 (H.264 recovery-point keyframes), and added its own automatic intro/credits skipping (plxnative#1227). Conflicts take upstream's side throughout; the fork's own Skip intros / Skip credits settings, notices and strings are dropped in favour of plxnative#1227. The fork's player additions (clock, media line, subtitle-tone dim, BACK-hide jitter gate) and its fork.18 pointer changes are re-applied on top in their own commits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KBgjCe8KH6Nnp3K51Fybrv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seeking in some Blu-ray remuxes never finished: the player sat on "Buffering…" at the target for good, through both stuck-seek retries and the reload. In these files only the very first frame is an IDR; every later point a seek lands on is an ordinary I-frame behind a recovery point. The player only accepted an IDR as the frame to restart from, so it waited for one that never came. It now also accepts such an I-frame.
Technical details
ff::packet_to_annexbcounted an H.264 AU as a keyframe only for an IDR NAL (type 5). The post-seek rebase inengine::feed_stream(es == 1 && key != 0) drops every AU until a keyframe, so a file with one IDR could never rebase after a seek.slice_typeis I (2 or 7) now counts as a keyframe when the packet carriesAV_PKT_FLAG_KEY, or when an SPS precedes it in the same AU (Blu-ray streams repeat the parameter sets in band at each random access point). P- and B-slices never count. The parameter-set prepend then behaves as it does for an IDR.h264_slice_is_intrareads the slice header's first two Exp-Golomb fields; open-GOP leading B-frames are clamped by the existingfp < 0guard, as for an HEVC CRA, which already counted.--repeat-headers, broadcast TS), an unflagged scenecut I-frame would also count. The rebase is the only consumer of the AU key flag, and a seek normally lands on an indexed (flagged) packet first. I kept the condition because the TV test below cannot tell which of the two conditions carried the fix. Dropping it would leave the flag-only rule, if you prefer that.ts_h264_access_unit(the HLS/TS path) still counts only IDR, so a remux of such a file copied into TS segments would still fail with "HLS segment does not begin with an IDR". That could take the same I-slice rule as a follow-up.Testing
ff_packet_framing_tests.rs: a flagged non-IDR I-slice is a keyframe and gets the parameter sets (slice_type 7 and 2); a flagged P- or B-slice and an unflagged bare I-slice are not; an I-slice behind an in-band SPS is. The first one failed against the IDR-only rule before the fix.make test-crate C=plx_media T=ff::(226 passed),make check-nodef,make lint,ci/check-deps.sh.ponytail-paparoa, board O22), direct play of a 1080p H.264 + AC3 Blu-ray remux MKV (19 GB). Before the fix, a seek to 0:32 loggedAU#0 size=177514 key=falseand nothing was fed until the reload, which stuck the same way. With the fix, seeking works, from a fork build of the same change.Generated by Claude Code