Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE

This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Tip: Encoding VBR (Variable Bit Rate) mp3 audio

A collection of useful tutorials for some common tasks.

Tip: Encoding VBR (Variable Bit Rate) mp3 audio

Postby burek » Thu Apr 12, 2012 2:40 am

To encode VBR mp3 audio with FFmpeg, using libmp3lame library, we would specify a command like this:
Code: Select all
ffmpeg -i input.wav -aq 2 out.mp3

Option "-aq" needs a parameter, that tells FFmpeg something about expected "audio quality" (of course, this parameter has a different meaning for each audio encoder used, and we are now describing the libmp3lame encoder).

The table for LAME option -V<num> is shown here (and that option is mapped to FFmpeg's -aq option):
http://wiki.hydrogenaudio.org/index.php ... 9_settings

Code: Select all
Switch        Kbit/s        Bitrate range kbit/s
-b 320        320           320 CBR
-V 0          245           220...260
-V 1          225           190...250
-V 2          190           170...210
-V 3          175           150...195
-V 4          165           140...185
-V 5          130           120...150
-V 6          115           100...130
-V 7          100            80...120
-V 8           85            70...105
-V 9           65            45...85

So, in our example above, we selected "-aq 2", meaning we used LAME's option "-V2", which gives a VBR mp3 audio in the range of 170-210 kbit/s.

If you want constant bit rate (CBR) mp3 audio, instead of using "-aq" option, you need to use "-ab" option to set the preferred "audio bit rate" in bps, like "-ab 256k" if you want 256 kbit/s audio.
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest