LinuxConsulting

- Nicu Pavel personal page

What Average, Constant or Variable BitRates mean.



VBR - Variable bitrate
The encoder will make his bandwidth depending on:

Quality: Samples which don't require good quality will use lesser bandwidth and samples which have a lot of freqs will require more bandwidth.

Bitrate: Consider this as a minumum bitrate that encoder will use. usualy if you don't want some audio samples to be encoded at a lower bitrate/quality than you expect.

CBR - Constant bit rate
The encoder will make his bandwith *fixed* depending on BitRate and Quality settings.
Raising quality on this mode will make encoder eat more CPU and induce a little of latency.


ABR - Average bitrate
The encoder will try to make bandwith at maximum bitrate set from BitRate field making Quality variable depending on the number frequencies a sample have..

As a side note on winamp or other players you'll see the bitrate going like VBR while streaming in ABR mode. This is true from a technical point of view but not from bitrate point of view.
Let's say you want to encode at ABR with a bitrate of 160k. The abr mode will choose to encode a frame at 128k and next frame at 256k, then computes average and encodes the next at 96k. There are multiple frames in 1 sec of audio so in bitrate terms you will still get 160kbps but winamp will display frames sometime as 128k, 256k, 96k etc.

Technical Details


One of the features of mp3 and vorbis is the bit reservoir, which is in a shortly explanation a way of expanding bits in a frame to another.
In CBR, lame (and others encoders) compute the nessecary information to compact a audio frame in mp3, but sometimes the nessecery bits are bigger then what you get, so if say another frame after need less bits to be encoded you can put the extra info on that frame.

So let's say that this frame needs 192Kb/s to be correctly encoded but you are encoding a cbr mp3 in 160kb/s. without bit reservoir this frame would be cutted and compacted to 160kb/s.
But with bit reservoir another future frame may need only 128kb/s so that leaves space free and you can put the extra 32kb/s of the previous frame in this one, provided that you mark in this frame where did you put the extra 32kb/s. So it's something similar to a second pass in the data to know where you can put the extra bit's.

ABR is similar to CBR with bit reservoir, in the way that they produce a constante bitrate, but cbr uses bit reservoir and ABR just balances bettewn VBR and the need of producing a constante ratio bettwen compression and quality, say ABR also choose if one can compact a frame with only 128Kb/s and in the future you need to compact another with 256kb/s and so on, in order to obtain a constante bitrate (if you sum all of the bitrates choosen).

So if space is a concern, choose ABR as it work like a VBR in CBR mode.
If space/cpu is not a concern:

lame -b 192 --vbr-new -q 0 -B 320 -m s -F --lowpass-width 19.5 --athtype 3 Explanations: -b 192 never drop under 192, so you get only 4 bitrates to choose from -q 0 why should one uses a less quality alghorhythm even if it takes less time when you do have time? only lower this if you got a slow CPU -m s same people say that joint stereo encodes really good, and when lame can't use joint mode because it produces bad results it switchs to stereo mode, well, why should't i use true stereo mode(it's ver kill but it guarantees the trully separation of chanel data and dosen't use any kind of correlation bettwen chanels) -F it's need becuse LAME makes the very few seconds on the end of a music being 32Kb/s so if you rip a mix album on the end of the tracks a few seconds get out in 32kb/s really weird behaviour ...

If you have a 64kbps target vbr can save you some bandwidth sometime by encoding at lower bitrate some samples but also can be a nightmare for clients that are restricted to a 64kbps only channel since VBR can go over that 64kbps limit. Of course buffering helps but better not relay on that. For lower bitrates 8k-32kbps I'll choose ABR or CBR through ABR is my first choice.


ABR VBR and CBR streaming