Archive for March, 2007

music management

Tuesday, March 6th, 2007

After making the switch to linux full-time, I needed an easy way to convert my old music collection to mp3s. Yes, yes… there are the DRM’d files from my purchases on iTunes, and I won’t go into converting them. Otherwise, I had some files in mp3, and quite a large amount in m4a. It’s fairly easy to do the conversion in linux, but it can get tedious if your library is huge. Here’s a little shell script I wrote to parse a given directory and convert mp4s easily. I hope it’ll be useful to someone!

You’ll need faad and lame installed, natch.


#!/bin/bash

find /media/music -name '*.m4a' -print0 | xargs -0 -I {} bash -c 'FILE=`(echo "{}" | sed -e "s/.m4a//g")`; faad "$FILE.m4a"; lame -h -b 192 "$FILE.wav" "$FILE.mp3"; rm -f "$FILE.wav"'

exit 0