search
top

Linux m4a to mp3 conversion script

tux thumbnailI have a bunch of m4a files that I would like my mp3 player to be able to play (http://www.rockbox.org - check it out if you haven't already), the files are in a nice directory structure and the names of the files are fine. I started writing a script about 4 months ago, but I put it aside when I realised how much other work I had to do. The other day I found a script that Steel_J on http://www.linuxquestions.org/questions/newreply.php?do=newreply&noquote=1&p=2637196
wrote which did the uses faad and lame to bulk convert a bunch of m4a files into mp3 files and nicely brings across the ID3 tags from the m4a file into the mp3 file. However, I found that the program had a few small bugs and wouldn't recursively walk my directory structure to encode all of my files without me needing to do anything so I modified and I've reposted it here. This script worked fine on my music but individual mileage may vary.

DISCLAIMER: I will not be held responsible if this program drinks all of your beer, shoots your brother with a pellet gun, cracks on to your grandmother or even destroys your entire music collection. This does not work with any DRM encrypted files.

Bigger warning:

Because I don't want this happening to anyone else (Simon wrote me a note), you really need faad and lame in order to run this, I will edit this script shortly to abort if it doesn't find these, then this message will be removed. Alternatively, you can edit the script and put a # in front of any command which says rm then use find later to remove all of the old files

m4a to mp3 conversion script

Once you have downloaded it, open a console and type:

Basic usage is:

This version also does some basic logging to a file in the directory from whence you ran it called "mp4tomp3conversion.txt". If you want to see it in action, do a tail -f on the log file.

In addition, you can check out how many more files are still needing to be converted by doing a (keeping in mind that this will give you recursive stats):

11 Responses to “Linux m4a to mp3 conversion script”

  1. Simon says:

    You might like to add to your disclaimer that running your script without the specified requirements (faad, lame) will result in all your m4a files being deleted. I guess losing 462 m4a’s will teach me to test scripts first.

    Simon did not rate this post.
  2. andrewb says:

    I’m really sorry that happened, if you want to safely test this program you should edit the script and put a # sign in front of any command that starts with rm.

    Alternatively, test with a small test directory!

    andrewb did not rate this post.
  3. JasonR says:

    I just used this script to convert over 2,300 m4a’s and it worked flawlessly. It took a little under 24 hours, but now I just have to wait for Amarok to play catch up. Thanks to you, I don’t have to worry about how I’ll listen to my music on my non-Ipod mp3 player. Thanks for the great script.

    JasonR did not rate this post.
  4. andrewb says:

    Thanks for the post, I would just like to say that this script is just a prettier version of Steel_J’s script (which can be found: http://www.linuxquestions.org/questions/newreply.php?do=newreply&noquote=1&p=2637196)

    andrewb did not rate this post.
  5. Johnny says:

    Just used for about 500 m4a’s and worked perfect.

    Johnny did not rate this post.
  6. nicolas says:

    Awesome script !! Just converted all my m4a files with it.

    nicolas did not rate this post.
  7. Richard says:

    This really works great.

    I think this little script really shows the power of both the Linux philosophy and the “small is better” approach. Excellent work to all involved!

    Richard did not rate this post.
  8. Mike Farrell says:

    I’m a script programmer and programmer in general and while this little script was quite useful (especially for the id3 tag stuff), I’m shocked that they’d blindly “rm” files without prompting the user. Definitely a descructive tool. I’d comment out the rm stuff by default, and re-upload. Safer alternative “mkdir ~/bkp && mv $orig ~/bkp” in its place

    Mike Farrell did not rate this post.
  9. Louie says:

    Fantastic. Thank You.

    Louie did not rate this post.
  10. Bry says:

    I know this is kind of dated, but it still works amazingly! I’ve been trying to migrate from Windows & iTunes to Linux and Banshee, and I searched far and wide to find a good script that could preserve tags and search recursively. After getting a few failed attempts with a Python script and a simple Perl script, I found this, and it worked splendidly!

    But I do agree with the other comments, it would be nice if you could have it defaultly leave the m4a, and then maybe have a trigger (-o for overwrite?) that would remove the m4a if you so please. I had no need for my m4as after converting them, but it did kind of make me uneasy.

    In any case, thanks a ton, Andrew of 2007! Bry of 2011 thanks you!

    Bry did not rate this post.
  11. Peter says:

    iTunes have a bit more options for tags than shown in this scripts.

    I have made a similar script, with genre checking, albumartist, and playlist generation.

    http://code.ecomerc.com/Articles/iTunesConvert/

    Peter

    Peter did not rate this post.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

top