[MPlayer-dev-eng] [PATCH] mencoder, B-frames, and video/audio delay

Corey Hickey bugfood-ml at fatooh.org
Sun Jan 22 06:22:06 CET 2006


On Sat, January 21, 2006 17:48, Loren Merritt wrote:
>>>> --- libmpcodecs/ve_lavc.c	10 Jan 2006 11:09:02 -0000	1.125
>>>> +++ libmpcodecs/ve_lavc.c	21 Jan 2006 05:44:32 -0000
>>>> @@ -750,6 +750,9 @@
>>>>         mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) +
>>>> lavc_venc_context->extradata_size;
>>>>     }
>>>>
>>>> +    if (lavc_venc_context->max_b_frames)
>>>> +        mux_v->encoder_delay = lavc_venc_context->max_b_frames + 1;
>>>> +
>>>
>>> Why the +1? This seems incorrect,
>>
>> I don't know. That's what Michael suggested and I've been assuming it to
>> be correct. I know I can't really notice 1/24 second sync difference.
>>
>> http://www1.mplayerhq.hu/pipermail/mplayer-dev-eng/2005-December/039425.html
>
> I think the +1 is for decoding delay. So it is true that total delay =
> bframes+1, but it is incorrect to put the +1 in the muxer.

Huh. That makes sense. If I'm reading things right, then that's the way x264
does it:

x264/encoder/encoder.c:562
h->frames.i_delay = h->param.i_bframe;

...however, libavcodec adds the +1 whenever B-frames are present.

libavcodec/mpegvideo.c: 1195
s->low_delay= s->max_b_frames ? 0 : 1
avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);

I really don't know if either is incorrect. That would have to be up to
Michael or yourself.

Thanks,
Corey




More information about the MPlayer-dev-eng mailing list