Thursday, December 24, 2009

Batch Encoding Mp3's with LAME

LAME is a great little command-line mp3 encoder. I found this script online somewhere (sorry, no idea where), and tweaked it a bit, so that it creates an mp3s folder, ecodes at highest quality, strips extensions from filenames, and works with aifs and wavs (have only tested it with aifs so far though.)

You can save this as encoder.sh, or whatever, cd into the directory you want to encode, and run it.

Here it is:


mkdir mp3
find . -name "*.wav" -o -name "*.aif" | while read FILE
do
echo $FILE
lame -b 320 -h $f "$FILE" mp3/"${FILE%.*}".mp3
done