HOME

TheInfoList




FLAC (; Free Lossless Audio Codec) is an
audio coding format An audio coding format (or sometimes audio compression format) is a content representation format for storage or transmission of digital audio Digital audio is a representation of sound recorded in, or converted into, Digital signal (signal p ...
for
lossless compression Lossless compression is a class of data compression In signal processing Signal processing is an electrical engineering subfield that focuses on analysing, modifying, and synthesizing signals such as audio signal processing, sound, image p ...
of
digital audio Digital audio is a representation of sound recorded in, or converted into, Digital signal (signal processing), digital form. In digital audio, the sound wave of the audio signal is typically encoded as numerical Sampling (signal processing), s ...
, developed by the Xiph.Org Foundation, and is also the name of the free software project producing the FLAC tools, the reference software package that includes a
codec A codec is a device or which encodes or a or . ''Codec'' is a of coder/decoder. In electronic communications, an endec is a device which acts as both an encoder and a decoder on a signal or data stream, and hence is a type of codec. ''Endec' ...
implementation. Digital audio compressed by FLAC's
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...

algorithm
can typically be reduced to between 50 and 70 percent of its original size and decompress to an identical copy of the original audio data. FLAC is an
open format An open format is a file format A file format is a way that information is encoded for storage in a . It specifies how s are used to encode information in a digital storage medium. File formats may be either or and may be either unpublis ...
with
royalty-free Royalty-free (RF) material subject to copyright Copyright is a type of intellectual property Intellectual property (IP) is a category of property Property is a system of rights that gives people legal control of valuable things, and ...
licensing and a
reference implementation In the software development process In software engineering, a software development process is the process of dividing software development work into smaller, parallel or sequential steps or subprocesses to improve Software design, design, So ...
which is
free software Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty ...

free software
. FLAC has support for
metadata Metadata is "data Data (; ) are individual facts, statistics, or items of information, often numeric. In a more technical sense, data are a set of values of qualitative property, qualitative or quantity, quantitative variable (research), v ...

metadata
tagging,
album coverAn album cover is the front of the packaging Packaging is the art and technology of enclosing or protecting products for distribution, storage, sale, and use. Packaging also refers to the process of designing, evaluating, and producing packages. ...
art, and fast seeking.


History

Development was started in 2000 by Josh Coalson. The bit-stream format was frozen when FLAC entered beta stage with the release of version 0.5 of the reference implementation on 15 January 2001. Version 1.0 was released on 20 July 2001. On 29 January 2003, the Xiph.Org Foundation and the FLAC project announced the incorporation of FLAC under the Xiph.org banner. Xiph.org is home to other free compression formats such as
Vorbis Vorbis is a free and open-source software Free and open-source software (FOSS) is software Software is a collection of instructions that tell a computer A computer is a machine that can be programmed to carry out sequences of ari ...
,
Theora Theora is a free Free may refer to: Concept * Freedom, having the ability to act or change without constraint * Emancipate, to procure political rights, as for a disenfranchised group * Free will, control exercised by rational agents over ...
,
Speex Speex is an audio compression codec specifically tuned for the reproduction of human speech and also a free software Free software (or libre software) is computer software Software is a collection of Instruction (computer science), ins ...
and Opus. Version 1.3.0 was released on 26 May 2013, at which point development was moved to the Xiph.org git repository.


Composition

The FLAC project consists of: * The stream formats * A simple container format for the stream, also called FLAC (or ''Native FLAC'') * libFLAC, a library of reference encoders and decoders, and a metadata interface * libFLAC++, an
object-oriented Object-oriented programming (OOP) is a programming paradigm Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * P ...
wrapper around libFLAC * flac, a command-line program based on libFLAC to encode and decode FLAC streams * metaflac, a command-line metadata editor for .flac files and for applying
ReplayGain ReplayGain is a proposed technical standard A technical standard is an established norm (social), norm or requirement for a repeatable technical task which is applied to a common and repeated use of rules, conditions, guidelines or characteristics ...
* Input plugins for various music players (
Winamp Winamp is a for originally developed by and Dmitry Boldyrev by their company , which they later sold to in 1999 for $80 million. It was then acquired by in 2014. Since version 2 it has been sold as and supports extensibility with an ...
,
XMMS X Multimedia System (XMMS) is an audio player for Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system An operating system (OS) is system software that manages computer hardware, computer software, software resou ...

XMMS
,
foobar2000 foobar2000 (often abbreviated as fb2k or f2k) is a freeware Audio player (software), audio player for Microsoft Windows, iOS and Android (operating system), Android developed by Peter Pawłowski. It has a Modular programming, modular design, w ...
,
musikCube musikcube is a free and open-source Free and open-source software (FOSS) is software Software is a collection of Instruction (computer science), instructions and data (computing), data that tell a computer how to work. This is in contrast t ...
, and many more) * With Xiph.org incorporation, the
Ogg Ogg is a free, open Open or OPEN may refer to: citizen * Open (band), Australian pop/rock band * The Open (band), English indie rock band * ''Open'' (Blues Image album), 1969 * ''Open'' (Gotthard album), 1999 * ''Open'' (Cowboy Junkies ...
container format, suitable for streaming (also called ''Ogg FLAC'') The specification of the stream format can be implemented by anyone without prior permission (Xiph.org reserves the right to set the FLAC specification and certify compliance), and neither the FLAC format nor any of the implemented
encoding In communication Communication (from Latin ''communicare'', meaning "to share") is the act of developing Semantics, meaning among Subject (philosophy), entities or Organization, groups through the use of sufficiently mutually understood sign ...
or decoding methods are covered by any patent. The
reference implementation In the software development process In software engineering, a software development process is the process of dividing software development work into smaller, parallel or sequential steps or subprocesses to improve Software design, design, So ...
is
free software Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty ...

free software
. The
source code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...

source code
for libFLAC and libFLAC++ is available under the
BSD license BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft Copyleft is the practice of granting the right to freely distrib ...
, and the sources for flac, metaflac, and the plugins are available under the
GNU General Public License The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software license A free-software license is a notice that grants the recipient of a piece of software extensive rights to modify and software distribu ...
. In its stated goals, the FLAC project encourages its developers not to implement copy prevention features (
DRM DRM may refer to: Government, military and politics * Defense reform movement, U.S. campaign inspired by Col. John Boyd * Democratic Republic of Madagascar, a former socialist state (1975–1992) on Madagascar * Direction du renseignement militaire ...
) or lossy compression of any kind.


Design

Audio sources encoded to FLAC are typically reduced to 50–70% of their original size, similar to other lossless formats, though the final size depends on the density and amplitude of the music being compressed, and, with some music, file size can be reduced by as much as 80%.


Source encoder

* The FLAC format supports only
integer An integer (from the Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', meaning "to share" or "to ...
samples, not
floating-point In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest com ...
. It can handle any
PCM Pulse-code modulation (PCM) is a method used to Digital signal (signal processing), digitally represent sampled analog signals. It is the standard form of digital audio in computers, compact discs, digital telephony and other digital audio ap ...
bit resolution from 4 to 32
bit The bit is a basic unit of information in computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algo ...
s per sample, any
sampling rate In , sampling is the reduction of a to a . A common example is the conversion of a (a continuous signal) to a sequence of samples (a discrete-time signal). A sample is a value or set of values at a point in time and/or space. A sampler is a su ...
from 1  to 65,535 Hz in 1 Hz increments or from 10 Hz to 655,350 Hz in 10 Hz increments, and any number of channels from 1 to 8. To date (version 1.3.3 of the reference encoder), FLAC encoding is limited to 24 bits per sample since no encoder for 32 bits per sample exists, but decoders are present in libFLAC and in ffmpeg. * Channels can be grouped in some cases, for example stereo and 5.1 channel
surround Surround sound is a technique for enriching the fidelity and depth of Sound recording and reproduction, sound reproduction by using multiple audio channels from speaker (electronics), speakers that surround the listener (surround channels). Its ...
, to take advantage of interchannel correlations to increase compression. * CRC checksums are used for identifying corrupted frames when used in a streaming protocol. The file also includes a complete hash of the raw PCM audio in its ''STREAMINFO'' metadata header. FLAC allows for a Rice parameter between 0 and 16. * FLAC uses
linear prediction Linear prediction is a mathematical operation where future values of a discrete-time In mathematical dynamics, discrete time and continuous time are two alternative frameworks within which to model variables that evolve over time. Discrete time ...
to convert the audio samples. There are two steps, the predictor and the error coding. The predictor can be one of four types (Zero, Verbatim, Fixed Linear and Finite Impulse Response (FIR) Linear). The difference between the predictor and the actual sample data is calculated and is known as the residual. The residual is stored efficiently using Golomb-Rice coding. It also uses
run-length encoding Run-length encoding (RLE) is a form of lossless data compression Lossless compression is a class of data compression algorithms that allows the original data to be perfectly reconstructed from the compressed data. By contrast, lossy compressio ...
for blocks of identical samples, such as silent passages.


Metadata

* FLAC supports
ReplayGain ReplayGain is a proposed technical standard A technical standard is an established norm (social), norm or requirement for a repeatable technical task which is applied to a common and repeated use of rules, conditions, guidelines or characteristics ...
. * For tagging, FLAC uses the same system as
Vorbis comment A Vorbis comment is a metadata container used in the Vorbis, FLAC, Theora, Speex and Opus (audio format), Opus file formats. It allows information such as the title, artist, album, track number or other information about the file to be added to the ...
s. * The libFLAC API is organized into streams, seekable streams, and files (listed in the order of increasing abstraction from the base FLAC bitstream). * Most FLAC applications will generally restrict themselves to encoding/decoding using libFLAC at the file level interface.


Compression levels

libFLAC uses a compression level parameter that varies from 0 (fastest) to 8 (slowest). The compressed files are always perfect, lossless representations of the original data. Although the compression process involves a tradeoff between speed and size, the decoding process is always quite fast and not dependent on the level of compression. According to a .WAV benchmark running with an Athlon XP 2400+, using higher rates above default level −5 takes considerably more time to encode without real gains in space savings.


Comparison to other formats

FLAC is specifically designed for efficient packing of audio data, unlike general-purpose lossless algorithms such as DEFLATE, which are used in ZIP and
gzip gzip is a file format A file format is a standard Standard may refer to: Flags * Colours, standards and guidons * Standard (flag), a type of flag used for personal identification Norm, convention or requirement * Standard (metrol ...
. While ZIP may reduce the size of a CD-quality audio file by 10–20%, FLAC is able to reduce the size of audio data by 40–50% by taking advantage of the characteristics of audio. The technical strengths of FLAC compared to other lossless formats lie in its ability to be streamed and decoded quickly, independent of compression level. Since FLAC is a lossless scheme, it is suitable as an archive format for owners of CDs and other media who wish to preserve their audio collections. If the original media are lost, damaged, or worn out, a FLAC copy of the audio tracks ensures that an exact duplicate of the original data can be recovered at any time. An exact restoration from a lossy copy (e.g.,
MP3 MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio Digital audio is a representation of sound recorded in, or converted into, Digital signal (signal processing), digital form. In digital a ...

MP3
) of the same data is impossible. FLAC being lossless means it is highly suitable for
transcoding Transcoding is the direct digital-to-digital conversion of one encoding In communication Communication (from Latin ''communicare'', meaning "to share") is the act of developing Semantics, meaning among Subject (philosophy), entities or Org ...
e.g. to MP3, without the normally associated transcoding quality loss between one lossy format and another. A CUE file can optionally be created when
ripping Ripping is extracting all or parts of digital contents from a container. Originally, it meant to rip music out of Amiga The Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model i ...
a CD. If a CD is read and ripped perfectly to FLAC files, the CUE file allows later burning of an audio CD that is identical in audio data to the original CD, including track order and
pregap The pregap on a Red Book audio CD is the portion of the audio track that precedes "index Index may refer to: Arts, entertainment, and media Fictional entities * Index (''A Certain Magical Index''), a character in the light novel series ''A C ...
, but excluding
CD-Text CD-Text is an extension of the Red Book Compact Disc The compact disc (CD) is a digital Digital usually refers to something using digits, particularly binary digits. Technology and computing Hardware *Digital electronics Digital ele ...
and other additional data such as lyrics and
CD+G CD+G (also known as CD-G, CD+Graphics and TV-Graphics) is an extension of the compact disc The compact disc (CD) is a digital Digital usually refers to something using digits, particularly binary digits. Technology and computing Hardwar ...
graphics.


Adoption and implementations

The reference implementation of FLAC is implemented as the ''libFLAC'' core encoder & decoder library, with the main distributable program flac being the reference implementation of the libFLAC API. This
codec A codec is a device or which encodes or a or . ''Codec'' is a of coder/decoder. In electronic communications, an endec is a device which acts as both an encoder and a decoder on a signal or data stream, and hence is a type of codec. ''Endec' ...
API is also available in C++ as libFLAC++. The reference implementation of FLAC compiles on many platforms, including most
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser Multi-user software is computer software Software is a collection of Instruction (computer science), instructions that tell a computer how to work. This is in contrast t ...

Unix
(such as Solaris,
BSD The Berkeley Software Distribution (BSD) is a discontinued operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include ope ...

BSD
) and
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating s ...
(including
Linux Linux ( or ) is a family of open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product ...

Linux
),
Microsoft Windows Microsoft Windows, commonly referred to as Windows, is a group of several proprietary {{Short pages monitor