FLAC, the Free Lossless Audio Codec, is a patent-free sound compression format developed by Josh Coalson, and now an official Xiph.org project. FLAC is an implementation of a lossless compression algorithm which compresses CD quality music to as small as one third the original size, though two thirds the original size is more common. The current reference implementation is available under a BSD license (specifically to allow commercial players based on the reference code), with the current players being licensed under the GNU GPL. Currently support for FLAC is best in home stereo or car-based systems; as a guess this is because the relatively large size of FLAC files make them unattractive for lower capacity portable players.

The main advantage of FLAC over lossy codecs such as MP3 and Vorbis is that, quite simply, the sound is exactly as good as whatever your source material is. For this reason, FLAC makes an excellent archive format for backing up all of your music. It is also useful for those with plenty of hard drive space, who can afford to blow 50 gigabytes of storage space to holding their CD collection in a 'perfect' format. While in the past one could do this using plain WAV files, FLAC has a couple of key advantages, the most important being that FLAC supports more or less arbitrary metadata, thanks to using the Vorbis comment system. Data can also be encoded into or decoded from FLAC data much faster than can be done with Vorbis or MP3. FLAC data can be encoded into either an Ogg data stream, or as a standalone FLAC-specific format. And while FLAC files are very large compared to any lossy codec, the space savings over WAV are nothing to sneeze at, especially when taken over dozens of CDs worth of music.

FLAC works, at a high level, in the following steps:

  1. Blocking: Split the file up into chunks, each of which is processed on its own.
  2. Interchannel Decorrelation: Assuming that the input had multiple channels, they are compared. Generally speaking there will be a strong correlation between multiple channels in an audio stream, and this step removes the redundancy. There are different methods that can be used for this; the one FLAC uses takes the average of the two channels, plus the difference between the two channels. This allows one to recover both channels perfectly later on; remember, FLAC can't lose any information about the stream.
  3. Prediction: A mathematical model which is at least moderately close to the input is found and stored. FLAC currently has four different models to choose from when encoding, though two of them are for special cases (when compressing really random inputs that don't model well, and when compressing pure silence). The other two are based on forms of linear pulse coding. Since a description of such a model is typically quite small, this is a substantial savings in space. The downside is that, aside from toy cases or pure luck, FLAC will not be able to find a model which exactly replicates the sound. This brings us to the last step...
  4. Residual coding: The difference between the actual sound and the model found in the last step is computed and stored. This allows a FLAC decoder to flawlessly produce the original inputs, by first generating whatever is specified by the model, and then adding back the residual data.

FLAC does not compress as well or as quickly as some of its equally lossless competitors, such as Monkey's Audio, OptimFROG and Shorten, but typically it provides an acceptable tradeoff between the two factors (the best compressors are extremely slow, while the fastest ones have somewhat poorer compression ratios). In most tests, FLAC is among the fastest for both encoding and decoding, and the output is usually no more than 10% larger than the very best lossless audio codecs. And FLAC has the additional bonus of being supported in a fairly wide variety of software players, like XMMS and WinAmp, as well as being very well documented, and completely free to use in any application you like. While this may not be a concern for some people, I feel better about archiving my music in a format that I know I will be able to read no matter what.


Source: http://flac.sourceforge.net/

Log in or registerto write something here or to contact authors.