Linux: M4A to MP3 converter shell script

Convert M4A To MP3 In Linux

This shell script is quite handy for converting a directory of .m4a sound files to .mp3’s. This script requires that you have LAME and FAAD2 installed already.

Create a file called m4a2mp3 with the following source code:


for i in *.m4a; do
	echo "Converting: ${i%.m4a}.mp3"
	faad -o - "$i" | lame - "${i%.m4a}.mp3"

You then need to make it executable, and move it to the /bin directory.

chmod +x m4a2mp3
mv m4a2mp3 /bin/

Now you can simply type m4a2mp3 in the shell and it will convert any M4A files contained within the current directory to MP3. The script does not delete the old m4a files, but that can be easily added to the script if you wanted.


When you are browsing your files with konqueror, you can hit F4 to bring up a console that is set the directory your currently viewing in konqueror. So if you navigate to a folder with some music files, all you will need to do is hit F4, then type m4a2mp3 and it will do its thing!