Thursday, October 06, 2005

Audio Conversion With PAC

Our DVD player doesn't like OGG Vorbis files. I knew this when I started archiving our CD collection. Yeah, I could have ripped the tracks to MP3 & OGG in the same go but I'm either lazy or impatient. K wants to play the files on the surround sound set up so it's either convert the OGG files to MP3 or go through all the CDs again.

Batch converting OGG files to MP3 is quite easy in Linux as a quick google will show you. My concern was, I wanted to preserve the file tags (you know--Title, Artist, etc) . The quick and easy conversion methods I found didn't give me this option. A more intensive search led me to a Perl application called PAC, the Perl Audio Converter. This thing appears to do it all but it was a real trick getting it compiled & running on my Mandriva partition (it wants KDE and I didn't want to take a chance with my SuSE partition so Mandriva got to be the guinea pig). I had to install some extra Perl stuff with rpmdrake (the Madriva package manager). I also needed to grab some stuff from CPAN (the Comprehensive Perl Archive Network). I had to download & compile the LAME sourcecode (for MP3 encoding. Mandriva doesn't have it in their distro). Finally, I had to make some minor edits to the pac.conf file before all was said & done but it was worth all the effort in the end...

I dropped into a shell and issued the following command (all one line):

pac -o2m --tag key="artist title genre album year track" --recursive=/mnt/win_3/music -o ./

The thing ran all night and into the next morning. PAC leaves the original files, and the new MP3s were sitting on the Mandriva partition--with ID3 tags intact. The only tag it didn't save was Date. I hoped the 'year' option would cover it but it did not. I burned the MP3 files to DVD-R and tested them out on our DVD/surround sound, and there you have it...

I have seen a lot of remarks about how awful it is to convert from one 'lossy' audio file format to another and I agree, going back to the original CD audio would have been best, but you know what? The MP3 files sounded fine for their intended use. (FWIW, the original OGG files are quality 5 (~160kbps). The MP3 files are j-stereo at 128kbps.)

PAC can handle various audio format conversions1 among other things. It wasn't the easiest thing in the world to get compiled & running, but again it was definitely worth the effort. It would be really nice to see this application rolled into RPMs and DEB packages...

1The Sourceforge PAC page tells us that "[PAC is a] Tool for converting multiple audio types from one format to another. It supports MP3, Ogg Vorbis, FLAC, Shorten, Monkey Audio, FAAC AAC/MP4, Musepack, Wavpack, RealAudio, WAV, and WMA."

No comments: