Repository navigation
Description
What this is not
#3334 is closed and
#3351 closed it properly. I verified that here against
#3351's own merge-base, both built from one worktree: PCR packets adjacent to their predecessor went
50.31 % → 0 %, release intervals outside ±10 ms went 491/799 → 0–4/745, worst release error
91.4 ms → 3.9 ms, and all six checks passed. This is not a regression report and not a reopen.
It is the next property along, and #3351's checks do not grade it: not-adjacent is not evenly
spaced. A PCR seven packets after its predecessor passes an adjacency check and is still 158
packets short of where a constant-rate stream would put it.
Measured on 53f8aa99d
150 s of a 9,945,951 b/s CBR source through a loopback relay, captured from export ts stdout with
the source's stuffing intact so mpegts.muxRate is recorded and #3831's padding is active. Grading
the single PCR-bearing PID (0x006F) — pooling PCRs across PIDs gives a meaningless series, so the
grader names every PCR PID it finds and grades one.
The two things that are right, and they are worth stating first:
| source clip | export ts |
|
|---|---|---|
| PCR interval — min / median / max | 0.151 / 24.65 / 24.95 ms | 25.00 / 25.00 / 25.00 ms |
| intervals over TR 101 290 P1's 40 ms | 0 | 0 of 6,173 |
| intervals under 1 ms | 21 (0.09 %) | 0 |
| rate over the whole capture | 9,945,951 b/s | 9,966,922 b/s (+0.21 %) |
The PCR values are better than the source's, and #3831's padding lands the aggregate within 0.21 %
of the declared rate. Both of those are real improvements and neither is in question.
The thing that is not right is where the bytes sit between those PCRs:
| bytes between consecutive PCRs | min | p10 | p25 | median | p75 | p90 | p99 | max |
|---|---|---|---|---|---|---|---|---|
export ts, 53f8aa99d |
188 | 940 | 940 | 1,316 | 6,392 | 66,364 | 384,460 | 870,628 |
| what the declared rate needs | 31,081 | 31,081 | 31,081 | 31,081 | 31,081 | 31,081 | 31,081 | 31,081 |
The mean is 31,147 B, which is correct to 0.21 % and is the same fact as the aggregate rate. The
median is 1,316 B, 4.2 % of the mean. The distribution is bimodal rather than noisy: a mode below
1 kB, an order of magnitude under requirement, and a second mode well above it. Only 205 of 6,173
intervals (3.3 %) carry an instantaneous rate within 1 % of nominal, and the instantaneous rate runs
60,160 b/s to 278,600,960 b/s — 0.6 % to 2,800 % of the declared rate.
So the PCR values are stamped onto a perfect 25 ms grid regardless of the byte position they land at.
Why it matters, concretely
A receiver that recovers its clock from packet arrival cannot use this stream. That is the
ordinary IRD case, and it is what a TR 101 290 P2 accuracy gate models: P2 predicts a PCR's arrival
from its byte position under a constant-rate assumption. Where the instantaneous rate spans four
orders of magnitude there is no byte position that predicts anything, so the gate is not failed by a
small error — it is the wrong kind of stream. That, rather than imprecision, is why every PCR failed
a 481 ns gate in our earlier measurements.
It is also what blocks deterministic 1+1, which surprised me. A groomer can place packets on the
slot each source PCR implies only if the source's PCR byte positions track its PCR values.
mpegts-pacer's stream-clocked mode measures that divergence rather than assuming it, and against
this output it reports 731 overrun intervals and a positional displacement of 5,762 packets
(871 ms at the locked rate) — identical across two independent cells, so it is a property of the
output and not of the run. The consequence is that content arrives for slots already emitted as
stuffing: 93.1 % of the output is stuffing even at a 1,500 ms cushion, nearly twice the measured
displacement. So the schedule is upstream of the interleave question in
#2829 too.
And it is why I said #3923 should wait. A UDP sink
would put this on a wire, where an IRD would reject what a pipe tolerates. If only one of the two
gets done, it should be this one.
What would close it
Some constraint tying PCR byte position to PCR value, so that the packets between two PCRs are the
number the declared rate implies — the property #3831 already assumes when it pads to a rate. I
don't have a view on where that belongs in the mux, and the two are clearly coupled: padding to a
rate and placing PCRs on the byte grid are the same scheduling decision made once rather than twice.
A check that would catch it: grade the distribution of bytes between consecutive PCRs, not just
adjacency. The adjacency check passes on this capture.
Grader is
pcr-residual.py;
it reads the interval from the carried PCR values and the rate from the packet count over the same
pair, so the two cannot disagree about which stream they describe. Happy to run anything else that
would help, or to re-take this against a different source profile if the clip is doing something I
haven't noticed.
Domain: file, on a capture of export ts stdout — byte position is the quantity of interest, so
the file domain is the right one. Nothing here is graded on a hardware IRD.
Activity
kixelated commentedon Sep 28, 2026
Summary of the planning decision (#3987):
tsp,socat, or a groomer. export ts: a UDP sink, so a rate-padded transport stream can reach a receiver without a second process #3923 was closed as not planned.mpegts.muxRate, each PCR's value comes from its byte position at that rate. A keyframe burst is spread over the slots before its DTS. Streams without a mux rate stay VBR.--max-age. Muxing ahead of decode needs a buffer. The buffer grows to fit the largest burst seen, up to--max-age, so no new flag is needed. We chose this over a fixed delay (ffmpeg uses 0.7 s) so streams that don't need the buffer don't pay for it.quest/m1/ts-export-byte-schedule.md. This issue was closed when the plan merged, not when the fix landed. The moq export ts: the audio/video interleave is decided by arrival timing, so two exporters of one broadcast render the same media in different orders #2829 interleave work it depended on has landed in fix(moq-mux): order TS export by media time, not arrival #4001.(Written by Claude Opus 5.5)
feat(moq-mux): schedule TS export bytes on the mux rate
feat(moq-mux): schedule TS export bytes on the mux rate
t0ms commentedon Oct 9, 2026
Closing: the fixed-delay export merged in #4645 answers this. It lays the multiplex on a 25 ms PCR grid at the mux rate, so the bytes sit where the PCR values say they do. On
mainatf8215bc47, withCNNiEMEA2.tslooped through a loopback relay at--delay 1sfor 35 minutes, every one of the 83,908 PCRstsp -P pcrverifychecked was within ±481 ns of their byte position at the mux rate, and every T-STD buffer was legal in all 1,046 two-second windows.