Problem
moq-cli TS export emits PTS only (no DTS), so B-frame streams carry no decode
timeline. Players see out-of-order DTS and need ffplay -fflags +igndts. Validated on a
real CNN 1080i contribution feed through moq pub | relay | moq sub. Follow-up to #1798
(multi-PPS, fixed); part of #1799.
Evidence (real feed)
- Source has 12480 B-frames (
ffprobe -select_streams v -show_frames -show_entries frame=pict_type ... | grep -c ',B$'), so decode order != presentation order.
- Subscriber output: first packet
dts=N/A, then ffmpeg's reconstructed DTS is
non-monotonic and repeats (many frames share one DTS):
pts, dts 25.277000, N/A 25.557000, 25.297000 25.437000, 25.557000 25.357000, 25.557000 (DTS 25.557 repeated ~12x)
ffplay logs DTS 2289330 < 2301930 out of order; plays only with -fflags +igndts.
Root cause
rs/moq-mux/src/container/ts/export.rs write_pes sets dts: None (~line 652).
container::Frame carries a single timestamp (PTS); frames are delivered in decode
order with valid PTS, but no decode time is authored on export.
Recommended fix (exporter-side, non-breaking, main)
Frames already arrive in decode order, so the exporter can author a valid DTS with a
bounded reorder buffer (depth = max consecutive B-frames): within the window, assign DTS
= the PTS values in sorted order (exact for CFR broadcast). Emit dts: Some(..) when it
differs from PTS. No wire/format change; cost is a few frames of added latency. Removes
the out-of-order DTS and the +igndts requirement.
Optional follow-up (faithful, dev)
For byte-exact DTS (strict TR 101 290 / contribution), carry the original composition
offset (PTS-DTS) end to end: capture on TS import, add a field to container::Frame + the
hang container frame format, emit on TS/fMP4/FLV export. Breaking wire/format change ->
dev; mirror js/hang + doc/concept. Related: #1828's review found moq_mux::Export
send-timestamps use wall-clock, not PTS, and "needs a PTS-exposing API change" - the same
Export timing surface, worth solving together.
Branch
Exporter-side fix: main (additive). Faithful composition-offset carriage: dev.
(Written by Claude)
Problem
moq-cliTS export emits PTS only (no DTS), so B-frame streams carry no decodetimeline. Players see out-of-order DTS and need
ffplay -fflags +igndts. Validated on areal CNN 1080i contribution feed through
moq pub | relay | moq sub. Follow-up to #1798(multi-PPS, fixed); part of #1799.
Evidence (real feed)
ffprobe -select_streams v -show_frames -show_entries frame=pict_type ... | grep -c ',B$'), so decode order != presentation order.dts=N/A, then ffmpeg's reconstructed DTS isnon-monotonic and repeats (many frames share one DTS):
pts, dts 25.277000, N/A 25.557000, 25.297000 25.437000, 25.557000 25.357000, 25.557000 (DTS 25.557 repeated ~12x)
ffplaylogsDTS 2289330 < 2301930 out of order; plays only with-fflags +igndts.Root cause
rs/moq-mux/src/container/ts/export.rswrite_pessetsdts: None(~line 652).container::Framecarries a singletimestamp(PTS); frames are delivered in decodeorder with valid PTS, but no decode time is authored on export.
Recommended fix (exporter-side, non-breaking, main)
Frames already arrive in decode order, so the exporter can author a valid DTS with a
bounded reorder buffer (depth = max consecutive B-frames): within the window, assign DTS
= the PTS values in sorted order (exact for CFR broadcast). Emit
dts: Some(..)when itdiffers from PTS. No wire/format change; cost is a few frames of added latency. Removes
the out-of-order DTS and the
+igndtsrequirement.Optional follow-up (faithful, dev)
For byte-exact DTS (strict TR 101 290 / contribution), carry the original composition
offset (PTS-DTS) end to end: capture on TS import, add a field to
container::Frame+ thehang container frame format, emit on TS/fMP4/FLV export. Breaking wire/format change ->
dev; mirror
js/hang+doc/concept. Related: #1828's review foundmoq_mux::Exportsend-timestamps use wall-clock, not PTS, and "needs a PTS-exposing API change" - the same
Export timing surface, worth solving together.
Branch
Exporter-side fix:
main(additive). Faithful composition-offset carriage:dev.(Written by Claude)