[FFmpeg-devel] [PATCH] VBR header for "libmp3lame"

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 16 17:01:28 CEST 2011


On Sat, Apr 16, 2011 at 04:21:40PM +0200, Michael Niedermayer wrote:
> On Sat, Apr 16, 2011 at 03:35:35PM +0200, Reimar Döffinger wrote:
> > On Fri, Apr 15, 2011 at 08:07:27PM +0200, Peter Belkner wrote:
> > > Hi,
> > > 
> > > in case the switch "-aq" is provided to the "libmp3lame" codec a VBR
> > > MP3 is generated as e.g. in
> > > 
> > >    ffmpeg -i a.wav -aq 2 b.mp3
> > > 
> > > This corresponds to
> > > 
> > >    lame -V2 a.wav b.m3
> > > 
> > > Unfortunately no VBR header is written often leading to a completely
> > > wrong estimate of the duration during playback (cf. e.g. http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2007-October/011573.html).
> > > 
> > > The patch allows for writing the VBR header as generated by "libmp3lame.a".
> > 
> > Unfortunately I don't know what exactly the header contains, but I think
> 
> google says:
> http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx
> 
> and i think it should be generated in the mp3 muxer independant of
> the encoder doing anything special

Oh, I only now understood.
In this case I have a few more comments:
1) You really need to check that the file is seekable before seeking back and updating the VBR part
2) It might be interesting to see if the av_add_index code that limits the number of entries
   is good enough to work for generating the TOC part of the header


More information about the ffmpeg-devel mailing list