[FFmpeg-devel] [RFC] mpegts: Provide a monotonic timestamp to the outside world

Hendrik Leppkes h.leppkes at gmail.com
Mon Oct 22 09:50:59 CEST 2012

On Mon, Oct 22, 2012 at 9:40 AM, Joakim Plate <elupus at ecce.se> wrote:
> Harald Axmann <harald.axmann <at> hotmail.com> writes:
>> I am using XBMC with PVR extension and came across the issue concerning
>> PCR wraps in TS recordings, as already mentioned by [1] and [2] for
>> example. After some discussion on XBMC's Github page Joakim Plate came
>> up with the idea, to patch all the time stamps directly on demuxing, so
>> that the outside world will see a monotonic time stamp starting at zero
>> [3]. I have implemented this approach and successfully tested it with a
>> couple of recordings. Please see the attached patch, which is also
>> available on Github [4]. It only deals with mpegts, since I have not
>> found any mpegtsraw material for testing.
> The problem we are trying to solve is that, its very common for mpegts
> recordings to contain one single wrap in them due to recording right
> when a channel has this wrap and it happening nightly.


I handle the wrapping in my application directly, and IMHO thats the
proper thing to do. The demuxer should expose the timestamps as they
are specified in the file, and anyone trying to consume a MPEG-TS file
needs to be able to deal with these kinds of timestamps (timestamps in
MPEG-TS are not really guaranteed to be fully continuous, i have
plenty samples where it just jumps around in the middle of the
If any such hacky mode is added to "invent" new timestamps, it should
be purely optional (controlled by a private option, for example), and
not be enabled by default.

Just my 2 cents.

- Hendrik

More information about the ffmpeg-devel mailing list