[FFmpeg-devel] Patch - Allow disabling of bit reservoir when encoding MP3 audio

Michael Niedermayer michaelni
Tue Feb 5 17:34:26 CET 2008

On Tue, Feb 05, 2008 at 12:40:18AM +0000, Paul Kelly wrote:
> Hello,
> May I suggest the attached patch for possible inclusion - as the subject 
> suggests, it allows the user to disable use of the bit reservoir through 
> the libavcodec API, when using libmp3lame to encode MP3. While generally 
> not considered a desirable thing to do due to it lowering the quality 
> slightly, disabling the bit reservoir is nonetheless useful when splitting 
> encoded output between different files, to avoid audio artefacts at the 
> start of a new file caused when some of the data for the first frame was 
> included in previous frames.
> Have I taken the right approach? Or is this not the right way and should 
> the codec always be closed and re-opened when splitting the output between 
> files? (I don't want to do this in my application because the initial 
> encoding delay will complicate things...)
> Paul

> Index: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c	(revision 11865)
> +++ libavcodec/utils.c	(working copy)
> @@ -762,6 +762,7 @@
>  {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
>  {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
>  {"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
> +{"disable_reservoir", "disable bit reservoir (libmp3lame)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DISABLE_RESERVOIR, INT_MIN, INT_MAX, A|E, "flags2"},

The mentioning of libmp3lame is not appropriate. The flag is not specific to

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080205/da5edc05/attachment.pgp>

More information about the ffmpeg-devel mailing list