Repository navigation
Description
What happened?
On a progressive H.264 MP4 VOD with reordered pictures but no composition-time table, the native stream-copy path produces continuous forward/backward judder from the first frame. Seeking is not required to trigger it. The same source plays smoothly in another FFmpeg-based player.
The container presents every sampled video packet with PTS == DTS even though codecpar.video_delay == 1. A bounded libavcodec decode of the same head sample shows the contradiction directly: raw decoded AVFrame.pts regresses 16 times while best_effort_timestamp advances 58 times with zero regressions. Because the PTS values are present rather than AV_NOPTS_VALUE, the existing +genpts open flag and the #407 fallback do not repair them. Stream-copying those packet timestamps into fMP4 preserves decode order as presentation order, so AVPlayer displays future reference pictures before the B pictures that precede them.
Routing only this confirmed shape through the software decoder and scheduling decoded frames on best_effort_timestamp removes the judder.
Steps to reproduce
- Open a seekable MP4 containing progressive H.264 with B-frame reordering, but whose sample table has no
cttscomposition offsets. - Play through the normal native VOD path.
- Observe continuous small forward/backward motion from playback start.
- Inspect the first 64 video packets and decoded frames. The reporting source produced:
valid_pairs=64,PTS==DTSfor all pairs,nonkey=62,decoded=59,best_effort_advances=58,best_effort_regressions=0,raw_pts_regressions=16.
A tiny 96x64 H.264 Main, 30000/1001 fps, 3-B-frame synthetic fixture and its healthy ctts twin are ready for a regression test in the accompanying PR.
AetherEngine version or commit SHA
6.39.0 / f70d4aee595f0947ef2354fbae01c76b41a7857b
Host app
Custom integration
Platform
tvOS
OS version
tvOS 26.6 beta (23L773)
Device / chip
Apple TV 4K (3rd generation)
Playback path
Native AVPlayer
Source media (for playback bugs)
MP4 / progressive H.264 with B-frame reordering / SDR. The source has no usable composition offsets: sampled packet PTS and DTS are equal despite video_delay=1. Audio is not involved in the failure. The synthetic regression fixture is MP4 / H.264 Main / 96x64 / 30000/1001 fps / no audio / SDR.
Error codes / log lines
No AVPlayer or VideoToolbox error is emitted. The diagnostic signature is:
video_packets=64 valid_pairs=64 nonkey=62 decoded_frames=59
best_advances=58 best_regressions=0 raw_regressions=16
raw_best_differences=16
Anything else
This is adjacent to #407 but not the same case. #407 repairs only AVFrame.pts == AV_NOPTS_VALUE; here the raw PTS is always present, but it is the wrong decode-order axis. A focused engine patch with bounded fail-closed detection, automatic per-session software routing, and good/bad MP4 fixtures is being prepared.
Activity
superuser404notfound commentedon Aug 24, 2026
Confirmed, and thanks for a report that came with the asset to prove it. The twin fixtures from #411 are now the regression test.
I reproduced the failure on the Apple decoder rather than only in libavcodec, decoding both twins through
AVAssetReaderand matching each decoded frame's content against the healthy twin: withcttsremoved, 45 of 66 pictures are presented at a time that belongs to a different picture, and the content order steps backwards 30 times, in a repeating +67 ms / -100 ms shuffle per B-group. That is the judder, and no seek is needed to provoke it, exactly as reported.The fix is #413, and it takes a different route than routing the session to software decode.
The container lost the composition offsets, but the bitstream did not: every slice header carries a picture order count, which is display order. libavcodec's H.264 parser reads it without decoding a pixel, and it takes MP4's length-prefixed AVCC payload directly, so the repair costs one slice header parse per video packet. The demuxer then rewrites each packet to what the muxer should have written:
Pulling the decode time back by the reorder delay is what keeps
PTS >= DTS, and a healthy file carries the same negative head. Theshiftis 0 or one reorder delay depending on whether the writer left the sample ladder on the presentation axis or kept the edit list that trims the reorder head, read from the container and clamped to that range, so both writer shapes land on the same axis.Because the rewrite happens once at the demuxer boundary, the fMP4 producer, the segment plan, the software decoder and the still extractor all read one axis, and the source keeps the native path with hardware decode: a missing table no longer costs a route change.
Measurements on the branch:
segverify3/3 segments independently decodable, and a 13-seek burst lands identically on both arms, which is what exercises the re-anchoring after a jump.Detection is fail-closed: a source is only repaired when every sampled pair is equal, the decode ladder is uniform, the picture order regresses, and the ranks it produces are distinct and fill the sampled window. Variable frame timing without composition offsets, a picture order that does not advance one rank per picture, or a sample that cannot be anchored all leave the stream exactly as the container delivered it.
Leaving this open for a retest on the reporting asset once it ships in a release.
fix(video): drop the picture-order parser's state at a seek (#409)
Merge fix/409-h264-composition-offsets: rebuild the presentation axis…
superuser404notfound commentedon Aug 24, 2026
Merged as f08db21. It is on
mainnow, not in a release yet, so this stays open until it can be retested on the reporting asset.Two things worth naming from the verification pass, since both would have shipped silently:
The picture-order parser is also dropped at a seek now, the way libavformat drops its own stream parser (
ff_read_frame_flush). Landing on an IDR hides that, because the parser resets its state there, but an open-GOP entry point does not.Merge pull request #415 from superuser404notfound/fix/409-held-packet…
superuser404notfound commentedon Aug 24, 2026
Released in 6.41.0. Your fixture pair is in the regression suite, and the release notes carry the twin-pair measurement in full, including why
best_effort_timestampcould not be the axis. Leaving this open for your retest on the original file.fix(video): rebuild the presentation axis an MP4 dropped with its ctt…
fix(video): drop the picture-order parser's state at a seek (superuse…
fix(video): a seek drops the packets the repair verdict left held (su…
fix(video): expose superuser404notfound#409 repair verdict safely
orut34iop commentedon Aug 25, 2026
Retested the released #413 + #415 implementation on the original reporting asset: playback still judders continuously from the first frame without seeking. This is not the held-packet seek regression fixed by #415.
The sampled head has
PTS == DTSfor 12/12 packets,video_delay=1,time_base=1/1200000, and the repeating DTS-step cycle40040,40041,40040,40040,40041. Currentmainrequires one identical integer step, so it fails closed as a nonuniform decode ladder and repairs 0 packets.The exact observed cadence is
200202/5; this is not generic VFR support. The follow-up accepts only a repeated adjacent-integer cycle observed for at least two periods, corroborated by stream rate metadata, with a unique quantization phase and a complete safe dry-run. Ambiguous, malformed, and genuinely variable timing remains untouched.The patched candidate has now passed physical Apple TV verification on the original asset: direct playback is smooth, scrub/release resumes and remains smooth, and a separate unaffected video remains unchanged.
Proposed engine patch and regression coverage: #419
fix(video): rebuild the presentation axis an MP4 dropped with its ctt…
fix(video): a seek drops the packets the repair verdict left held (su…
test(video): a sequence off its own lattice keeps being repaired (#409)
Merge pull request #427 from superuser404notfound/fix/ae409-rational-…
4 remaining items
fix(video): a picture is not always a whole number of ticks long (sup…
test(video): a sequence off its own lattice keeps being repaired (sup…
diag(video): the superuser404notfound#409 verdict line names the cade…
superuser404notfound commentedon Sep 3, 2026
Released in 6.44.0 (
69daa3d3), the same evening as the comment above, and this thread never got the note. So the retest on the original asset has had a pin to sit on since then. The two numbers worth reporting back are unchanged: thecadence=in the#409 ... confirmedline, and whether any picture comes out unrepaired.orut34iop commentedon Sep 13, 2026
Thanks for the fix and the release follow-up. The original reporting MP4 is no longer available to us, so we cannot complete the requested retest of the released #427 implementation on that asset or provide its
cadence=verdict and evidence of whether any pictures remain unrepaired.Our integration has since been updated to AetherEngine 6.84.0, but testing other files does not establish that the original asset is fixed. Please treat original-asset validation as unavailable, rather than passed.
Thank you for preserving the synthetic twin fixtures and the regression coverage. We leave the issue's closure to your judgment based on the available evidence.
superuser404notfound commentedon Sep 13, 2026
Thank you for saying that plainly instead of passing it on a substitute file. "Unavailable" is the more useful of the two answers, and it goes in the record that way.
So the thread ends with its evidence named rather than with a verdict it never got, here is what the shipped repair actually stands on:
1000000/33367fps in a 1200000 timescale, so a picture is200202/5ticks long and the sample table can only alternate 40040/40041, with the composition offsets stream-copied away from the second file the way your original pair was made.What that does not cover, and I am not going to claim it does: the original file, end to end, on a device, with the released implementation. The nearest thing to it stays your own measurement in this thread, on that asset, on physical hardware, of the same diagnosis. #427 implements that diagnosis with a per-sequence anchor rather than a per-packet inversion, which is the more conservative of the two: a sequence the lattice cannot place falls back to the rounded step at the container's own timestamp and is never handed on in decode order.
Re-checked today against 6.84.0, the version your integration now runs: the
H264CompositionOffsetRepairsuite is green, 31 tests, the fractional pair included.Closing on that basis, with original-asset validation recorded as unavailable rather than passed. If this judder ever turns up again, on that file or another, the line worth quoting is the one the demuxer prints at the head:
or its counterpart,
#409 composition-offset probe on stream 0 left the stream untouched: <reason>, which names what the classifier refused on. One shape that is deliberately not this one: a file carrying valid offsets at the head and zeros later reads as healthy here, and that is #513.Thanks again for the fixtures, the measurements and the two rounds of diagnosis. The pair you supplied is what the regression rests on.
fix(plan): bound the segment plan's duration and index inputs (audit …
fix(demux): bound every demuxed timestamp once, at the Demuxer (audit…
fix(h264): refuse a superuser404notfound#409 re-anchor whose arithmet…
fix(demux): repair HEVC MP4s without composition offsets (superuser40…
chore(release): prep 7.28.3 - #409 repair survives a resume or seek o…
feat(ts): follow a PMT change under the streams readers chose
fix(demuxer): follow the writer's clock on a synthesized superuser404…
fix(demuxer): follow the writer's clock on a synthesized superuser404…