[FFmpeg-devel] [PATCH] decode at least 4 H.264 frames in av_find_stream_info
Sun Jun 27 09:39:13 CEST 2010
On 6/26/10 7:43 PM, Michael Niedermayer wrote:
> On Sun, Jun 27, 2010 at 04:31:41AM +0200, Michael Niedermayer wrote:
>> On Thu, Jun 24, 2010 at 05:44:20PM -0700, Baptiste Coudurier wrote:
>>> Hi guys,
>>> This will permit the decoder to compute has_b_frames correctly when
>>> b-pyramid is present. 4 is typically the minimum needed, though maybe we
>>> should decode more based on has_b_frames. Any opinion ?
>> Finally found an old patch by myself doing this
>> I think its a bit more readable
>> if it works feel free to apply mine (assuming that thing still applies and
> ehm, the patch:
> Index: libavformat/utils.c
> --- libavformat/utils.c (revision 18646)
> +++ libavformat/utils.c (working copy)
> @@ -1820,6 +1820,12 @@
> +/*we need to find has_b_frames approximatly, the parser is not yet able to do it*/
> +static int has_decode_delay_been_guessed(AVCodecContext *enc)
> + return enc->codec_id != CODEC_ID_H264 || enc->frame_number>= 4 + enc->has_b_frames;
I'm not sure about enc->frame_number, now that st->codec_info_nb_frames
is used in av_find_stream_info, it seems the best field to use.
Your patch is not enough I think, you need to always call
try_decode_frame even if has_codec_parameters is true.
I propose to move incrementing of codec_info_nb_frames after
try_decode_frame (it's safe) in a separate commit and use your patch.
Is that ok for you ?
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel