[Vorbis-dev] How do you set the encoder bit reservoir size?

Michael Smith mlrsmith at gmail.com
Mon Aug 1 07:12:02 PDT 2005

On 8/1/05, Jefferson Stonier <jeffstonier at yahoo.com> wrote:
> Hi;  In the Vorbis 1.1 release notes from July 7, 2004, Monty says 
>   "The 1.1 libvorbisenc allows setting the fixed reservoir size (in bits,
> defaulting to two seconds worth of requested bitrate) and 'hoarding'
> behavior (whether the encoder tends to keep the bit reservoir more
> full or more empty) as well as the other encoding heuristics available
> through the API of 1.0.1."
> I'm sorry to be so obtuse, but I do not see where in the API to set the
> reservoir size or hoarding behavior.  I checked out
> http://svn.xiph.org/trunk/vorbis, and am looking at
> vorbisenc.h. Is that the wrong place to look?  

That's the right place to look, and indeed the neccesary constants,
structures, and API calls are defined there, but they're not terribly
helpfully documented.

You  probably want to do something like this:

Set up an encoder as normal, using, presumably,
vorbis_encode_setup_managed(), then:

struct ovectl_ratemanage2_arg ai;
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_GET, &ai);

Then change ai.bitrate_limit_reservoir_bias and
ai.bitrate_limit_reservoir_bits, then finally set these with:
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, &ai))

Then finalise encoder configuration with vorbis_encode_setup_init().

Patches to improve documentation would be welcomed!


More information about the Vorbis-dev mailing list