[MPlayer-dev-eng] mp4, vfr and timestamps

Tomas Carnecky tom at dbservice.com
Fri Jun 16 18:52:41 CEST 2006


Luca Barbato wrote:
> Tomas Carnecky wrote:
> [patch]
> 
> quick review
>>  
>> +  fprintf(stderr, "PTS: %f\n", sh_video->pts);
> 
> remove it, doesn't belong here at all the rest looks almost ok on a
> first view.
> 

Yep.. that slipped in.. but another, bigger problem is that mplayer
chokes on non-sequential timestamps. My patch will let mplayer respect
the ctts table, but mplayer will only play back files that are without
B-frames. As soon as I encode the stream with B-frames it will choke and
complain:

Invalid frame duration value (1.068/0.914 => -0.154). Defaulting to
0.052 sec.

Let's assume x264 creates this frame sequence: I-B-B-B-I, assigns DTS
1-2-3-4-5 and CTS offsets 2-5-1-1-1 to the frames. That means the frames
should decoded and displayed as follows:
frame - decode - display
1     - 1      - 1+2=3
2     - 2      - 2+5=7
3     - 3      - 3+1=4
4     - 4      - 4+1=5
5     - 5      - 5+1=6

but since frame 3 gets a timestamp that is before frame 2 mplayer complains.

I've created two video files, one with and one without b-frames:
http://www.dbservice.com/ftpdir/tom/h264-bframes-cts.mp4
http://www.dbservice.com/ftpdir/tom/h264-no-bframes-cts.mp4

with my patch, the file without b-frames plays fine, with b-frames,
mplayer complains with the above message.
without my patch, you'll see how I run faster and slower depending on
the framerate, in both videos.

tom



More information about the MPlayer-dev-eng mailing list