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

Michael Niedermayer michaelni at gmx.at
Sat Jan 21 21:38:43 CET 2006


Hi

On Sat, Jan 21, 2006 at 12:05:46PM -0500, Rich Felker wrote:
> On Fri, Jan 20, 2006 at 09:47:11PM -0800, Corey Hickey wrote:
> > Corey Hickey 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, certainly incorrect with 0 B frames.

this depends upon the codec, 0 B fames can be 0 or 1 delay
the correct delay is lavc_venc_context->delay

[...]
-- 
Michael




More information about the MPlayer-dev-eng mailing list