Important!
This article is one of the most-viewed on The Z-Issue, and is sometimes read thousands of times per day. If it has helped you, please consider a small donation to The Parker Fund by using the top widget at the right. Thanks!So, I’m in the process of ripping all my music to FLAC since I am getting a completely new audio system in my home. With the high-end pre-amp, amplifiers, DACs, and floorstanding speakers in place, my full music collection (currently ripped in OGG) will no longer be of sufficient quality. Re-ripping a really large collection is a cumbersome task, so I wanted to make sure that I chose wisely with regard to the FLAC options that are available (particular concerning compression).
A little background is that FLAC is the Free Lossless Audio Codec, which means that there is no loss of quality at all. So, regardless of the compression level that is chosen, FLAC will always decode into the exact uncompressed audio track (bit for bit). The difference between the compression levels, then, is the resulting file size. Along with that benefit (higher compression results in a smaller file size), though, comes the downside of longer times to encode. According to Wikipedia (which cites comparisons that don’t seem to directly mention decoding times), there shouldn’t be any noticeable effect on the decoding of the FLAC files based on the compression level used during encoding. The default FLAC compression level tends to be 5 for most applications.
All of that being said, I decided to do a small test (n=2) with two songs. I firstly ripped the two songs into uncompressed WAV files, and then encoded them into FLAC from the command line using the following code:
time flac $SONG.wav --compression-level-X -o flacX.flac
That showed me the time to encode, and I substituted the compression level number (between 0 [lowest compression] and 8 [highest compression]) for ‘X’. Before looking at the results, here’s some information about the system used and the information contained in the results tables:
System specs:
Intel Core i7-960 (Bloomfield) @ 3.20 GHZ (quad-core with Hyperthreading)
24 GiB RAM (DDR3-1600)
Gentoo Linux with kernel 3.12.11
FLAC 1.3.0
Table data:
- Quality: The FLAC compression level used
- Encode (sec): The time it took to encode the song
- Size (MiB): The resulting FLAC file size (rounded to tenths of a Mebibyte)
- Ratio (%): FLAC file size as a percentage of the original uncompressed WAV
- Enc + (sec): The additional time required to encode as compared to FLAC 0 (in seconds)
- Enc + (%): The additional time required to encode as compared to FLAC 0 (as a percentage of increase)
Below you will find information about the two songs used as tests, and the results (in sortable tables):
Song 1:
Artist: Dream Theater
Album: A Change of Seasons EP
Song: A Change of Seasons
Length: 23’08” (1388 seconds)
Uncompressed WAV: 128 seconds to rip – 233.6 MiB resulting file size
Quality | Encode (sec) | Size (MiB) | Ratio (%) | Enc + (sec) | Enc + (%) |
---|---|---|---|---|---|
FLAC 0 | 3.531 | 174.6 | 74.7% | 0.000 | 0.00% |
FLAC 1 | 3.721 | 173.5 | 74.3% | 0.190 | 5.38% |
FLAC 2 | 4.658 | 173.2 | 74.1% | 1.127 | 31.92% |
FLAC 3 | 5.255 | 165.0 | 70.6% | 1.724 | 48.82% |
FLAC 4 | 6.584 | 163.8 | 70.1% | 3.053 | 86.46% |
FLAC 5 | 9.112 | 163.4 | 69.9% | 5.581 | 158.06% |
FLAC 6 | 9.130 | 163.4 | 69.9% | 5.599 | 158.57% |
FLAC 7 | 19.475 | 163.3 | 69.9% | 15.944 | 451.54% |
FLAC 8 | 28.846 | 163.1 | 69.8% | 25.315 | 660.30% |
Song 2:
Artist: Libera
Album: New Dawn
Song: Air (Air on the G string by Bach)
Length: 3’43” (223 seconds)
Uncompressed WAV: 23 seconds to rip – 37.6 MiB resulting file size
Quality | Encode (sec) | Size (MiB) | Ratio (%) | Enc + (sec) | Enc + (%) |
---|---|---|---|---|---|
FLAC 0 | 0.516 | 20.2 | 53.8% | 0.000 | 0.00% |
FLAC 1 | 0.541 | 19.6 | 52.2% | 0.025 | 4.84% |
FLAC 2 | 0.699 | 19.6 | 52.2% | 0.183 | 35.47% |
FLAC 3 | 0.806 | 19.1 | 50.8% | 0.290 | 56.20% |
FLAC 4 | 1.022 | 18.6 | 49.3% | 0.506 | 98.06% |
FLAC 5 | 1.431 | 18.5 | 49.3% | 0.915 | 177.33% |
FLAC 6 | 1.429 | 18.5 | 49.3% | 0.913 | 176.94% |
FLAC 7 | 3.049 | 18.5 | 49.1% | 2.533 | 490.89% |
FLAC 8 | 4.524 | 18.4 | 49.0% | 4.008 | 776.74% |
From both tests, it seems like FLAC compression level 3 is the right trade-off between file size and additional encoding time. Now, are either that big of a deal by today’s standards (in both available storage capacity and processing power)? Probably not. I could rip everything in FLAC 0 and call it a day, since the difference between FLAC 0 and FLAC 3 seems to be about 0.5 MiB for every minute of music. However, my current collection is approximately 391 hours (or 23460 minutes). That means that I will save somewhere in the neighbourhood of 12 GiB for my entire collection. Is that space savings worth the roughly 50% more time to encode? Maybe or maybe not.
At this point, my entire collection of ~391 hours of music will consume around 177 GiB if ripped at FLAC 0, and around 165 GiB if ripped at FLAC 3. On a 2 TiB HDD, that doesn’t seem like a big deal, really.
So, ultimately, I will either rip at FLAC 0 and not worry about the additional space, or FLAC 3 if I think it will help. At the rate that storage prices are dropping, FLAC 0 would seem like the obvious answer, but for so very little of an increase in encoding time, FLAC 3 makes more sense.
What are your thoughts?
Cheers,
Zach