Linux: M4A to MP3 converter shell script

Posted By Scott Klarr on Dec 25, 2007 at 11:39 pm

UPDATE!

I have written a much better shell program than the one posted below.
SKwizard - M4A to MP3 Converter & File Renaming Tool

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:

#!/bin/bash for i in *.m4a; do echo "Converting: ${i%.m4a}.mp3" faad -o - "$i" | lame - "${i%.m4a}.mp3" done

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

su 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.

Hint

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!

This post has the following tags:

Related Links

Last 5 Linkbacks

Comments (4)

va1e - Apr 28, 2008

~$ mplayer -ao pcm file.m4a -ao pcm:file="file.wav"
it works better for me

va1e - Apr 28, 2008

Unable to find correct AAC sound track in the MP4 file. :(

martin - Feb 16, 2008

nice script.
you saved my day and the my songbird player

pragmattica - Jan 16, 2008

This is definitely a handy script. The only problem with it is that it loses the artist and album tags. I wrote a script that performs the conversion and keeps some of the tag information from the M4A, in case you're interested:
http://pragmattica.wordpress.com/2008/01/17/convert-itunes-m4a-files-to-mp3-on-linux/

Post Comment

Your Name
Email Address
Website URL
Comment

Your email address will not be visible to the public

page counter

Loading Ad