How to convert wma's into mp3's on a Mac in command line

Overview

It took me a while to figure out how to automatically convert wma files into mp3's on Mac OS, so I thought it might be useful to write down all the steps somewhere. Here's a list of ingredients that you'll need:
  1. mplayer – a command line audio (and video) player
  2. lame – a command line audio encoder for Mp3's
  3. root privileges in order to install the above programs
  4. make-mp3 – a handy script which puts together the two above programs. It can be used to recursively traverse directories and replace wma's by mp3's.
Below I describe how to get the above three ingredients.

Installing mplayer

This is more complicated than it might seem. Warning! MPlayerOSX is a different thing, it doesn't work in the command line.
To install mplayer:
  1. Register as an Apple developer here.
  2. Download and install Xcode Developer Tools from the Mac Dev Center. Be careful to download the version matching your operating system version.
  3. Download and install MacPorts from a disk image.
  4. Install mplayer: in the command line type sudo port install mplayer

Installing lame

This is much simpler than the previous step. Download and install lame from here.

Download the make-mp3 script

On this forum I found a script written by Bernhard Hartleb. I modified it slightly because the original version didn't work well on Mac OS. Download the modified script from here. In the command line, go to the folder containing the script and change its mode to excecutable, by typing chmod a+x make-mp3. Type ./make-mp3 -h to see the options of the script. To recursively replace all wma's into mp3's in some directory dir and remove the originals, type
./make-mp3 -r -d -D dir
		
Szymon Toruńczyk
Created: Thu May 20 9:53:30 MEST 2010