ape2m4a
So ever since my birthday I’ve been trying to figure out how best to use my iPod with my current setup. Right now I use winamp2, rip everything with EAC, compress using Monkey’s Audio. My music is organized through the filesystem with a directory for each artist, and a directory for each album inside that. Each album directory has the APE files, a log file, and a m3u. I use the fantastic Album List plugin to make life good. It’s perfect as far as I’m concerned.
My problems getting my music onto the iPod are as follows:
* iTunes and iPod do not support APE.
* I really wouldn’t want APE on there anyway, it takes up too much space and for on-the-go listening a modern lossy codec at a reasonably high bitrate is acceptable to me.
* The only modern lossy codec supported by the iPod is AAC (and not even full AAC, just the low complexity version with a “m4a” extension).
* There’s no good way to transcode APE into AAC with tags intact. (Lots of programs will try, using faac as an external compressor, but I couldn’t set any of them up to set proper tags in the AAC files—the only one that actually does that, J. River Media Center, fails on about 40% of the APEs for no good reason.)
So, I found some command-line tools online and wrote a shell script in PHP to automate the process. It non-destructively takes the APEs from a given folder, and transcodes them to m4a with tags intact.
These are the tools it uses:
* Tag
* faac
* mac.exe from the Monkey’s Audio distribution
The syntax is:
php ape2m4a.php -i _input-path_ [-o _output-path_] [-q _quality-value_] [--compilation]
Example:
php ape2m4a.php -i "c:\input\directory" -o "c:\output\directory" -q 150
If you don’t specify an output dir, it will take the input dir and replace all instances of “/ape/” with “/iPod/”. If you don’t specify a qval, it defaults to 225 (in AAC this is VBR around 180kbps). —compilation just sets the VA bit on each m4a file.
This probably isn’t useful to anyone else without modifications, since I designed it with my setup in mind (Windows, APEs in /ape/ and m4a in /iPod/, etc.) but it shouldn’t be too hard to change things. Also, it doesn’t support non-ASCII characters too well, which I think is a limitation of Tag. Of course, PHP’s support for unicode is spotty at best. It also doesn’t recursively traverse the input directory, which would be swell.
So, it’s not pretty, but it’s better than re-ripping everything in iTunes or transcoding and retagging by hand. Now all I have to do is use the script, then import the new files into iTunes and sync.
The source code is here: ape2m4a.php #
September 21st, 2004 at 6:23 pm
Thanks. As soon as I get an Ipod, I’ll know exactly what to do.