Ubuntu - Sound - lame
Encode as mp3 or re-encode an mp3 file to a different bit rate.
Lame is a well known open source mp3 encoder.
For example to encode from WAV format to mp3 or to re-encode an mp3 to a different bit rate.
Minimal example of converting a wave file to mp3.
lame input.wav output.mp3
Re-encode existing MP3 to 64 kbps mp3.
lame -b 64 original.mp3 new.mp3
More interesting options.
-m m: save as mono -m s: save as stereo -m j: save as joint stereo (exploits inter-channel correlation more than regular stereo) -q 2: quality tweaking: the lower the value, the better the quality, but the slower the algorithm. Default is 5.
By default, lame uses constant bit rate (CBR) encoding. You can also use average bit rate (ABR) encoding, e.g. for an average bit rate of 123 kbps:
lame --abr 123 input.wav output.mp3
or variable (VBR) encoding, e.g. between 32 kbps and 192 kbps:
lame -v -b 32 -B 192 input.wav output.mp3
For top quality. Very high quality: HiFi, home, or quiet listening, with maximum file size.
lame -b 320 -h
meaning 320 kbps constant bitrate, high-quality, true-stereo. The highest quality mp3 possible.
or
lame -V 1 -b 128 -m j
meaning bitrate level 1, minimum bitrate of 128 kbps, joint stereo, high quality. Nearly identical sounding as the previous option, but an average bitrate usually between 160 and 200. Encoding will be slower.
LAME Bitrate Overview
Option | Average kbit/s | Bitrate range kbit/s | Description |
---|---|---|---|
-b 320 | 320 | 320 CBR (non VBR) example | Generally considered wasteful because mp3 is lossy anyway, so if you really want the highest quality use a lossless format such as FLAC. |
-V 0 | 245 | 220-260 | Very high quality: HiFi, home, or quiet listening, with best file size. These VBR settings will normally produce transparent results. Audible differences between these presets may exist, but are rare. |
-V 1 | 225 | 190-250 | |
-V 2 | 190 | 170-210 | |
-V 3 | 175 | 150-195 | |
-V 4 | 165 | 140-185 | Portable: listening in noisy conditions, lower bitrate, smaller file size. Close to perceptual transparency. |
-V 5 | 130 | 120-150 | |
-V 6 | 115 | 100-130 | “Acceptable” quality. |
-V 7 | 100 | 80-120 | Very low bitrate, small sizes: eg. for voice, radio, mono encoding etc. |
-V 8 | 85 | 70-105 | |
-V 9 | 65 | 45-85 |
For very low bitrates, up to 100kbps, ABR is most often the best solution. Use –abr <bitrate> (e.g. –abr 80).
–preset voice is only available in the command line front-end, and is there for compatibility. It is currently mapped to –abr 56 -mm, so that means that the recommendation would be to encode in mono, and use ABR.