As storage space becomes cheaper, there’s a growing trend to save digital music files in a lossless format. Such lossless formats provide an exact replication of the audio quality found in the original content, usually on CD. The resulting files are also much larger, when compared to MP3 or AAC at 128kbps or 256kpbs. A favourite open source lossless audio codec is FLAC, which stands for Free Lossless Audio Codec. Within the possible FLAC settings there are 8 levels of compression to choose from when creating new files.
Lossless codec? Compression? Doesn’t compression result in loss of detail? Not always. There are many lossy codecs, both audio and video, that apply various compression techniques that actually discard some of the original material, to obtain smaller file sizes. The better the codec is at discarding items that don’t impare the listening or viewing experience, the more impressive the end result will be.
FLAC, being lossless, doesn’t discard any of the original content, but still applies compression techniques. View this like compressing a file with Gzip or Bzip perhaps. Smaller files are achieved, but when de-compressed nothing has been lost in the process. Perhaps think of it like folding a piece of paper. Fold it in half once, and the end result is smaller. Keep folding to produce smaller and smaller (or more highly compressed) paper packages. Unfold the paper, and you still have the same original piece of paper. Ignore fold lines and degradation over time! This doesn’t happen in the world of bits and bytes.
We decided to test which of the FLAC compression settings provided the best trade-off between final file size and encoding time. Higher compression will require more time, but should produce smaller file sizes.
Trying to mimic how we would actually go about ripping a whole CD, we decided to use the Ripit utility, and follow instructions posted on the Debian forum. Ripit is a great example of a truly useful utility where a fancy GUI is just not needed. Edit one simple configuration file, then type “ripit” at the command prompt and that’s almost all there is to it. There would be some overhead in using Ripit, as it checks the freedb.org database for each album’s details, but this should be minimal.
Grabbing the nearest un-ripped CD from the shelf, our test file will be U2’s Pride (In the Name of Love) from their Best of 1980-1990 album. This song is 3 minutes and 50 seconds long.
Our exact Ripit command was:
>time ripit 01
“Time” provides feedback on the elapsed time of the process. “01” tells Ripit to just rip the first track on the CD.
The test machine is a reasonably old Dell Inspiron 6400, which contains a Intel Core2 CPU T5500 @ 1.66GHz and 1GB of RAM.
Here are our results from the 8 different levels of compression
available in FLAC. If no compression level is specified, 5 will always
be the default.
Comression Quality: 0
Size: 30261367 bytes (28.86MB)
Compression Quality: 1
Size: 29643288 bytes (28.27MB)
Compression Quality: 2
Size: 29631732 bytes (28.26MB)
compression Quality: 3
Size: 28596473 bytes (27.27MB)
Compression Quality: 4
Size: 27717767 bytes (26.43MB)
Compression Quality: 5
Size: 27710285 bytes (26.43MB)
Comression Quality: 6
Size: 27710119 bytes (26.43MB)
Compression Quality: 7
Size: 27696835 bytes (26.41MB)
Compression Quality: 8
Size: 27664197 bytes (26.38MB)
Between Compression Quality 0 and Compression Quality 8, there’s approximately 13.5 second and 2.5MB difference. This might not seem like very much, but let’s expand these figures to account for an entire CD.
Assuming all tracks are approximately the same length (3:50) and that there are 12 tracks on the average CD, we have the following figures:
13.5 seconds x 12 = 162 seconds (2 minutes 42 seconds)
2.5MB x 12 = 30MB.
Realistically though, you can see there’s a big jump in time between Compression Quality 6 and Compression Quality 7, while there’s not a lot of difference in time between Compression Quality 5 and Compression Quality 0 (Ignoring Compression Quality 3’s time anomaly which we can’t account for). There’s also not a lot of file size difference between Compression Quality 5 and Compression Quality 8.
Therefore, unless storage space is a really big issue, the average user is probably better off leaving the Compression Quality settings at Default (5) and saving almost 3 minutes for CD rip. Then again, on a newer machine, this time difference is likely to be much less, so you may as well use Compression Quality 8 and save that little bit of space.
In the end, Compression Quality settings in FLAC don’t make that much difference. Leaving the settings at Default is a pretty good choice, but setting them to a maximum of 8 will save some space, without a major time impact.