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

Loren Merritt lorenm at u.washington.edu
Sat Jun 17 07:23:54 CEST 2006


On Fri, 16 Jun 2006, Tomas Carnecky wrote:

> Michael Niedermayer wrote:
>> for the case of mpeg1, mpeg2 and mpeg4 video there is a very
>> simle rule how PTS/CTS must be set (no frame reordering CTS=DTS, frame reordering
>> CTS=DTS for B frames, CTS of non B frames = DTS of next non B frame)
>
> Thanks for the explanation..
>
> But what should I do? If I set the framerate to the average framerate
> over the whole video it will happen that cts offset is negative (which
> isn't allowed), if I set the framerate to whatever the fastest framerate
> is (eg. first find the smallest pts difference between two frames and
> set num/den appropriately) then, if I have a long enough video, it will
> happen that dts/cts will have an offset > 100 frames.

If your video isn't constant framerate, then don't set a framerate. Both 
dts and cts should be vfr.

(No matter what the mp4 standard says, this is the correct way to do it. 
If mp4 doesn't allow this, then it just plain doesn't support vfr.)

--Loren Merritt



More information about the MPlayer-dev-eng mailing list