Problem when configuring vorbisenc to use CBR

Tiago Katcipis katcipis at
Mon Feb 17 05:28:34 PST 2014


Now I'm using this pipeline to have more control on the audio duration:

audiotestsrc samplesperbuffer=8000 num-buffers=<seconds> !
audio/x-raw,rate=8000,channels=1 ! vorbisenc managed=true min-bitrate=32000
bitrate=32000 max-bitrate=32000 ! oggmux ! filesink location=/tmp

Then i generated some files and used oggz-info to check the bitrate:

1 second file:

oggz-info -b /tmp/1second.ogg
Content-Duration: 00:00:01.024
Content-Bitrate-Average: 48.617 kbps

3 seconds file:

oggz-info -b /tmp/3seconds.ogg
Content-Duration: 00:00:03.008
Content-Bitrate-Average: 37.978 kbps

15 seconds file:

oggz-info -b /tmp/15seconds.ogg
Content-Duration: 00:00:15.008
Content-Bitrate-Average: 33.743 kbps

30 seconds:

oggz-info -b /tmp/30seconds.ogg
Content-Duration: 00:00:30.016
Content-Bitrate-Average: 33.205 kbps

60 seconds:

oggz-info -b /tmp/60seconds.ogg
Content-Duration: 00:01:00.000
Content-Bitrate-Average: 32.940 kbps

3600 seconds:
 oggz-info -b /tmp/3600seconds.ogg
Content-Duration: 01:00:00.000
Content-Bitrate-Average: 32.676 kbps

The bigger the file the closer it seems to be of my desired bitrate, but it
never matches the bitrate exactly.

I checked out the vorbisenc plugin, but it seems to be doing everything
correctly. So i tried to use oggenc to do some testing:

oggenc --managed --min-bitrate 28 --max-bitrate 28 --bitrate 28 /tmp
    File length:  0m 01.0s
    Elapsed time: 0m 00.0s
    Rate:         30.3509
    Average bitrate: 24.9 kb/s

oggenc --managed --min-bitrate 28 --max-bitrate 28 --bitrate 28 /tmp
    File length:  1m 00.0s
    Elapsed time: 0m 01.0s
    Rate:         60.5768
    Average bitrate: 28.4 kb/s

With the oggenc generated files oggz-info wont give me the bitrate anymore
(when i generate with GStreamer it does).

But checking the file size and the output of "play" the bitrate is still
not fixed and depending on the audio duration of the file, it will differ.

So the inconsistent behaviour of the CBR configuration seems to be on
Vorbisitself, i thought that maybe it did not support
CBR, but it seems to support:

But on the Vorbis documentation i only see the "managed" concept, I'm
starting to think that:

1 - I don't have a clue of what really is CBR :-).

2 - Vorbis don't have CBR, only a polite managed mode that will get close
to what you want.

I need to be able to predict the size of the audio file that will be
generated (before generating it of course :-) based on the duration of the
audio (some transcoding will happen), i cant do that with VBR, and it seems
that Vorbis wont be the tool that will enable me to do it :-(.

Can anyone give me any help on this ? It would be deeply appreciated.

Best regards,
Tiago Katcipis

On Fri, Feb 14, 2014 at 8:50 PM, Tiago Katcipis <katcipis at>wrote:

> Hi,
> I need to use CBR on vorbisenc, but it don't matter how much i set it to
> be on a fixed bitrate the bitrate is still variable. If i run "file" on
> the ogg file it does says it has the right bitrate, but when i play it with
> "play" it have another bitrate (always a little higher than the one
> configured). Calculating the size manually also indicates
> the bitrate informed by play, so it seems that it is not respecting the
> configured bitrate.
> For example i run:
> gst-launch-1.0 pulsesrc ! audioconvert ! audioresample !
> audio/x-raw,rate=8000,channels=1 ! vorbisenc managed=true
> min-bitrate=28000 bitrate=28000 max-bitrate=28000
> ! oggmux ! filesinklocation=/tmp/test.ogg
> I get:
> file /tmp/test.ogg
> /tmp/test.ogg: Ogg data, Vorbis audio, mono, 8000 Hz, <28000 ~28000 >28000
> bps, created by: Xiph.Org libVorbis I
> Its ok, but on play:
> play /tmp/test.ogg
> /tmp/test.ogg:
>  File Size: 13.6k     Bit Rate: 35.9k
> It seems that the bitrate cant be fixed, but i read that vorbis does
> support CBR, am i missing something ?
> Best regards,
> Tiago Katcipis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list