Repository navigation
#407: extend the generated-PTS repair to AVI (measured XviD sample) - #517
superuser404notfound merged 1 commit into
Conversation
The gate was Matroska-only for want of a measured AVI. Here is one: a 2000s
XviD rip (mpeg4 ASP, tag XVID, 720x304, video_delay 1, packed B-frames) takes
the same transposition, and `aetherctl swdecode` says so in the same words:
before 0.042 0.083 0.167 0.125 0.209 0.292 0.250 0.334 0.417
Steps backwards: 12 of 37
after 0.042 0.083 0.125 0.167 0.209 0.250 0.292 0.334 0.375
Steps backwards: 0 of 37
AVI needs no ms_compat equivalence to establish the same fact, because avidec
has no other mode: the container carries no presentation timestamps at all,
every track carries a FourCC, and the demuxer puts the frame index on pkt->dts.
So on an AVI input any PTS present was necessarily invented by +genpts, which
makes codec_tag != 0 a tautology there rather than a signal. video_delay > 0
carries the whole gate; the Matroska branch keeps its tag condition untouched.
Both existing exclusions hold in AVI: zero reorder delay (decode order IS
presentation order) and the natively routable codecs whose packets reach the
fMP4 muxer.
The source is progressive (interlaced_frame 0 and repeat_pict 0 on every frame
of a mid-file window), its timestamps are evenly spaced at 0.0417 s with no
gaps or duplicates, and no deinterlacer is involved: the packed bitstream is
the only unusual property and it is not the cause. The invented axis is.
`nonMatroskaContainer` pinned the old decision that "avi" must not arm the
repair; it becomes `ptsCarryingContainer` over the containers that do supply
timestamps, and four AVI cases join it. Full suite: 2743 tests, 373 suites,
all passing.
Reported as superuser404notfound#516.
|
Verified on device: iPhone 13 Pro / iOS 26.5, host app built against this branch. The sample that produced #516 now plays with no visible judder — so the fix holds beyond the headless |
…tream (#516) The gate widened in #517 is right and the measurement behind it holds, but the doc comment closed on "the packed bitstream is not the cause", and that reading does not survive a second file. A plain coding-order XviD AVI of the same shape (mpeg4, tag XVID, video_delay=1) already decodes in order today: 0 backwards steps of 14. The packed FATE sample looped to 390 packets takes 64 of 239. +genpts writes a coding-order axis in both, but on a well-formed AVI that axis is the presentation ladder shifted by exactly one frame, uniformly, so no pair changes places. A packed stream's N-VOP placeholder chunks hold a slot while the picture they stand for rides inside the previous chunk, so packets and pictures stop matching one to one and the shift stops being uniform. Records the regression evidence for arming on every AVI with a reorder delay (mpeg4 and mpeg2video in AVI, same ladder before and after), and why the repair is preferred over libavcodec's mpeg4_unpack_bframes suggestion: it covers every container that withholds PTS, where the filter covers one codec. Comments only, no behaviour change. Suite 2800/2800. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VDKAJrLjLXVsCvJVNdJEPw
|
Merged, thank you. The diagnosis is right, the fix sits in the right layer, and the reasoning about Reproduced here against the FATE sample A full One correction, pulled in afterwards as
|
Fixes #516.
VFWDecodeOrderPTSRepairalready describes this failure exactly; its gate was Matroska-only because no AVI had been measured:Here is the measurement. A 2000s XviD rip —
mpeg4Advanced Simple Profile, tagXVID, 720x304,video_delay = 1, packed B-frames — takes the same transposition, andaetherctl swdecodereports it in the same words the Matroska case did:Why AVI needs no equivalence of its own
avidechas no second mode. The container carries no presentation timestamps at all, every track carries a FourCC, and the demuxer puts the frame index onpkt->dts. So on an AVI input any PTS present was necessarily invented by+genpts— which makescodec_tag != 0a tautology there rather than a signal, and leavesvideo_delay > 0carrying the whole gate.The Matroska branch keeps its tag condition untouched: there the tag is what separates the VFW-carried tracks that withhold PTS from the natively mapped ones that must keep theirs.
Both existing exclusions hold unchanged in AVI, and are pinned by tests:
Ruling out the alternatives on this sample
So the diagnosis does not rest on the verdict alone:
field_order=unknown, andinterlaced_frame=0/repeat_pict=0on every frame of a mid-file 25-frame window. TogglingdeinterlaceModeanddeinterlaceFieldRateon device changed nothing, consistent with the deinterlacer correctly never engaging.best_effort_timestamp_timeadvances evenly at 0.0417 s with no gaps and no duplicates.preferredDecodePath = .softwarechanged nothing.mpeg4_unpack_bframessuggestion is left alone deliberately — a separate, independent improvement, out of scope for a gate change.Tests
nonMatroskaContainerpinned the old decision that"avi"must not arm the repair. It becomesptsCarryingContainerover the containers that genuinely supply timestamps (mov,mp4,…,asf,mpegts), and four AVI cases join the suite: the measured XviD shape, tag-independence, the two shared exclusions, and per-element name matching forisAVI.Full suite on this branch: 2743 tests in 373 suites, all passing.
Scope
The gate can now arm only on AVI, and only where
video_delay > 0— files that today play with their pictures in the wrong order. Nothing that plays correctly changes behaviour.Happy to adjust naming or split the test changes if you would rather keep
VFWin the type name now that it covers a second carriage.