[FFmpeg-devel] [PATCH] H.264 timestamps in h264_parser - complete set

Ivan Schreter schreter
Fri Feb 20 15:30:16 CET 2009

Michael Niedermayer wrote:
> On Fri, Feb 20, 2009 at 12:00:35PM +0100, Ivan Schreter wrote:
>> Michael Niedermayer wrote:
>>> the parser also can set timetamps, they as well are in a container based
>>> timebase
>> Ok, then here the next patch to handle frame duration properly. Namely, for 
>> interlaced videos, it uses frame duration of 3600 (for 50i) instead of 
>> 1800, since it computes it from framerate. Since the parser can compute 
>> timestamps, it can also compute duration...
>> Actual duration computation will follow in H.264 parser patch to compute 
>> timestamps (it's actually already there in old version of the patch, but 
>> not propagated to lavf).
>> I'll clean up the patches for the parser and post them later today 
>> (dependent on this patch, though).
> this patch looks wrong, we already have a repeat_pict specifying duration
Yes, we do. Unfortunately, you can't specify half-frame duration (of 
display frame) for field pictures, except you'd set repeat_pict to -1 to 
subtract half a frame, which is possibly not what is desired. The 
solution giving parser the control of frame duration seems cleaner to me.

Alternatively, we can say that the duration of field pictures will be 
whole frame and they will be only offset in PTS (which is technically 
incorrect, since interlaced field is displayed only half-frame time).

BTW, current solution has anyway a problem: First of all, repeat_pict 
during parse time is one (transport stream) frame too late (as it comes 
from last decode, not from parse). Second, first parsed frame will have 
duration of 0, which is also incorrect (since frame rate and related 
stuff are not set yet, I suppose).

repeat_pict in decoded picture (to be consumed by the application) is 
set correctly, because even for field-based streams, we return frames, 
which are displayed for one frame.

I could set repeat_pict in parser instead, using -1 for field pictures 
to force half-frame duration.




More information about the ffmpeg-devel mailing list