I 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:
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
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% [?]


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.
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!
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.
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)
Just used for about 500 m4a’s and worked perfect.
Awesome script !! Just converted all my m4a files with it.
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!
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