[FFmpeg-devel] mpegtsenc T-STD compliance

Dominguez Bonini, David david.dominguez at ikusi.com
Wed Jan 23 10:42:54 CET 2013

> How are you measuring PCR accuracy in VBR mode? PCR accuracy is only well-
> defined in CBR mode.

Well, I said correct instead of accurate. I agree that, in VBR mode, instantaneous accuracy is not important. Things like long term drift are more important, and since the muxer seems to derive PCRs from the PTSs of the input streams I assume that it is good enough to reconstruct timing in a receiver. 

> > Regarding invalid inputs, I guess all we can do is error out. The T-STD
>> models are meant to ensure the encoder generates a stream any compliant
> >decoder can handle, so I think being unforgiving with invalid inputs or use
> >cases is the right thing to do.
> This is tricky because you don't know whether the timestamps are good or
> not. It's easy when you are getting data from an encoder.

 For the cases I have tested (PTS autogenerated from -fflags genpts  and PTSs obtained from an incoming PES stream), the behavior of the muxer is correct, except for T-STD compliance. If the incoming timestamps are incorrect, I agree nothing can be done.

> I am not sure how current packet writing calls in libavformat can follow T-STD
> since each lavf packet needs to be split up and muxed sequentially with
> other packets.

I agree, this is the real trick. How to generate a correct TS without unduly complicating the muxer. I have to think on this, but it may be possible if you defer output generation (using FIFOs to queue the encoding contexts) until you have all data from all streams for a given output interval.

More information about the ffmpeg-devel mailing list