[FFmpeg-user] Avoiding rollover pts due to input looping

Mike Scheutzow mike.scheutzow at alcatel-lucent.com
Mon May 21 16:06:23 CEST 2012

Robert Nagy wrote:
> I would like to avoid to handle pts rollover due to input looping. In
> particular the need to reinitialize filter graphs.
> Can I do that by modifying the AVPacket::pts after av_read_frame in
> order to get continuous pts, or can that mess up decoders?

Decoders should handle this, so what you propose should be ok.

If all the frames arrive with timestamps, you should be good.

But if some arriving frames do not have timestamps, and libavformat is 
"helpfully" filling them in, make sure to double check that libavformat 
is generating accurate values before and after the rollover.

Don't forget that PTS might not be monotonic.

Mike Scheutzow

More information about the ffmpeg-user mailing list