You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
export ts: keyframe parameter sets are written ahead of the access unit delimiter #5951
export ts writes a keyframe's re-injected SPS and PPS ahead of its access unit delimiter, so the AUD is no longer the access unit's first NAL.
Measured with moq at 3abf0161 on a synthetic H.264 fixture whose access units start with an AUD (keyframes: AUD, SPS, PPS, SEI, IDR). After import ts and export ts --delay 1s, every exported keyframe reads SPS, PPS, AUD, IDR. That is the same through moq-relay and through a third-party relay, and every non-key frame is byte-identical to the source, so the reordering is the export's.
The cause, unchanged on main: video_es_payload writes the avcC/hvcC parameter sets first and then the whole payload, AUD included. annexb::from_length_prefixed, used by the H.264 and H.265 elementary exporters, prepends its prefix the same way.
Why it matters: H.264 §7.4.1.2.3 and H.265 §7.4.2.4.4 require an AUD, when present, to be the access unit's first NAL, and H.222.0 §2.14.1 requires one in every AVC access unit carried in a transport stream. A demuxer or splicer that delimits access units on the AUD attributes the keyframe's parameter sets to the picture before it. FFmpeg decodes the output regardless; a strict analyser flags it.
A possible fix: when the payload's first NAL is an AUD (H.264 type 9, H.265 type 35), write it first and the parameter sets after it, in both places. A test that exports an AUD + IDR keyframe and expects AUD, SPS, PPS, IDR fails today.
Decision: accepted as described. When the first NAL is an AUD, both video_es_payload and annexb::from_length_prefixed write it first, then the parameter sets, with the regression test you proposed.
Activity
kixelated commentedon Oct 19, 2026
Decision: accepted as described. When the first NAL is an AUD, both
video_es_payloadandannexb::from_length_prefixedwrite it first, then the parameter sets, with the regression test you proposed.Tracked by
quest/m1/ts-reliability/aud-first.md.Planned in #5969. Anyone who wants to donate tokens can run
/quest-start quest/m1/ts-reliability/aud-firstto pick it up.(Written by Claude Opus 5.5)