HPIM0228.jpg
Woof and Azuzu asleep
HPIM0103.jpg
Luke and Sylvia asleep still
00134.jpg
Queenstown lake
holidays 122.jpg
Trees

 

July 2007
M T W T F S S
« Jun   Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

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

root@cloberrella:~/m4a/blur/13_3$ ./convert.sh -h

This software is licensed under the GNU General Public License
For the full text of the GNU GPL, see:
http://www.gnu.org/copyleft/gpl.html
No guarantees of any kind are associated with use of this software.
requirements: faad, lame

Usage: ./convert.sh [-h] [-r] [-d path]
Options:
-h displays this help
-r recursively scans directories
-d specifies a path other the current path

m4a to mp3 conversion script

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

root@cloberrella:~/Desktop$ chmod +x convertsh..sh

Basic usage is:

root@cloberrella:~/Desktop$ ./convertsh..sh -d <directoryname>
root@cloberrella:~/Desktop$ ./convertsh..sh -h

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.

nobody@cloberrella:~/ tail -f mp4tomp3conversion.txt

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):

andrewb@cloberrella:~$ find <m4a directoryname> -iname '*.m4a' | wc -l
97

Popularity: 92% [?]

Everybody's a critic WTF?? Nothing about this made senseas useful as a blindfolded monkey throwing dartsmediocre ... at bestsolved my problem but needed modificationspectacular.  \'Nuff said (2 votes, average: 5.00 out of 5)
Loading ... Loading ...

8 comments to Linux m4a to mp3 conversion script

  • Simon

    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.
  • 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.
  • JasonR

    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.
  • 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.
  • Johnny

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

    Johnny did not rate this post.
  • Awesome script !! Just converted all my m4a files with it.

    nicolas did not rate this post.
  • Richard

    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 ratings for this post: Richard gives a rating of 5Richard gives a rating of 5Richard gives a rating of 5Richard gives a rating of 5Richard gives a rating of 5
  • Mike Farrell

    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.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>