[Ffmpeg-devel] PTS Confusion (was: ffmpeg-devel Digest, Vol 4, Issue 34)

Kenneth Aafløy kenneth
Sat Jul 16 03:16:36 CEST 2005


l?rdag 16. juli 2005, 01:04, skrev Michael Niedermayer:
> the pts of a frame which is output by the decoder is the dts of the packet 
> which has been input and its also the reordered pts of the packet
> some formats like mpeg also allow these values to have discontinuities which 
> have to be detected and dealt with for example by using AVPacket.duration
> also note that AVPacket.duration is not always available although it should
> be available for mpeg1/2 and summing AVPacket.duration over several packets
> will be inaccurate just in case you are planing to try that ...

What is inaccurate in adding the duration together?
Is it not the duration of the frame?

I'm doing something like:
  - sync against current pts/dts
  - increase pts/dts by the frame duration
  - check if the the frame pts/dts is offset by at least frame duration
    from the calculated stream pts, repeat if it is.

IMHO, the frame pts must sync to some external frame duration,
and thus the pts that libavcodec/frame gives can't be followed

Currently I'm syncing against the dts value from libavcodec,
as that is the one with the least sporadic deviations.


More information about the ffmpeg-devel mailing list