FLAC

From Audacity Wiki
Jump to: navigation, search
FLAC (Free Lossless Audio Codec) is a size-compressed but lossless digital audio format with smaller file size than uncompressed lossless formats like WAV. FLAC is currently well-supported by many software programs and hardware support is growing. Josh Coalson is the primary author of FLAC.

Contents

How it works

FLAC uses a combination of linear prediction, Golomb-Rice coding, and lastly, run-length encoding for blocks of identical samples, such as silent passages. You can read more about technical aspects of FLAC in the FLAC documentation.

Comparisons to other formats

While several other compressed formats like MP3 and OGG are "lossy" (meaning they discard audio information to achieve compression), FLAC is lossless. It has the same quality as the lossless uncompressed WAV and AIFF formats, but with smaller file size. Audio encoded to FLAC is typically reduced to a little less than half of the original file size. An MP3, by comparison, is typically one tenth or so of the original file size, but with lost audio information and lower quality.

Other similar lossless compressed formats include OptimFROG (.ofr), Wavpack (.wv), Shorten (.shn) and Monkeys Audio (.ape). There are also lossless compressed versions of the proprietary Apple, Windows Media and Real Audio lossy compressed codecs. Current Audacity as shipped (and legacy Audacity 1.2) cannot import any of these alternative formats, with the exception of Apple Lossless which can be imported into current Audacity on Mac OS X using QuickTime. Many of these alternative formats can be imported and exported using current Audacity on all operating systems if you add the optional FFmpeg library to your computer.

Features

The are no quality settings in the encoder as the format is lossless, but there are levels settings for the amount of file size compression used to losslessly pack the audio data, similar to compression levels in ZIP files. The level settings range from 0 to 8. Level 0 is optimized to encode as fast as possible. Level 8 is optimized to pack as efficiently as possible, so produces slightly smaller files than level 0 at the expense of taking longer to encode. Files encoded at level 8 are rarely more than a few percent smaller than those encoded at level 0, but can take three or four times longer to encode.

FLAC supports metadata tags containing information such as title and artist (similar to the ID3 tags in MP3 files) and supports cover art (though Audacity does not yet support cover art). Unlike MP3, FLAC is a free, open source codec.

Import and Export of FLAC

The current version of Audacity has full support for import and export of 16-bit and 24-bit FLAC.

On Windows and Mac OS X libflac is used to import and export FLAC but on Linux libsndfile is used by default to import FLAC. Importing using libsndfile allows FLAC files to be imported and operated on more quickly using On-Demand Loading. To import using libflac, choose the "FLAC files" filter when using Open or Import, or set a rule in Extended Import Preferences to always use libflac whatever the import method.

Support in legacy Audacity

The legacy Audacity version 1.2.6 can import 16-bit FLAC files. Export of FLAC does not work in the distributed Windows and OS X builds of 1.2.6. However if you compile Audacity 1.2.6 from the legacy AUDACITY_1_2 branch with suitable libraries, 16-bit FLAC export should work and can be enabled on the File Formats tab of Preferences in the "Uncompressed Export Format" drop-down. From legacy 1.3.3 Beta onwards, the export format is chosen in the "Save as type" box after choosing one of the export options in the File menu.

Personal tools