Converting WAV to MP3 using LAME and Automator

automatorencodingfile conversionmp3

I'd like to convert many WAV files to MP3 files using LAME and Automator. I need a script that I could right click a folder and convert all the WAV files inside the folder to MP3 files. I've been able to find a script to convert single file but I don't know how to modify it so I could convert many files with a single click.

I've been using script which I found here for single files. Here is a similar question but instead of using "Run Applescript" it uses "Run Shell Script". I've tried to replace LAME parameters between "do" and "done" but haven't succeeded to convert anything.

So, how could I convert folder full of WAV files to MP3 files? For me it doesn't matter is it done by using Applescript or Shell Script in Automator if both ways are possible.

Best Answer

Automator 'hangs' when attempting to use LAME encoder unfortunately. It's also not efficient or advisable to try and use a multi-threaded process as an Automator Service. For tasks such as this it's best to either run a simple script or use an alternate method.

The script below will encode a 20Mb .wav to .mp3 in 3 seconds! (at the highest quality settings)

file="$1"

find . -name '*.wav' -maxdepth 1 -exec /usr/local/bin/lame -V 0 -q 0 '{}' \;

for file in *.mp3
do
  mv "$file" "${file/wav./}"
done

To install, download, then open terminal:

sudo install encode-mp3 /usr/local/bin

To use, navigate into a desired conversion folder and type:

encode-mp3

This will encode your .wav files to .mp3

Convert .wav to .mp3 | LAME Encoder Shell Script [md5: 72d4e24f14ea9139136900f2c4281a7f]


[original]

I just wrote a one-liner that will do this for you in Terminal, just cd to the directory of files you want to convert and enter:

find ./ -name "*.wav" -execdir lame -V 3 -q 0 {} \;