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

Michael Niedermayer michaelni
Thu Feb 26 00:56:30 CET 2009


On Wed, Feb 25, 2009 at 09:38:17PM +0100, Ivan Schreter wrote:
> Michael Niedermayer wrote:
>> On Tue, Feb 24, 2009 at 09:38:55PM +0100, Ivan Schreter wrote:
>>   
>>> Michael Niedermayer wrote:
>>>     
>>>> On Tue, Feb 24, 2009 at 08:20:53PM +0100, Ivan Schreter wrote
>>>>> I'd propose adding a flag field_picture_flag to AVPacket (and pass it 
>>>>> from the parser) to notify the user about field pictures, so it can 
>>>>> correctly compute frame rate. What do you think? Or do you have a 
>>>>> better idea?
>>>>>             
>>>> i dont know, it doesnt seem to be such a big issue to me to have 2*fps 
>>>> ...
>>>>
>>>>         
>>> It is for the user. See, I want to convert a H.264 interlaced video to 
>>> some other format. So I'd call ffmpeg -i h264.mts -vcodec mpeg2video 
>>> -acodec mp2 -f vob h264.vob. What will this do? It will create a vob with 
>>> 2*fps and each picture duplicated, which is definitely not what we 
>>> want... True, the user could specify -r 25 to force frame rate to 25fps, 
>>> but it's not logical. So IMHO we need this. Agreed?
>>>     
>>
>> yes, there is a problem
>>
>>   
>
> The three attached patches introduce field_frame_flag for 
> AVCodecParserContext and AVPacket, use it to correct durations and generate 
> field frame flag in H.264. This fixes the problem and interlaced H.264 
> movies are now detected at correct fps.

i think (but maybe i miss something) that a solution based on
your "ticks_per_frame" and repeat_pict == 0
could be used to detect fields and this would have the advantage of also
providing a simple way to find the "old time_base" that is
time_base*ticks_per_frame if ticks_per_frame is in AVCodecContext.

[...]
> @@ -149,6 +149,17 @@
>       * subtitles are correctly displayed after seeking.
>       */
>      int64_t convergence_duration;
> +
> +    /**
> +     * Normally, parsed container frames contain a complete video frame.
> +     * However, for some formats (e.g., H.264), it is possible that a frame
> +     * contains only a field. As fields have just half the duration of normal
> +     * frame, frame rate detection would detect 2*fps instead of fps.
> +     * By setting this field, frame rate detection will detect correct fps.
> +     *
> +     * Default 0, set to 1 by parser, if a frame containing single field detected.
> +     */
> +    int field_frame_flag;
>  } AVPacket;
>  #define PKT_FLAG_KEY   0x0001

possibly irrelevant now, but this could be done simpler, like PKT_FLAG_KEY

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090226/bcd27ae5/attachment.pgp>



More information about the ffmpeg-devel mailing list