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

Corey Hickey bugfood-ml at fatooh.org
Sat Jan 21 21:45:04 CET 2006


Rich Felker wrote:
>>>>Instead you need to make the encoder advertise the number of frames of
>>>>encoding-delay it has, and fake the muxer timer to compensate for it.
>>>
>>>
>>>That's what I was thinking of earlier, but I thought I had found a
>>>better solution.
>>
>>Ok, so here it is, I think. Again, it seems to work. I don't see any
>>delay when I specify lower -ofps values, either.
>>
>>I've tested these:
>>x264       ... 16 B-frames
>>lavc mpeg4 ...  4 B-frames
>>xvid (new) ...  4 B-frames
>>
>>I haven't tested the old xvid (ve_xvid.c), but it should work as well.
>>
>>-Corey
> 
> 
>>Index: libmpcodecs/ve_lavc.c
>>===================================================================
>>RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
>>retrieving revision 1.125
>>diff -u -r1.125 ve_lavc.c
>>--- 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

Michael? Loren?

I'd like to be sure it's correct for each of lavc, x264, and xvid.

> certainly incorrect with 0 B frames.

I put them all in if()s so there's no effect without B-frames. If the +1
is bogus then I won't have to.

> Otherwise I think this patch will work!

Great!

-Corey




More information about the MPlayer-dev-eng mailing list