[FFmpeg-devel] [libav-devel] mpegts encoder not interleaving audio/video packets well
Mike Scheutzow
mike.scheutzow at alcatel-lucent.com
Mon Jun 27 19:29:03 CEST 2011
Tony Strauss wrote:
> While testing, I noticed a block of code in the mpegts encoder that struck
> me as strange (mpegtsenc.c:885):
> const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE)*2;
> int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
>
> if (pkt->pts != AV_NOPTS_VALUE)
> pts = pkt->pts + delay;
> if (pkt->dts != AV_NOPTS_VALUE)
> dts = pkt->dts + delay;
>
> The pts and dts of all of the packets gets incremented by twice max_delay,
> which seems contrary to its use in the mpeg ps muxer (although I may well be
> missing something).
>
I have always assumed that this offset is meant to prevent the initial
PCR value in the transport stream from being negative (i.e. a huge
positive value.)
This avoids a PCR timestamp wrap near the front of the stream.
Mike Scheutzow
More information about the ffmpeg-devel
mailing list