[MPlayer-dev-eng] mp4, vfr and timestamps
tom at dbservice.com
Thu Jun 8 17:32:08 CEST 2006
I have a huge video file which contains raw YUV images plus timestamps.
The timestamps are in microsecond-resolution (gettimeofday). I'd like to
encode and convert it to mp4/avi/mkv or another 'common' container
format. I've hacked up a demuxer for x264 and I'm using x264 to encode
the video to H.264.
Now to the timestamps. Because I don't necessarily need microseconds
resolution, I set num=1000,den=1 (1000fps) and divide the timestamps by
1000. This works very well if I save it to mkv (matroska), but when I
save it to mp4 and play the file using mplayer, it tries to play the
file as if it was 1000fps. AFAICS from the x264 source code, mp4 saves
the timestamps as 'dts/offset' rather than just 'pts'. 'dts' seems to be
'timestamp of the i-th frame if the video was cfr' and offset is the
difference between dts and the actual timestamp. Mplayer seems to only
read 'dts' and not care about the offset. I can set the offset to
whatever value I like, mplayer always plays the file in the same speed
I can give you a link to the mp4 file (it's ~10MB) if you want..
More information about the MPlayer-dev-eng