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

Michael Niedermayer michaelni
Sat Jul 16 09:42:21 CEST 2005


Hi

On Saturday 16 July 2005 03:16, Kenneth Aafl?y wrote:
> Hi!
>
> 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?

yes and no, duration is calculated based upon the timebase / framerate and the 
number of fields in a frame for mpeg1/2, if this is summed up over many it 
could be slightly different from the pts/dts values and so it would ruin AV 
sync sometimes if you would ignore pts/dts and just use duration


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

libavformat just outputs whats in the file and fills in missing information 
where its not too complicated, and its much easier to fill in missing dts 
values then missing pts, later would require to read several frames ahead 
which currently isnt supported
but using dts is fine for decoding, after all they are identical to the 
reordered pts values

PS: no need to CC me, iam subscribed, yes really i cant belive it myself

[...]
-- 
Michael





More information about the ffmpeg-devel mailing list