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

Måns Rullgård mans
Tue Feb 5 01:50:04 CET 2008

Paul Kelly <paul at stjohnspoint.co.uk> writes:

> 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"},


> +#define CODEC_FLAG2_DISABLE_RESERVOIR 0x00020000 ///< libmp3lame disable bit reservoir.

I don't like the idea of such specialised options.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list