[Ffmpeg-devel] Calculating PTS Times

Rich Felker dalias
Fri Oct 21 15:58:45 CEST 2005

On Fri, Oct 21, 2005 at 02:28:16PM +0800, Colin Ward wrote:
> Rich Felker wrote:
> >
> >> From my understanding of FFMPEG this should for both VFR and CFR videos. 
> >>However, it does not work for all videos.  For some videos (both VFR and
> >>CFR) it calculates the PTS correctly and the video plays beautifully. 
> >>However, for others the calculated PTS values are crazy.  For instance 
> >>last
> >>night I enabled MOV support and my calculated values were coming out as 1,
> >>2, 3, 4, 5, 6 etc.  Yes, 1 as in 1 millisecond!  This was for an 8 FPS
> >>video.
> >
> >Increment by one timebase unit is definitely NOT correct. You need to
> >obtain a pts value for each frame. For proper containers, every frame
> >will come with a pts value to begin with. For broken containers, it
> >can be a lot of work to get the pts.. :(
>   I took this logic from one of the example programs that comes with 
> FFMPEG; IIRC it was from ffplay.c.  So what must I do in the case where 
> AVFrame->pts is 0?  Does this mean that the container/codec is broken? 
> And if so, shouldn't they be fixed?

0 means the pts is 0. If a demuxer outputs 0 except for the first
frame it's broken.

>   Surely if this is the case then everyone will be struggling with the 
> same issues that I am struggling with.  So what is happening?  Are they 
> coming up with their own solutions that work just with the subset of 
> formats and codecs they have chosen?
>   Is there any documentation on this issue, apart from the source itself?

Unfortunately no... :(


More information about the ffmpeg-devel mailing list