This page describes the user-level view of the FLAC format (for a more detailed explanation see the <AHREF="format.html">format page</A>). It also contains the user documentation for <B><TT>flac</TT></B>, which is the command-line file encoder/decoder, and the <AHREF="#plugins">input plugins</A>.
</P>
<P>
Keep in mind that the online version of this document will always apply to the latest release. For older releases, check the documentation included with the release package.
See the <AHREF="format.html#scope">Scope</A>, <AHREF="format.html#architecture">Architecture</A>, <AHREF="format.html#definitions">Definitions</A>, and <AHREF="format.html#overview">Overview</A> sections of the <AHREF="format.html">format page</A> for a good introduction. This section will be expanded in the future.
<B><TT>flac</TT></B> is the command-line file encoder/decoder. The input to the encoder and the output to the decoder must either be RIFF WAVE format, or raw interleaved sample data. <B><TT>flac</TT></B> only supports linear PCM samples (in other words, no A-LAW, uLAW, etc.). Another restriction (hopefully short-term) is that the input must be 8 or 16 bits per sample. This is not a limitation of the FLAC format, just the reference encoder.
</P>
<P>
<B><TT>flac</TT></B> assumes that RIFF WAVE files will have the extension ".wav"; this may be overridden with a command-line option. Other than this, <B><TT>flac</TT></B> makes no assumptions about file extensions, though the convention is that FLAC files have the extension ".flac" (or ".fla" on ancient file systems like FAT-16).
</P>
<P>
Before going into the full command-line description, two other things help to sort it out: 1) <B><TT>flac</TT></B> encodes by default, so you must use <B>-d</B> to decode; 2) the options <B><TT>-0</TT></B> .. <B><TT>-9</TT></B> that control the compression level actually are just synonyms for different groups of specific coding options (described later). You can get the same effect by using the same options.
In either case, inputfile may be "-" for stdin, and the outputfile "-" for stdout. The encoding options affect the compression ratio and encoding speed. The format options are used to tell <B><TT>flac</TT></B> the arrangement of samples if the input file (or output file when decoding) is a raw file. If it is a RIFF WAVE file the format options are not needed since they are read from the WAVE header.
</P>
<P>
In test mode, <B><TT>flac</TT></B> acts just like in decode mode, except no output file is written. Both decode and test modes detect errors in the stream, but they also detect when the MD5 signature of the decoded audio does not match the stored MD5 signature, even when the bitstream is valid.
Decode (<B><TT>flac</TT></B> encodes by default). <B><TT>flac</TT></B> will exit with an exit code of <TT>1</TT> (and print a message, even in silent mode) if there were any errors during decoding, including when the MD5 checksum does not match the decoded output. Otherwise the exit code will be <TT>0</TT>.
Analyze (same as <B><TT>-d</TT></B> except an analysis file is written). The exit codes are the same as in decode mode. This option is mainly for developers; the output will be a text file that has data about each frame and subframe.
Allow encoder to generate non-Subset files. The resulting FLAC file may not be streamable, so you should only use this option in combination with custom encoding options meant for archival. File decoders will still be able play (and seek in) such files.
Set the blocksize. The default is 1152 for -l 0, otherwise 4608. Subset streams must use one of 192/576/1152/2304/4608. The current encoder uses the same blocksize for the entire stream.
Enable mid-side coding (only for stereo streams). Tends to increase compression by a few percent on average. For each block both the stereo pair and mid-side versions of the block will be encoded, and smallest resulting frame will be stored. Currently mid-side encoding is only available when bits-per-sample <= 16.
Exhaustive model search (expensive!). Normally the encoder estimates the best model to use and encodes once based on the estimate. With an exhaustive model search, the encoder will generate subframes for every order and use the smallest. If the max LPC order is high this can significantly increase the encode time but can shave off another 0.5%.
Specifies the maximum LPC order. This number must be <= 32. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger.
Specifies the precision of the quantized LP coefficients, in bits. The default is <B><TT>-q 0</TT></B>, which means let the encoder decide based on the signal. Unless you really know your input file it's best to leave this up to the encoder.
Do exhaustive LP coefficient quantization optimization. This option overrides any <B><TT>-q</TT></B> option. It is expensive and typically will only improve the compression a tiny fraction of a percent.
Do Rice parameter optimization. By default the encoder uses a single Rice parameter for the subframe's entire residual. With this option, the residual is partitioned into 2^n pieces, each with its own Rice parameter. Higher values of n yield diminishing returns. The most bang for the buck is usually with <B><TT>-r 2</TT></B> (more for higher blocksizes). This usually shaves off another 1.5%. The technique tends to peak out about when blocksize/(2^n)=128. Use <B><TT>-r 99</TT></B> to force the highest degree of optimization.
Verify the encoding process. With this option, <B><TT>flac</TT></B> will create a parallel decoder that decodes the output of the encoder and compares the result against the original. It will abort immediately with an error if a mismatch occurs. <B><TT>-V</TT></B> increases the total encoding time but is guaranteed to catch any unforseen bug in the encoding process.
All that is necessary is to copy <B><TT>libxmms-flac.so</TT></B> to the directory where XMMS looks for input plugins (usually <B><TT>/usr/lib/xmms/Input</TT></B>). There is nothing else to configure. Make sure to restart XMMS before trying to play any .flac files.
All that is necessary is to copy <B><TT>in_flac.dll</TT></B> to the <B><TT>Plugins/</TT></B> directory of your Winamp installation. There is nothing else to configure. Make sure to restart Winamp before trying to play any .flac files.
Here's the list of the known bugs. None of them threaten the archival quality of <B><TT>flac</TT></B>.
<UL>
<LI>Encoding/decoding to/from pipes in the MSVC version of <B><TT>flac</TT></B> is broken. I assume a Cygwin version would be fine but I haven't got around to checking that yet.</LI>
<LI>The Winamp 2 plugin sporadically hangs at the end of a file. This one has been low priority since I'm focusing on Winamp 3, which has a better plugin architecture.</LI>