Sunday, September 17, 2006

How To Convert FLAC to MP3

I've noticed that the web is lacking a good tutorial to fully explain how to convert music files from FLAC to MP3, so I've decided to change that. This tutorial focuses on Windows and uses only free software. You could call this a free FLAC to MP3 converter.

Most of the better quality music on the web is in the FLAC format. FLAC stands for Free Lossless Audio CODEC (coder-decoder), and is one encoding format among many (MP3, SHN, AAC, OGG, WMA, etc). The benefit of FLAC is that it is both lossless and compressed. Compressed means that the resulting file is smaller than the original (think Zip), while lossless means that none of the information in the original file has been lost. Other encoding methods such as MP3 compress much more, but by discarding information (lossy compression). True audiophiles hate lossy compression, and since the audiophiles are the ones with microphones at concerts the way they distribute live shows is generally FLAC. If you aren't an audiophile and just want to listen to the music without using your entire hard drive it makes sense to convert your FLAC tracks to MP3. You can always redownload the lossless versions should you need them.

Converting FLAC to MP3 is quite easy, but some setup is required the first time. First of all, grab the FLAC Frontend. Then make sure you have an MP3 codec such as LAME installed. This is necessary to produce the MP3 files. Next, Robin Bowes has created a Perl script called flac2mp3.pl, which automates the entire conversion process. If you are new to Perl you can download it from ActiveState. Make sure you select the 'Add Perl to the system path' option during the Perl install.

To prepare for the conversion process you should make sure that the LAME installation is in your system path. The easiest way to do that is to right click on My Computer, choose the Advanced tab, click on Environment Variables, scroll through the bottom panel until you see PATH. Double click on PATH and then add the directory where LAME is installed to the end of the list. While you are in there make sure that the Perl\bin directory is also included. It might look something like this when you are finished:

C:\utils-programs\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Adobe\AGL;C:\VXIPNP\WinNT\Bin;C:\utils\lame mp3 encoder

After updating the PATH click OK in all of the open windows. Then open a command window (DOS prompt) by clicking Start, Run and then typing cmd and pressing enter. You can then change directory to where you saved the flac2mp3 script (e.g. 'cd c:\scripts').

The final step is to run the script. To do this you need to know where the FLAC files that you wish to convert are located. The syntax for calling the script is:

perl flac2mp3.pl path\to\lossless path\to\lossy

For example, if my FLAC files are in c:\flac and I want the MP3s written to c:\mp3 the command would be:

perl flac2mp3.pl c:\flac c:\mp3

If your directory names have spaces then you should wrap them in double quotes:
perl flac2mp3.pl "c:\flacs are here" "c:\mp3s go here"

The script will go through each file in the directory and convert them to MP3. It appears that the default sample rate for the MP3s is 224 kbps, which is high enough quality that I can't tell the difference from a CD or the FLAC. The resulting MP3 files are about 1/5th the size of the FLACs.

As I mentioned before, most online 'tape trading' is now done using FLAC files. Here is a link to etree.org, one of the biggest databases on the web for free live music. I'd also suggest checking out these shows for some good material to test your free FLAC to MP3 conversion setup:

Gov't Mule 2006-09-02 Morrison, CO - Red Rocks Amphitheater
Gregg Allman and Warren Haynes Acoustic Set 2006-09-02 Red Rocks

Please leave a comment if you have any trouble with this process.

Enjoy!

0 Comments:

Post a Comment

<< Home