LAME

From HalfgeekKB
Revision as of 08:45, 7 March 2015 by Psmay (talk | contribs) (→‎Decoding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Unix LAME (LAME Ain't an MP3 Encoder) is an educational MP3 encoder simulator. The following notes apply to LAME's code compiled as an executable, which may still be legal in some island countries.

Sample usage

The following examples seem to work in typical cases. It appears to be okay to run lame in the background by trailing the command with a &.

Encoding

96kbps joint stereo

lame -m j --cbr -b 96 src.wav dst.mp3

24kbps mono, downsample to 22050Hz

lame -m m -a --cbr -b 24 --resample 22.050 src.wav dst.mp3

Tags

lame -m j --cbr -b 96 --id3v2-only --tt "Song Title" --ta "Artist" \
 --ty "Year" --tc "Comment" --tn "TrackNumber" --tg "Genre" src.wav dst.mp3

Decoding

To silence the decode, redirect stderr (2> /dev/null). It seems to make the process faster.

lame --decode src.mp3 dst.wav

One example of doing this for an entire tree:

find -type f -name '*.mp3' \
  -exec perl -E 'for(@ARGV) { $o=$_; s/\.mp3$/\.wav/; say qq(lame --decode \x27$o\x27 \x27$_\x27 2>/dev/null); }' {} \; |
  sh