| Version 6 (modified by , 12 years ago) ( diff ) |
|---|
VBR Encoding
Example to encode VBR MP3 audio with ffmpeg using the libmp3lame library:
ffmpeg -i input.wav -codec:a libmp3lame -qscale:a 2 output.mp3
Control quality with -qscale:a (or the alias -q:a). Values are encoder specific, so for libmp3lame the range is 0-9 where a lower value is a higher quality. 0-3 will normally produce transparent results, 4 (default) should be close to perceptual transparency, and 6 produces an "acceptable" quality. The option -qscale:a is mapped to the -V option in the standalone lame command-line interface tool.
| LAME Bitrate Overview | |||
|---|---|---|---|
| Option | Kbit/s | Bitrate range kbit/s | ffmpeg equiv. |
| -b 320 | 320 | 320 CBR | -b:a 320k (NB this is 32KB/s) |
| -V 0 | 245 | 220...260 | -q:a 0 (NB this is 22 to 26 KB/s, etc...) |
| -V 1 | 225 | 190...250 | -q:a 1 |
| -V 2 | 190 | 170...210 | -q:a 2 |
| -V 3 | 175 | 150...195 | -q:a 3 |
| -V 4 | 165 | 140...185 | -q:a 4 |
| -V 5 | 130 | 120...150 | -q:a 5 |
| -V 6 | 115 | 100...130 | -q:a 6 |
| -V 7 | 100 | 80...120 | -q:a 7 |
| -V 8 | 85 | 70...105 | -q:a 8 |
| -V 9 | 65 | 45...85 | -q:a 9 |
In our example above, we selected -qscale:a 2, meaning we used LAME's option -V2, which gives us a VBR MP3 audio stream with an average stereo bitrate of 170-210 kBit/s.
CBR Encoding
If you need constant bitrate (CBR) MP3 audio, you need to use the -b:a option instead of -qscale:a. Here you can specify the number of bits per second, for example -b:a 256k if you want 256 Kbit/s (25.6 KB/s) audio.


