Converting WMA files to MP3

I recently needed to convert a bunch of WMA files to MP3 on my macbook. The easiest way to do it was to open up a terminal window, change directory to the directory with the files, and then use mplayer to convert each file to a WAV, and then sox to convert the file to an MP3. The command line I used is described below:

for i in *.wma ; do 
  MN=`basename "$i" .wma`.mp3
  mplayer -vo null -vc null -af resample=44100 -ao pcm:waveheader "$i"
  sox audiodump.wav "${MN}"
  rm audiodump.wav
done

I probably can just output straight to MP3 from mplayer, but I couldn’t be bothered reading through the mplayer man page to work out how to do it!

Leave a Reply

Your email address will not be published. Required fields are marked *