Mass-Convert Your Music
While flash storage is reasonably affordable these days, your average portable audio player probably won’t be able to hold your entire music collection. That’s why it couldn’t hurt to convert—or, if you like it fancy, “transcode”—all your songs to a more economical format, allowing you to carry around as many of your favorite songs as possible.
Let’s say you wanted to convert audio files in any input format—MP3, FLAC, WAV, or whatever—to a single, uniform output format—Ogg Vorbis, for instance. Sure, you could go hunting for a shareware tool with a half-assed GUI, but why should you? Free and Open Source utilities exist for just about any format, so it’s a matter of chaining them together.
Luckily, you don’t need to do the chaining, since I wrote replicator.pl to do just that. The script will clone an entire directory tree, converting any audio file it encounters, and updating M3U playlists to match. Windows users will want to look into ActivePerl; most other OSes come with Perl. You may also need the following Open Source utilities:
- MediaInfo to obtain metadata (e.g. ID3 tags),
- LAME for MP3 encoding and decoding,
- OggEnc and/or OggDec for Vorbis encoding and decoding, and
- FLAC for FLAC encoding and decoding.
Obviously, you can ignore the formats that you won’t be using. However, MediaInfo is required no matter what. Moreover, you can easily add support for more formats, as long as you know the right command to decode to standard output and/or encode standard input.
How do you use the script? Easy as pie. Just type
perl replicator.pl input_dir output_dir output_format
For example, on Windows, if you wanted to convert everything under C:\Music into Ogg Vorbis and store the result in C:\Ogg, you’d type
perl replicator.pl "C:/Music" "C:/Ogg" ogg
Mind the forward slashes—even though they’re not strictly necessary. Also, the quotation marks are optional in this case, but you’ll probably be using paths with spaces in them, so just keep them around. Enjoy!
Update: Those of you who downloaded the script before September 5 may want to do so again. Tagging now behaves as it should, and I fixed some other miscellaneous bugs while I was at it.
