Linux: M4A to MP3 converter shell script

Dec 25, 2007 at 11:39 pm - 7 Comments

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 topic has the following tags:

  • Digg
  • Reddit
  • Sphinn
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Technorati
  • Facebook
  • Mixx
  • Google
  • Live
  • TwitThis
  • YahooMyWeb
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • Blogosphere News
  • Blue Dot
  • Bumpzee
  • Fark
  • Furl
  • IndianPad
  • LinkedIn
  • Ma.gnolia
  • MisterWong
  • Netvouz
  • Propeller
  • description
  • Socialogs
  • SphereIt
  • Blogsvine
  • connotea
  • eKudos
  • IndiaGram
  • LinkaGoGo
  • LinkArena
  • Linkter
  • Meneame
  • NewsVine
  • PlugIM
  • ThisNext

Last 5 Linkbacks

Comments (7)

pragmattica's Avatar

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/

martin's Avatar

martin Feb 16, 2008

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

va1e's Avatar

va1e Apr 28, 2008

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

va1e's Avatar

va1e Apr 28, 2008

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

Jameson Williams's Avatar

Jameson Williams Apr 05, 2009

A useful and concise method, thanks.

Pykler's Avatar

Pykler Apr 11, 2009

You my friend are awesome.

Nathan's Avatar

Nathan Apr 12, 2009

I get a 'Warning: unsupported audio format' when I try to run your script... I installed LAME and FAAD2. Is there something else I should install?

Post Comment

You are replying to cancel reply

Your email address will not be visible to the public

Avatars by Gravatar. Join Gravatar for free to have your avatar shown everywhere you post.

page counter

Loading Ad