LAME Official Logo

Common and recommended switches

Common settings

% lame [options] inputfile [outputfile]
    

Either name may be given as -, meaning standard input or standard output, so that LAME can sit in the middle of a pipeline.

lame --help lists the options in common use and lame --longhelp lists all of them; Detailed Settings describes each one.

Hydrogenaudio recommended settings

Examples

Constant bitrate

Variable bitrate

LAME has two kinds of variable bitrate, ABR and VBR.

ABR is the kind usually found in other MP3 encoders, and in Vorbis and AAC. The number of bits is decided by some measure of the audio - the perceptual entropy, say, or simply how many bits a given set of coding tables needs - rather than by the encoding error actually made. It should always give results at least as good as constant bitrate at the same average.

VBR decides the number of bits for each frame from the quantisation error it actually measures against the masking it estimates. 0 is the highest quality and makes the largest files, 9.999 the lowest and the smallest; decimals are allowed, such as 4.51. The sizes that result depend on the music: typically -V5 averages around 132 kbps and -V2 around 200 kbps.

Low bitrates

At around 24 kbps per channel and below, a 16 kHz sampling rate together with lowpass filtering gives better results than keeping the full bandwidth. LAME does this by itself, as commercial encoders do. Where the result is filtered more or less than suits the material, --resample, --lowpass and --lowpass-width set it by hand.

Streaming

With - on both sides LAME reads from standard input and writes to standard output, so it can be put in a pipeline:

cat inputfile | lame -b 128 - - > output.mp3

Raw PCM has no header to describe it, so its format has to be given on the command line - here mono at 22.05 kHz, encoded at 24 kbps:

cat inputfile | lame -r -s 22.05 -m m -b 24 - - > output.mp3

Scripts

The misc directory of the source distribution holds scripts for running LAME over many files at once.

Script What it is
mlame bash; encodes a directory tree. mlame -? explains its options.
auenc sh; run it with no arguments for instructions.
mugeco.sh sh; encodes with the tags taken from the file names.
mk_mp3.sh sh; encodes the WAV files in a directory.
lameid3.pl perl; re-encodes MP3 files and carries their ID3 tags across.
lame4dos.bat Windows batch file.
Lame.vbs Windows Script Host; lameGUI.html is a front end for it.
  1. Codec sample frequencies (kHz) bitrates (kbps)
    MPEG-1 layer III 32, 44.1, 48 32 40 48 56 64 80 96 112 128 160 192 224 256 320
    MPEG-2 layer III 16, 22.05, 24 8 16 24 32 40 48 56 64 80 96 112 128 144 160
    MPEG-2.5 layer III 8, 11.025, 12 8 16 24 32 40 48 56 64
  2. Lossy codecs, like MP3, should not be used for archiving, since the nature of lossy encoding always changes the original sound, even if it sounds transparent. Use lossless codecs for this purpose.