Free Lossless Audio Codec (FLAC) is a codec for lossless audio data compression that is being developed by the Xiph.Org Foundation. It is freely available and its use is not restricted by software patents. Development of FLAC began in 2000. In 2004, the band Metallica announced that in the future they would not only sell their concert recordings in the lossy MP3 format, but would offer the recordings in FLAC format for music lovers.
Read about various audio file formats.
The project is dedicated to the streaming format, libFLAC (a library with reference encoder and decoder and a metadata interface), libFLAC++ (an object wrapper for libFLAC), flac (a command line tool for encoding and decoding .flac files using libFLAC), metaflac (a command line tool for editing the metadata of .flac files), input filters as plug-ins for various music players (Winamp , XMMS etc).
---

Image credit: uforobot.github.io
libFLAC and libFLAC++ are available under an adapted version of the BSD license, flac, metaflac and the extensions under the GPL.
Design of FLAC
By default, FLAC files are stored in FLAC’s own container and can contain a data stream. The container format, like the entire standard, is designed to completely secure entire audio CDs or their titles, i.e. H. including the metadata.
The FLAC container initially consists of a sequence of any number of so-called metadata blocks, which serve as headers. The STREAMINFO block is the first and only mandatory metadata block that contains information about the FLAC data stream itself. Additional blocks are optional and do not have to be supported by either encoders or decoders. For example, they contain title information in the Vorbis comment metadata format, jump tables for faster access to specific points in the data stream, padding as a placeholder for further future headers, or image data such as an album cover. In Ogg and Matroska containers, multiple FLAC-compressed audio data can be stored side by side in the same file, usually together with a video data stream for multilingual films.
According to the developers, FLAC achieves an average compression of around 50 percent of the original size, so the difference to other lossless audio compression methods is in the range of a few percentage points. However, various other tests suggest a compression of around 60 percent. Various factors have a significant impact on the compression rate :
- Sampling rate : The higher the sampling rate, the stronger the compression achieved, as the signal contains fewer high frequencies relative to the sampling rate and becomes more predictable overall.
- The encoded signal itself has a significant influence:
Higher atonality makes the signal less predictable.
Higher signal levels make the signal less predictable. - Bit depth : The more bit depth the signal has, the less compressible it is. In principle, it is therefore a more meaningful measurement variable to specify the absolute number of average bits saved per sample instead of the compression rate, as this is largely independent of the bit depth.
FLAC Versus Other Formats
From a technical point of view, FLAC is primarily characterized by the fact that it can be streamed and offers multi-channel, replay gain and cue sheet support. In addition, RIFF and AIFF metadata can be embedded in FLAC files, which are restored during decoding. The compression strength is in the middle range compared to other lossless audio codecs.
FLAC is designed to be compatible with the MP3 format, which is about ten years older, in that FLAC frames can be clearly distinguished from MP3 frames in a data stream. Furthermore, the image data format of the FLAC container is similar to the format of the APIC frame in ID3v2, which is used in MP3.
FLAC is also a so-called asymmetric codec, i.e. H. the computational effort for encoding is significantly higher than that for decoding. The computational cost of decoding is even lower than that of many other lossless codecs. The background is the idea that a file is usually only encoded once, but is decoded much more frequently (usually for playback). As a result, the format places comparatively low demands on the computing power of playback devices or programs. Since there is only one level of complexity, the effort involved in decoding always remains the same – regardless of the encoder setting. This is one of the reasons why FLAC has gained some widespread use on playback devices alongside Apple Lossless, Apple ‘s lossless compression format.
Software and Hardware Support of FLAC
Since FLAC is free software, any program and device can use it.So it is supported by default by most Linux distributions. FLAC plug-ins and playback programs that support FLAC are available for many other operating systems and music players – examples include VLC media player, Quod Libet, Songbird, Winamp, Clementine, AIMP, The KMPlayer, Media Player Classic, PowerAmp and foobar2000.
The free libavcodec library of the FFmpeg project supports FLAC and thus also the large number of free and commercial software that is based on libavcodec. Examples of this are video editing programs like DaVinci Resolve or audio editors like Audacity.
Since around 2003 there have been devices on the market, including increasingly portable players, that can play the free audio format. For many players where the firmware can be updated, there are additional open source projects that support FLAC playback, such as Rockbox . Various programs for playing FLAC are available for mobile phones with Android. Starting with version 3.1, Android offers native FLAC support. In web browsers, FLAC Playback is fully supported natively in Firefox from version 51 (January 2017) and in Chrome from version 56 (January 2017).