[Ffmpeg-devel] Calculating PTS Times
Fri Oct 21 03:53:38 CEST 2005
On Fri, Oct 21, 2005 at 08:00:59AM +0800, Colin Ward wrote:
> Hi all.
> I wonder if some kind soul could help me with my PTS calculations. It
> seems that this is an area of confusion for many people. Take a look at
> the attached snippet of code. It is a simplified piece of code from my
> media player which decodes a video frame and calculates its PTS. As you
> can see, it contains logic to both extract the PTS both when it is
> specified by the decoder *and* when it is not.
> 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
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.. :(
More information about the ffmpeg-devel