[Ffmpeg-devel] compute_frame_duration and pkt->duration

Baptiste Coudurier baptiste.coudurier
Wed Nov 15 11:04:01 CET 2006


Hi

Michael Niedermayer wrote:
> Hi
> 
> On Wed, Nov 15, 2006 at 01:07:09AM +0100, Baptiste Coudurier wrote:
>> Baptiste Coudurier wrote:
>>> Hi
>>>
>>> Here is the problem I experience:
>>>
>>> gxfenc.c av_set_pts_info to 1/50 because gxf dts are field based, while
>>> codec timebase is 1/25. When computing frame duration, it first takes
>>> stream timebase, and it will compute frame duration as 1, and timebase
>>> as 1/50.
>>>
>>> With delay, that will cause first dts to be -1 in stream timebase.
>>> dts in gxfenc.c: -1,0,2,4,6,8,10 ..... to be right, first dts should be -2.
>>>
>>> Maybe Im wrong or compute_frame_duration should only take codec timebase
>>> into account and then compute_pkt_fields2 will rescale according to
>>> stream timebase.
>>>
>>> What would be correct behaviour ?
>>>
>> Ping ? Has somebody an idea about that ? Michael ?
> 
> of course should the first dts be ideally -2 (or 0,2,4,... and the pts be
> increased accordingly) i know it doesnt work currently, its a bug ...

One solution is to take only avctx timebase into account for frame
duration then rescale to stream one if needed. That way I have -2.
IMHO frame duration does not actually depend on stream timebase.

> then theres the question what to do about frames with pts
> 0,2,5,6,9 (or any other random series)
> its trivial to calculate the dts for frames 1, 2, ... but what about 0?
> what is the correct dts for it?

Well, one solution is to set dts of the frame 0 to -codec_delay,
H264 with B pyramid is -2, normal b frames is -1.
That should work, no ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: frame_duration.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061115/ede557fd/attachment.txt>



More information about the ffmpeg-devel mailing list