I have been buying some music on itunes, it comes in AAC (.m4a) format, which is great to use in itunes (I have it on a Windows 7 running over VirtualBox), or to use it in my iPod Touch or iPod shuffle, but if I want to use it in my cell phone (an old one which does not support AAC format) I have to convert it to mp3, I have to also convert it if I plan to use mpg123 which I use a lot.

Well lets go to learn how to convert from AAC to MP3 I will use Arch Linux for this, but you can use any distros, just be sure to install faad and lame.

On an Arch Linux box run:

sudo pacman -Sy faad2 lame

Once installed, run this commands to start converting.

faad file.m4a

This will convert it to wav, and then run:

lame file.wav file.mp3

That is it, you now have an mp3 version of your original aac file.

You may want to make this automatic, for that you can use a small script, this is just an example, you can create a better and more elaborated one.

#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for i in *.m4a; do echo "Converting: ${i%.m4a}.mp3" faad -o - "$i" | lame - "${i%.m4a}.mp3" done
IFS=$SAVEIFS

If you have any suggestions to improve this, use the comments please.