Add 2003 to copyright notice
[platform/upstream/flac.git] / doc / html / documentation.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <!-- Copyright (c)  2000,2001,2002,2003  Josh Coalson -->
3 <!-- Permission is granted to copy, distribute and/or modify this document -->
4 <!-- under the terms of the GNU Free Documentation License, Version 1.1 -->
5 <!-- or any later version published by the Free Software Foundation; -->
6 <!-- with no invariant sections. -->
7 <!-- A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html -->
8 <HTML>
9 <HEAD>
10         <TITLE>FLAC - documentation</TITLE>
11 </HEAD>
12
13 <BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
14
15 <TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
16         <TR>
17                 <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
18         </TR>
19 </TABLE>
20
21 <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
22
23 <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
24
25 <TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
26         <TR>
27                 <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
28                         <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
29                                 <TR>
30                                         <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
31                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
32                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
33                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
34                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
35                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
36                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="id.html">id</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
37                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
38                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;documentation&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
39                                         <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
40                                 </TR>
41                         </TABLE>
42                 </TD>
43         </TR>
44 </TABLE>
45
46 <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
47
48 <TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
49         <TR>
50                 <TD ALIGN="CENTER" BGCOLOR="#EEEED4">
51                         <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
52                                 <TR>
53                                         <TD HEIGHT=22 BGCOLOR="#EEEED4" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;english&nbsp;&nbsp;</TD><TD BGCOLOR="#EEEED4" ALIGN=CENTER>|</TD>
54                                         <TD           BGCOLOR="#EEEED4" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="ru/documentation.html">russian</A>&nbsp;&nbsp;</TD>
55                                 </TR>
56                         </TABLE>
57                 </TD>
58         </TR>
59 </TABLE>
60
61 <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
62
63 <CENTER>
64
65 <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
66
67
68 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
69 <TR><TD>
70         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
71         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
72                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
73                 <B><FONT SIZE="+2">documentation</FONT></B>
74                 </FONT></TD></TR>
75         </TABLE>
76         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
77         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
78         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
79         <P>
80                 This page is broken up into the following sections:
81                 <UL>
82                         <LI><A HREF="#format">format</A> - the user-level view of the FLAC format (for a more detailed explanation see the <A HREF="format.html">format page</A>).</LI>
83                         <LI><A HREF="#flac">flac</A> - the usage of the command-line file encoder/decoder <B><TT>flac</TT></B>.</LI>
84                         <LI><A HREF="#metaflac">metaflac</A> - the usage of the command-line FLAC metadata editor <B><TT>metaflac</TT></B>.</LI>
85                         <LI><A HREF="#plugins">plugins</A> - documentation for the various input plugins.</LI>
86                         <LI><A HREF="api/index.html">libFLAC and libFLAC++ APIs</A> - for developers who want to add FLAC support to their programs.</LI>
87                         <LI><A HREF="#bugs">bugs</A> - known bugs.</LI>
88                         <LI><A HREF="#monkey">How to add FLAC support to the Monkey's Audio GUI</A></LI>
89                 </UL>
90         </P>
91         <P>
92                 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.
93         </P>
94         </FONT>
95         </TD></TR>
96         </TABLE>
97         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
98 </TD></TR>
99 </TABLE>
100
101
102 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
103 <TR><TD>
104         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
105         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
106                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
107                 <A NAME="format"><B><FONT SIZE="+2">format</FONT></B>
108                 </FONT></TD></TR>
109         </TABLE>
110         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
111         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
112         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
113         <P>
114                 <B><TT>flac</TT></B> has been tuned so that the default options yield a good speed vs. compression tradeoff for many kinds of input.  However, if you are looking to maximize the compression rate or speed, or want to use the full power of FLAC's metadata system, this section is for you.  If not, just skip to the <A HREF="#flac">next section</A>.
115         </P>
116         <P>
117                 The basic structure of a FLAC stream is:
118                 <UL>
119                         <LI>The four byte string "fLaC"</LI>
120                         <LI>The <A HREF="format.html#def_STREAMINFO">STREAMINFO</A> metadata block</LI>
121                         <LI>Zero or more other metadata blocks</LI>
122                         <LI>One or more audio frames</LI>
123                 </UL>
124         </P>
125         <P>
126                 The first four bytes are to identify the FLAC stream.  The metadata that follows contains all the information about the stream except for the audio data itself.  After the metadata comes the encoded audio data.
127         </P>
128         <P>
129                 <B>METADATA</B>
130         </P>
131         <P>
132                 FLAC defines several types of metadata blocks (see the <A HREF="format.html">format</A> page for the complete list).  Metadata blocks can be any length and new ones can be defined.  A decoder is allowed to skip any metadata types it does not understand.  Only one is mandatory: the STREAMINFO block.  This block has information like the sample rate, number of channels, etc., and data that can help the decoder manage its buffers, like the minimum and maximum data rate and minimum and maximum block size.  Also included in the STREAMINFO block is the MD5 signature of the <I>unencoded</I> audio data.  This is useful for checking an entire stream for transmission errors.
133         </P>
134         <P>
135                 Other blocks allow for padding, seek tables, tags, cuesheets, and application-specific data.  You can see <B><TT>flac</TT></B> options below for adding PADDING blocks or specifying seek points.  FLAC does not require seek points for seeking but they can speed up seeks, or be used for cueing in editing applications.
136         <P>
137         </P>
138                 Also, if you have a need of a custom metadata block, you can define your own and request an ID <A HREF="id.html">here</A>.  Then you can reserve a PADDING block of the correct size when encoding, and overwrite the padding block with your APPLICATION block after encoding.  The resulting stream will be FLAC compatible; decoders that are aware of your metadata can use it and the rest will safely ignore it.
139         </P>
140         <P>
141                 <B>AUDIO DATA</B>
142         </P>
143         <P>
144                 After the metadata comes the encoded audio data.  Audio data and metadata are not interleaved.  Like most audio codecs, FLAC splits the unencoded audio data into blocks, and encodes each block separately.  The encoded block is packed into a frame and appended to the stream.  The reference encoder uses a single block size for the whole stream but the FLAC format does not require it.
145         </P>
146         <P>
147                 <B>BLOCKING</B>
148         </P>
149         <P>
150                 The block size is an important parameter to encoding.  If it is too small, the frame overhead will lower the compression.  If it is too large, the modeling stage of the compressor will not be able to generate an efficient model.  Understanding FLAC's modeling will help you to improve compression for some kinds of input by varying the block size.  In the most general case, using linear prediction on 44.1kHz audio, the optimal block size will be between 2-6 ksamples.  <B><TT>flac</TT></B> defaults to a block size of 4608 in this case.  Using the fast fixed predictors, a smaller block size is usually preferable because of the smaller frame header.
151         </P>
152         <P>
153                 <B>INTER-CHANNEL DECORRELATION</B>
154         </P>
155         <P>
156                 In the case of stereo input, once the data is blocked it is optionally passed through an inter-channel decorrelation stage.  The left and right channels are converted to center and side channels through the following transformation: mid = (left + right) / 2, side = left - right.  This is a lossless process, unlike joint stereo.  For normal CD audio this can result in significant extra compression.  <B><TT>flac</TT></B> has two options for this: <TT>-m</TT> always compresses both the left-right and mid-side versions of the block and takes the smallest frame, and <TT>-M</TT>, which adaptively switches between left-right and mid-side.
157         </P>
158         <P>
159                 <B>MODELING</B>
160         </P>
161         <P>
162                 In the next stage, the encoder tries to approximate the signal with a function in such a way that when the approximation is subracted, the result (called the <I>residual</I>, <I>residue</I>, or <I>error</I>) requires fewer bits-per-sample to encode.  The function's parameters also have to be transmitted so they should not be so complex as to eat up the savings.  FLAC has two methods of forming approximations: 1) fitting a simple polynomial to the signal; and 2) general linear predictive coding (LPC).  I will not go into the details here, only some generalities that involve the encoding options.
163         </P>
164         <P>
165                 First, fixed polynomial prediction (specified with <TT>-l 0</TT>) is much faster, but less accurate than LPC.  The higher the maximum LPC order, the slower, but more accurate, the model will be.  However, there are diminishing returns with increasing orders.  Also, at some point (usually around order 9) the part of the encoder that guesses what is the best order to use will start to get it wrong and the compression will actually decrease slightly; at that point you will have to you will have to use the exhaustive search option <TT>-e</TT> to overcome this, which is significantly slower.
166         </P>
167         <P>
168                 Second, the parameters for the fixed predictors can be transmitted in 3 bits whereas the parameters for the LPC model depend on the bits-per-sample and LPC order.  This means the frame header length varies depending on the method and order you choose and can affect the optimal block size.
169         </P>
170         <P>
171                 <B>RESIDUAL CODING</B>
172         </P>
173         <P>
174                 Once the model is generated, the encoder subracts the approximation from the original signal to get the residual (error) signal.  The error signal is then losslessly coded.  To do this, FLAC takes advantage of the fact that the error signal generally has a Laplacian (two-sided geometric) distribution, and that there are a set of special Huffman codes called Rice codes that can be used to efficiently encode these kind of signals quickly and without needing a dictionary.
175         </P>
176         <P>
177                 Rice coding involves finding a single parameter that matches a signal's distribution, then using that parameter to generate the codes.  As the distribution changes, the optimal parameter changes, so FLAC supports a method that allows the parameter to change as needed.  The residual can be broken into several <I>contexts</I> or <I>partitions</I>, each with it's own Rice parameter.  <B><TT>flac</TT></B> allows you to specify how the partitioning is done with the <TT>-r</TT> option.  The residual can be broken into 2^<I>n</I> partitions, by using the option <TT>-r n,n</TT>.  The parameter <I>n</I> is called the <I>partition order</I>.  Furthermore, the encoder can be made to search through <I>m</I> to <I>n</I> partition orders, taking the best one, by specifying <TT>-r m,n</TT>.  Generally, the choice of n does not affect encoding speed but m,n does.  The larger the difference between m and n, the more time it will take the encoder to search for the best order.  The block size will also affect the optimal order.
178         </P>
179         <P>
180                 <B>FRAMING</B>
181         </P>
182         <P>
183                 An audio frame is preceded by a frame header and trailed by a frame footer.  The header starts with a sync code, and contains the minimum information necessary for a decoder to play the stream, like sample rate, bits per sample, etc.  It also contains the block or sample number and an 8-bit CRC of the frame header.  The sync code, frame header CRC, and block/sample number allow resynchronization and seeking even in the absence of seek points.  The frame footer contains a 16-bit CRC of the entire encoded frame for error detection.  If the reference decoder detects a CRC error it will generate a silent block.
184         </P>
185         <P>
186                 <B>MISCELLANEOUS</B>
187         </P>
188         <P>
189                 In order to support come common types of metadata, the reference decoder knows how to skip ID3V1 and ID3V2 tags so it is safe to tag FLAC files in this way.  ID3V2 tags must come at the beginning of the file (before the "fLaC" marker) and ID3V1 tags must come at the end of the file.
190         </P>
191         <P>
192                 <B><TT>flac</TT></B> has a verify option <TT>-V</TT> that verifies the output while encoding.  With this option, a decoder is run in parallel to the encoder and its output is compared against the original input.  If a difference is found <B><TT>flac</TT></B> will stop with an error.
193         </P>
194         </FONT>
195         </TD></TR>
196         </TABLE>
197         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
198 </TD></TR>
199 </TABLE>
200
201
202 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
203 <TR><TD>
204         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
205         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
206                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
207                 <A NAME="flac"><B><FONT SIZE="+2">flac</FONT></B>
208                 </FONT></TD></TR>
209         </TABLE>
210         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
211         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
212         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
213         <P>
214                 <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, AIFF, 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, 16, or 24 bits per sample.  This is not a limitation of the FLAC format, just the reference encoder/decoder.
215         </P>
216         <P>
217                 <B><TT>flac</TT></B> assumes that files ending in ".wav" or that have the RIFF WAVE header present are WAVE files, and files ending in ".aif" or ".aiff" or have the AIFF header present are in AIFF files.  This may be overridden with a command-line option.  It also assumes that files ending in ".ogg" are Ogg-FLAC files.  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).
218         </P>
219         <P>
220                 Before going into the full command-line description, a few 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>-8</TT></B> (or <B><TT>--fast</B></TT> and <B><TT>--best</B></TT>) that control the compression level actually are just synonyms for different groups of specific encoding options (described later) and you can get the same effect by using the same options; 3) <B><TT>flac</TT></B> behaves similarly to gzip in the way it handles input and output files.
221         </P>
222         <P>
223                 <B><TT>flac</TT></B> will be invoked one of four ways, depending on whether you are encoding, decoding, testing, or analyzing:
224                 <UL>
225                 <LI>
226                         Encoding: flac [<I><A HREF="#general_options">&lt;general-options&gt;</A></I>] [<I><A HREF="#format_options">&lt;format-options&gt;</A></I>] [<I><A HREF="#encoding_options">&lt;encoding options&gt;</A></I>] [inputfile [...]]
227                 </LI>
228                 <LI>
229                         Decoding: flac -d [<I><A HREF="#general_options">&lt;general-options&gt;</A></I>] [<I><A HREF="#format_options">&lt;format-options&gt;</A></I>] [<I><A HREF="#decoding_options">&lt;decoding options&gt;</A></I>]  [FLACfile [...]]
230                 </LI>
231                 <LI>
232                         Testing: flac -t [<I><A HREF="#general_options">&lt;general-options&gt;</A></I>] [FLACfile [...]]
233                 </LI>
234                 <LI>
235                         Analyzing: flac -a [<I><A HREF="#general_options">&lt;general-options&gt;</A></I>] [<I><A HREF="#analysis_options">&lt;analysis-options&gt;</A></I>] [FLACfile [...]]
236                 </LI>
237                 </UL>
238         </P>
239         <P>
240                 In any case, if no <TT>inputfile</TT> is specified, stdin is assumed.  If only one inputfile is specified, it may be "-" for stdin.  When stdin is used as input, <B><TT>flac</TT></B> will write to stdout.  Otherwise <B><TT>flac</TT></B> will perform the desired operation on each input file to similarly named output files (meaning for encoding, the extension will be replaced with ".flac", or appended with ".flac" if the input file has no extension, and for decoding, the extension will be ".wav" for WAVE output and ".raw" for raw output).  The original file is not deleted unless --delete-input-file is specified.
241         </P>
242         <P>
243                 If you are encoding/decoding from stdin to a file, you should use the -o option like so:
244                 <UL>
245                 <LI>
246                         flac [options] -o outputfile
247                 </LI>
248                 <LI>
249                         flac -d [options] -o outputfile
250                 </LI>
251                 </UL>
252                 which are better than:
253                 <UL>
254                 <LI>
255                         flac [options] &gt; outputfile
256                 </LI>
257                 <LI>
258                         flac -d [options] &gt; outputfile
259                 </LI>
260                 </UL>
261                 since the former allows flac to seek backwards to write the STREAMINFO or RIFF WAVE header contents when necessary.
262         </P>
263         <P>
264                 Also, you can force output data to go to stdout using <TT>-c</TT>.
265         </P>
266         <P>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 or AIFF file the format options are not needed since they are read from the AIFF/WAVE header.
267         </P>
268         <P>
269                 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.
270         </P>
271         <P>
272         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
273         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
274                 <TR>
275                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
276                                 <A NAME="general_options"><FONT SIZE="+1"><B>General Options</B></FONT></A>
277                         </TD>
278                 </TR>
279                 <TR>
280                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
281                                 <TT>-v</TT>, <TT>--version</TT>
282                         </TD>
283                         <TD>
284                                 Show the <B><TT>flac</TT></B> version number.
285                         </TD>
286                 </TR>
287                 <TR>
288                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
289                                 <TT>-h</TT>, <TT>--help</TT>
290                         </TD>
291                         <TD>
292                                 Show basic usage and a list of all options.  Running <B><TT>flac</TT></B> without arguments shows the short help screen by default.
293                         </TD>
294                 </TR>
295                 <TR>
296                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
297                                 <TT>-H</TT>, <TT>--explain</TT>
298                         </TD>
299                         <TD>
300                                 Show detailed explanation of usage and all options.  Running <B><TT>flac</TT></B> without arguments shows the short help screen by default.
301                         </TD>
302                 </TR>
303                 <TR>
304                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
305                                 <TT>-d</TT>, <TT>--decode</TT>
306                         </TD>
307                         <TD>
308                                 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>.
309                         </TD>
310                 </TR>
311                 <TR>
312                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
313                                 <TT>-t</TT>, <TT>--test</TT>
314                         </TD>
315                         <TD>
316                                 Test (same as <B><TT>-d</TT></B> except no decoded file is written).  The exit codes are the same as in decode mode.
317                         </TD>
318                 </TR>
319                 <TR>
320                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
321                                 <TT>-a</TT>, <TT>--analyze</TT>
322                         </TD>
323                         <TD>
324                                 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.
325                         </TD>
326                 </TR>
327                 <TR>
328                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
329                                 <TT>-c</TT>, <TT>--stdout</TT>
330                         </TD>
331                         <TD>
332                                 Write output to stdout.
333                         </TD>
334                 </TR>
335                 <TR>
336                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
337                                 <TT>-s</TT>, <TT>--silent</TT>
338                         </TD>
339                         <TD>
340                                 Silent: do not show encoding/decoding statistics.
341                         </TD>
342                 </TR>
343                 <TR>
344                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
345                                 <TT>-o filename</TT>,<BR><TT>--output-name=filename</TT>
346                         </TD>
347                         <TD>
348                                 Force the output file name (usually <TT><B>flac</B></TT> just changes the extension).  May only be used when encoding a single file.  May not be used in conjunction with <TT>--output-prefix</T>.
349                         </TD>
350                 </TR>
351                 <TR>
352                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
353                                 <TT>--output-prefix=string</TT>
354                         </TD>
355                         <TD>
356                                 Prefix each output file name with the given string.  This can be useful for encoding/decoding files to a different directory.  Make sure if your string is a path name that it ends with a trailing '<TT>/</TT>' slash.
357                         </TD>
358                 </TR>
359                 <TR>
360                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
361                                 <TT>--delete-input-file</TT>
362                         </TD>
363                         <TD>
364                                 Automatically delete the input file after a successful encode or decode.  If there was an error (including a verify error) the input file is left intact.
365                         </TD>
366                 </TR>
367                 <TR>
368                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
369                                 <TT>--skip={#|mm:ss.ss}</TT>
370                         </TD>
371                         <TD>
372                                 Skip over the first # of samples of the input.  This works for both encoding and decoding, but not testing.  The alternative form <TT>mm:ss.ss</TT> can be used to specify minutes, seconds, and fractions of a second.<P>
373                                 Examples:<P>
374                                 <TT>--skip=123</TT> : skip the first 123 samples of the input<P>
375                                 <TT>--skip=1:23.45</TT> : skip the first 1 minute and 23.45 seconds of the input
376                         </TD>
377                 </TR>
378                 <TR>
379                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
380                                 <TT>--until={#|[+|-]mm:ss.ss}</TT>
381                         </TD>
382                         <TD>
383                                 Stop at the given sample number for each input file.  This works for both encoding and decoding, but not testing.  The given sample number is not included in the decoded output.  The alternative form <TT>mm:ss.ss</TT> can be used to specify minutes, seconds, and fractions of a second.  If a <TT>+</TT> sign is at the beginning, the <TT>--until</TT> point is relative to the <TT>--skip</TT> point.  If a <TT>-</TT> sign is at the beginning, the <TT>--until</TT> point is relative to end of the audio.<P>
384                                 Examples:<P>
385                                 <TT>--until=123</TT> : decode only the first 123 samples of the input (samples 0-122, stopping at 123)<P>
386                                 <TT>--until=1:23.45</TT> : decode only the first 1 minute and 23.45 seconds of the input<P>
387                                 <TT>--skip=1:00 --until=+1:23.45</TT> : decode 1:00.00 to 2:23.45<P>
388                                 <TT>--until=-1:23.45</TT> : decode everything except the last 1 minute and 23.45 seconds<P>
389                                 <TT>--until=-0:00</TT> : decode until the end of the input (the same as not specifying <TT>--until</TT>)
390                         </TD>
391                 </TR>
392                 <TR>
393                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
394                                 <TT>--ogg</TT>
395                         </TD>
396                         <TD>
397                                 When encoding, generate Ogg-FLAC output instead of native-FLAC.  Ogg-FLAC streams are FLAC streams wrapped in an Ogg transport layer.  The resulting file should have an '.ogg' extension and will still be decodable by <TT><B>flac</B></TT>.<P>
398                                 When decoding, force the input to be treated as Ogg-FLAC.  This is useful when piping input from stdin or when the filename does not end in '.ogg'.
399                         </TD>
400                 </TR>
401                 <TR>
402                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
403                                 <TT>--serial-number=#</TT>
404                         </TD>
405                         <TD>
406                                 When used with --ogg, specifies the serial number to use the for the FLAC stream.  When encoding and no serial number is given, flac uses '0'.  When decoding and no number is given, flac uses the serial number of the first page.<P>
407                         </TD>
408                 </TR>
409         </TABLE>
410         </TD></TR></TABLE>
411         </P>
412         <P>
413         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
414         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
415                 <TR>
416                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
417                                 <A NAME="analysis_options"><FONT SIZE="+1"><B>Analysis Options</B></FONT></A>
418                         </TD>
419                 </TR>
420                 <TR>
421                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
422                                 <TT>--residual-text</TT>
423                         </TD>
424                         <TD>
425                                 Includes the residual signal in the analysis file.  This will make the file <B>very</B> big, much larger than even the decoded file.
426                         </TD>
427                 </TR>
428                 <TR>
429                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
430                                 <TT>--residual-gnuplot</TT>
431                         </TD>
432                         <TD>
433                                 Generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe.  This will create a <B>lot</B> of files.
434                         </TD>
435                 </TR>
436         </TABLE>
437         </TD></TR></TABLE>
438         </P>
439         <P>
440         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
441         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
442                 <TR>
443                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
444                                 <A NAME="decoding_options"><FONT SIZE="+1"><B>Decoding Options</B></FONT></A>
445                         </TD>
446                 </TR>
447                 <TR>
448                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
449                                 <TT>-F</TT>,<BR><TT>--decode-through-errors</TT>
450                         </TD>
451                         <TD>
452                                 By default <B><TT>flac</TT></B> stops decoding with an error and removes the partially decoded file if it encounters a bitstream error.  With <TT>-F</TT>, errors are still printed but <B><TT>flac</TT></B> will continue decoding to completion.  Note that errors may cause the decoded audio to be missing some samples or have silent sections.
453                         </TD>
454                 </TR>
455         </TABLE>
456         </TD></TR></TABLE>
457         </P>
458         <P>
459         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
460         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
461                 <TR>
462                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
463                                 <A NAME="encoding_options"><FONT SIZE="+1"><B>Encoding Options</B></FONT></A>
464                         </TD>
465                 </TR>
466                 <TR>
467                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
468                                 <TT>-V</TT>, <TT>--verify</TT>
469                         </TD>
470                         <TD>
471                                 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.
472                         </TD>
473                 </TR>
474                 <TR>
475                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
476                                 <TT>--lax</TT>
477                         </TD>
478                         <TD>
479                                 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.
480                         </TD>
481                 </TR>
482                 <TR>
483                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
484                                 <TT>--replay-gain</TT>
485                         </TD>
486                         <TD>
487                                 Calculate <A HREF="http://www.replaygain.org/">ReplayGain</A> values and store in Vorbis comments, similar to <A HREF="http://packages.qa.debian.org/v/vorbisgain.html">VorbisGain</A>.  Title gains/peaks will be computed for each input file, and an album gain/peak will be computed for all files.  All input files must have the same resolution, sample rate, and number of channels.  Only mono and stereo files are allowed, and the sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz.  Also note that this option may leave a few extra bytes in a PADDING block as the exact size of the tags is not known until all files are processed.<P>
488                                 Note that this option cannot be used when encoding to standard output (stdout).
489                         </TD>
490                 </TR>
491                 <TR>
492                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
493                                 <TT>--cuesheet=FILENAME</TT>
494                         </TD>
495                         <TD>
496                                 Import the given cuesheet file and store it in a <A HREF="format.html#def_CUESHEET">CUESHEET</A> metadata block.  This option may only be used when encoding a single file.  A seekpoint will be added for each index point in the cuesheet to the <A HREF="format.html#def_SEEKTABLE">SEEKTABLE</A> unless <TT>--no-cued-seekpoints</TT> is specified.<P>
497                                 The cuesheet file must be of the sort written by <A HREF="http://www.goldenhawk.com/cdrwin.htm">CDRwin</A>, <A HREF="http://www.dcsoft.com/prod03.htm">CDRcue</A>, <A HREF="http://www.exactaudiocopy.de/">EAC</A>, et al.
498                         </TD>
499                 </TR>
500                 <TR>
501                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
502                                 <TT>--sector-align</TT>
503                         </TD>
504                         <TD>
505                                 Align encoding of multiple CD format WAVE files on sector boundaries.  This option is only allowed when encoding WAVE files, all of which have a 44.1kHz sample rate and 2 channels.  With <TT>--sector-align</TT>, the encoder will align the resulting .flac streams so that their lengths are even multiples of a CD sector (1/75th of a second, or 588 samples).  It does this by carrying over any partial sector at the end of each WAVE file to the next stream.  The last stream will be padded to alignment with zeroes.<P>
506                                 This option will have no effect if the files are already aligned (as is the normally the case with WAVE files ripped from a CD).  <TT><B>flac</B></TT> can only align a set of files given in one invocation of <TT><B>flac</B></TT>.<P>
507                                 <B>WARNING:</B> The ordering of files is important!  If you give a command like '<TT>flac --sector-align *.wav</TT>' the shell may not expand the wildcard to the order you expect.  To be safe you should '<TT>echo *.wav</TT>' first to confirm the order, or be explicit like '<TT>flac --sector-align 8.wav 9.wav 10.wav</TT>'.
508                         </TD>
509                 </TR>
510                 <TR>
511                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
512                                 <TT>-S {#|X|#x|#s}</TT>,<BR><TT>--seekpoint={#|X|#x|#s}</TT>
513                         </TD>
514                         <TD>
515                                 Include a point or points in a SEEKTABLE:<BR>
516                                 <UL>
517                                 <LI>
518                                         <TT>#&nbsp;</TT> : a specific sample number for a seek point
519                                 </LI>
520                                 <LI>
521                                         <TT>X&nbsp;</TT> : a placeholder point (always goes at the end of the SEEKTABLE)
522                                 </LI>
523                                 <LI>
524                                         <TT>#x</TT> : # evenly spaced seekpoints, the first being at sample 0
525                                 </LI>
526                                 <LI>
527                                         <TT>#s</TT> : a seekpoint every # seconds; # does not have to be a whole number, it can be, for example, <TT>9.5</TT>, meaning a seekpoint every 9.5 seconds
528                                 </LI>
529                                 </UL>
530                                 You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values.<BR>
531                                 With no -S options, flac defaults to '-S 10s'.  Use --no-seektable for no SEEKTABLE.<BR>
532                                 <B>NOTE:</B> -S #x and -S #s will not work if the encoder can't determine the input size before starting.<BR>
533                                 <B>NOTE:</B> if you use -S # and # is &gt;= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable).<BR>
534                         </TD>
535                 </TR>
536                 <TR>
537                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
538                                 <TT>-P #</TT>, <TT>--padding=#</TT>
539                         </TD>
540                         <TD>
541                                 Tell the encoder to write a <TT>PADDING</TT> metadata block of the given length (in bytes) after the <TT>STREAMINFO</TT> block.  This is useful if you plan to tag the file later with an <TT>APPLICATION</TT> block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the <TT>PADDING</TT> block.  Note that the total length of the <TT>PADDING</TT> block will be 4 bytes longer than the length given because of the 4 metadata block header bytes.  You can force no <TT>PADDING</TT> block at all to be written with <TT>--no-padding</TT>, which is the default.
542                         </TD>
543                 </TR>
544                 <TR>
545                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
546                                 <TT>-T FIELD=VALUE</TT>, <TT>--tag=FIELD=VALUE</TT>
547                         </TD>
548                         <TD>
549                                 Add a Vorbis comment.  The comment must adhere to the Vorbis comment spec; i.e. the FIELD must contain only legal characters, terminated by an 'equals' sign.  Make sure to quote the comment if necessary.  This option may appear more than once to add several comments.  NOTE: all tags will be added to all encoded files.
550                         </TD>
551                 </TR>
552                 <TR>
553                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
554                                 <TT>-b #</TT>, <TT>--blocksize=#</TT>
555                         </TD>
556                         <TD>
557                                 Specify the block size in samples.  The default is 1152 for -l 0, otherwise 4608.  Subset streams must use one of 192/576/1152/2304/4608/256/512/1024/2048/4096/8192/16384/32768.  The reference encoder uses the same block size for the entire stream.
558                         </TD>
559                 </TR>
560                 <TR>
561                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
562                                 <TT>-m</TT>, <TT>--mid-side</TT>
563                         </TD>
564                         <TD>
565                                 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 &lt;= 16.
566                         </TD>
567                 </TR>
568                 <TR>
569                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
570                                 <TT>-M</TT>, <TT>--adaptive-mid-side</TT>
571                         </TD>
572                         <TD>
573                                 Enable adaptive mid-side coding (only for stereo streams).  Like <TT>-m</TT> but the encoder adaptively switches between independent and mid-side coding, which is faster but yields less compression than <TT>-m</TT> (which does an exhaustive search).
574                         </TD>
575                 </TR>
576                 <TR>
577                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
578                                 <TT>-0 .. -8</TT>
579                         </TD>
580                         <TD>
581                                 Fastest compression .. highest compression.  The default is <TT>-5</TT>.
582                         </TD>
583                 </TR>
584                 <TR>
585                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
586                                 <TT>-0</TT>, <TT>--compression-level-0</TT>
587                         </TD>
588                         <TD>
589                                 Synonymous with <TT>-l 0 -b 1152 -r 2,2</TT>
590                         </TD>
591                 </TR>
592                 <TR>
593                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
594                                 <TT>-1</TT>, <TT>--compression-level-1</TT>
595                         </TD>
596                         <TD>
597                                 Synonymous with <TT>-l 0 -b 1152 -M -r 2,2</TT>
598                         </TD>
599                 </TR>
600                 <TR>
601                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
602                                 <TT>-2</TT>, <TT>--compression-level-2</TT>
603                         </TD>
604                         <TD>
605                                 Synonymous with <TT>-l 0 -b 1152 -m -r 3</TT>
606                         </TD>
607                 </TR>
608                 <TR>
609                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
610                                 <TT>-3</TT>, <TT>--compression-level-3</TT>
611                         </TD>
612                         <TD>
613                                 Synonymous with <TT>-l 6 -b 4608 -r 3,3</TT>
614                         </TD>
615                 </TR>
616                 <TR>
617                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
618                                 <TT>-4</TT>, <TT>--compression-level-4</TT>
619                         </TD>
620                         <TD>
621                                 Synonymous with <TT>-l 8 -b 4608 -M -r 3,3</TT>
622                         </TD>
623                 </TR>
624                 <TR>
625                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
626                                 <TT>-5</TT>, <TT>--compression-level-5</TT>
627                         </TD>
628                         <TD>
629                                 Synonymous with <TT>-l 8 -b 4608 -m -r 3,3</TT>
630                         </TD>
631                 </TR>
632                 <TR>
633                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
634                                 <TT>-6</TT>, <TT>--compression-level-6</TT>
635                         </TD>
636                         <TD>
637                                 Synonymous with <TT>-l 8 -b 4608 -m -r 4</TT>
638                         </TD>
639                 </TR>
640                 <TR>
641                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
642                                 <TT>-7</TT>, <TT>--compression-level-7</TT>
643                         </TD>
644                         <TD>
645                                 Synonymous with <TT>-l 8 -b 4608 -m -e -r 6</TT>
646                         </TD>
647                 </TR>
648                 <TR>
649                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
650                                 <TT>-8</TT>, <TT>--compression-level-8</TT>
651                         </TD>
652                         <TD>
653                                 Synonymous with <TT>-l 12 -b 4608 -m -e -r 6</TT>
654                         </TD>
655                 </TR>
656                 <TR>
657                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
658                                 <TT>--fast</TT>
659                         </TD>
660                         <TD>
661                                 Fastest compression.  Currently synonymous with <TT>-0</TT>
662                         </TD>
663                 </TR>
664                 <TR>
665                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
666                                 <TT>--best</TT>
667                         </TD>
668                         <TD>
669                                 Highest compression.  Currently synonymous with <TT>-8</TT>
670                         </TD>
671                 </TR>
672                 <TR>
673                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
674                                 <TT>-e</TT>,<BR><TT>--exhaustive-model-search</TT>
675                         </TD>
676                         <TD>
677                                 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%.
678                         </TD>
679                 </TR>
680                 <TR>
681                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
682                                 <TT>-l #</TT>, <TT>--max-lpc-order=#</TT>
683                         </TD>
684                         <TD>
685                                 Specifies the maximum LPC order.  This number must be &lt;= 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.
686                         </TD>
687                 </TR>
688                 <TR>
689                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
690                                 <TT>-q #</TT>,<BR><TT>--qlp-coeff-precision=#</TT>
691                         </TD>
692                         <TD>
693                                 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.
694                         </TD>
695                 </TR>
696                 <TR>
697                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
698                                 <TT>-p</TT>,<BR><TT>--qlp-coeff-precision-search</TT>
699                         </TD>
700                         <TD>
701                                 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.  <B><TT>-q</TT></B> has no effect when <B><TT>-l 0</TT></B> is used.
702                         </TD>
703                 </TR>
704                 <TR>
705                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
706                                 <TT>-r [#,]#</TT>,<BR><TT>--rice-partition-order=[#,]#</TT>
707                         </TD>
708                         <TD>
709                                 Set the [min,]max residual partition order.  The min value defaults to 0 if unspecified.<P>
710                                 By default the encoder uses a single Rice parameter for the subframe's entire residual.  With this option, the residual is iteratively partitioned into 2^min# .. 2^max# pieces, each with its own Rice parameter.  Higher values of max# yield diminishing returns.  The most bang for the buck is usually with <B><TT>-r 2,2</TT></B> (more for higher block sizes).  This usually shaves off about 1.5%.  The technique tends to peak out about when blocksize/(2^n)=128.  Use <B><TT>-r 0,16</TT></B> to force the highest degree of optimization.
711                         </TD>
712                 </TR>
713         </TABLE>
714         </TD></TR></TABLE>
715         </P>
716         <P>
717         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
718         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
719                 <TR>
720                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
721                                 <A NAME="format_options"><FONT SIZE="+1"><B>Format Options</B></FONT></A>
722                         </TD>
723                 </TR>
724                 <TR>
725                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
726                                 <TT>--endian={big|little}</TT>
727                         </TD>
728                         <TD>
729                                 Specify big-endian or little-endian byte order in the raw file.
730                         </TD>
731                 </TR>
732                 <TR>
733                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
734                                 <TT>--channels=#</TT>
735                         </TD>
736                         <TD>
737                                 Specify the number of channels in the raw file.
738                         </TD>
739                 </TR>
740                 <TR>
741                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
742                                 <TT>--bps=#</TT>
743                         </TD>
744                         <TD>
745                                 Specify the number of bits per sample in the raw file.
746                         </TD>
747                 </TR>
748                 <TR>
749                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
750                                 <TT>--sample-rate=#</TT>
751                         </TD>
752                         <TD>
753                                 Specify the sample rate of the raw file.
754                         </TD>
755                 </TR>
756                 <TR>
757                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
758                                 <TT>--sign={signed|unsigned}</TT>
759                         </TD>
760                         <TD>
761                                 Specify that the samples in the raw file are signed or unsigned (the default is signed).
762                         </TD>
763                 </TR>
764                 <TR>
765                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
766                                 <TT>--force-aiff-format</TT>
767                         </TD>
768                         <TD>
769                                 Force the decoder to output AIFF format.  This option is not needed if the output filename (as set by -o) ends with .aiff.  Also, this option has no effect when encoding since input AIFF is auto-detected.
770                         </TD>
771                 </TR>
772                 <TR>
773                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
774                                 <TT>--force-raw-format</TT>
775                         </TD>
776                         <TD>
777                                 Treat the input file (or output file if decoding) as a raw file, regardless of the extension.
778                         </TD>
779                 </TR>
780         </TABLE>
781         </TD></TR></TABLE>
782         </P>
783         <P>
784         <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
785         <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
786                 <TR>
787                         <TD COLSPAN="2" BGCOLOR="#D3D4C5">
788                                 <A NAME="format_options"><FONT SIZE="+1"><B>Negative Options</B></FONT></A>
789                         </TD>
790                 </TR>
791                 <TR>
792                         <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
793                                 <TT>--no-adaptive-mid-side</TT><BR>
794                                 <TT>--no-decode-through-errors</TT><BR>
795                                 <TT>--no-delete-input-file</TT><BR>
796                                 <TT>--no-escape-coding</TT><BR>
797                                 <TT>--no-exhaustive-model-search</TT><BR>
798                                 <TT>--no-lax</TT><BR>
799                                 <TT>--no-mid-side</TT><BR>
800                                 <TT>--no-ogg</TT><BR>
801                                 <TT>--no-padding</TT><BR>
802                                 <TT>--no-qlp-coeff-precision-search</TT><BR>
803                                 <TT>--no-residual-gnuplot</TT><BR>
804                                 <TT>--no-residual-text</TT><BR>
805                                 <TT>--no-sector-align</TT><BR>
806                                 <TT>--no-seektable</TT><BR>
807                                 <TT>--no-silent</TT><BR>
808                                 <TT>--no-verify</TT>
809                         </TD>
810                         <TD>
811                                 can all be used to turn off a particular option.
812                         </TD>
813                 </TR>
814         </TABLE>
815         </TD></TR></TABLE>
816         </P>
817         </FONT>
818         </TD></TR>
819         </TABLE>
820         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
821 </TD></TR>
822 </TABLE>
823
824
825 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
826 <TR><TD>
827         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
828         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
829                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
830                 <A NAME="metaflac"><B><FONT SIZE="+2">metaflac</FONT></B>
831                 </FONT></TD></TR>
832         </TABLE>
833         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
834         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
835         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
836         <P>
837                 <B><TT>metaflac</TT></B> is the command-line <TT>.flac</TT> file metadata editor.  You can use it to list the contents of blocks, delete or insert blocks, and manage padding.
838         </P>
839         <P>
840                 The HTML documentation for <B><TT>metaflac</TT></B> is currently being rewritten, but the usage screen should explain it pretty well, and there is a man page.  Do <TT>metaflac --help</TT> to see the full usage.
841         </P>
842         </FONT>
843         </TD></TR>
844         </TABLE>
845         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
846 </TD></TR>
847 </TABLE>
848
849
850 <A NAME="plugins"></A>
851 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
852 <TR><TD>
853         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
854         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
855                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
856                 <A NAME="xmms_plugin"><B><FONT SIZE="+2">xmms plugin</FONT></B></A>
857                 </FONT></TD></TR>
858         </TABLE>
859         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
860         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
861         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
862         <P>
863                 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 <TT>.flac</TT> files.
864         </P>
865         </FONT>
866         </TD></TR>
867         </TABLE>
868         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
869 </TD></TR>
870 </TABLE>
871
872
873 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
874 <TR><TD>
875         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
876         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
877                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
878                 <A NAME="winamp2_plugin"><B><FONT SIZE="+2">winamp2 plugin</FONT></B>
879                 </FONT></TD></TR>
880         </TABLE>
881         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
882         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
883         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
884         <P>
885                 There are two Winamp plugins; one for Winamp versions 2.x and one for Winamp versions 3.x.  If you are using Winamp 2.x, 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 <TT>.flac</TT> files.
886         </P>
887         </FONT>
888         </TD></TR>
889         </TABLE>
890         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
891 </TD></TR>
892 </TABLE>
893
894
895 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
896 <TR><TD>
897         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
898         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
899                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
900                 <A NAME="winamp3_plugin"><B><FONT SIZE="+2">winamp3 plugin</FONT></B>
901                 </FONT></TD></TR>
902         </TABLE>
903         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
904         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
905         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
906         <P>
907                 There are two Winamp plugins; one for Winamp versions 2.x and one for Winamp versions 3.x.  If you are using Winamp 3.x, all that is necessary is to copy <B><TT>cnv_flacpcm.wac</TT></B> to the <B><TT>Wacs/</TT></B> directory of your Winamp installation.  There is nothing else to configure.  Make sure to restart Winamp before trying to play any <TT>.flac</TT> files.
908         </P>
909         </FONT>
910         </TD></TR>
911         </TABLE>
912         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
913 </TD></TR>
914 </TABLE>
915
916
917 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
918 <TR><TD>
919         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
920         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
921                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
922                 <A NAME="bugs"><B><FONT SIZE="+2">known bugs</FONT></B>
923                 </FONT></TD></TR>
924         </TABLE>
925         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
926         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
927         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
928         <P>
929                 Bug tracking is done on the Sourceforge project page <A HREF="http://sourceforge.net/bugs/?group_id=13478">here</A>.  If you submit a bug, make sure and provide an email contact or use the Monitor feature.
930         </P>
931         <P>
932                 The following are major known bugs in the current (1.0.4) release:
933         </P>
934         <P>
935                 <UL>
936                         <LI>
937                                 <B><TT>metaflac</TT></B> has a bug where, if --import-vc-from is used on a FLAC file that has no Vorbis comment block, the FLAC file can be corrupted.  All FLAC files generated by 1.0.4 have a Vorbis comment block added automatically but files from 1.0.3 and before do not.  This is fixed in CVS.
938                         </LI>
939                         <LI>
940                                 There is an odd bug in <B><TT>metaflac</TT></B> such that you must always use the <TT>--dont-use-padding</TT> option with <TT>--add-padding</TT> or the padding block won't be written.  This is fixed in CVS.
941                         </LI>
942                 </UL>
943         </P>
944         </FONT>
945         </TD></TR>
946         </TABLE>
947         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
948 </TD></TR>
949 </TABLE>
950
951
952 <TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
953 <TR><TD>
954         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
955         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
956                 <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
957                 <A NAME="monkey"><B><FONT SIZE="+2">monkey</FONT></B>
958                 </FONT></TD></TR>
959         </TABLE>
960         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
961         <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
962         <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
963         <P>
964                 Monkey's Audio comes with a nice GUI that many people are familiar with.  It supports some external encoders, but not FLAC.  However, the FLAC Windows distribution comes with a utility that allows you to replace one the of the supported lossless external codecs with FLAC.  Here's how:
965                 <UL>
966                         <LI>Copy <B><TT>flac.exe</TT></B> and <B><TT>flac_ren.exe</TT></B> to the <B><TT>External/</TT></B> directory of the Monkey's Audio installation.</LI>
967                         <LI>
968                                 Choose a supported encoder to replace:
969                                 <UL>
970                                         <LI>Shorten - copy <B><TT>flac_mac.exe</TT></B> on top of <B><TT>External/shortn32.exe</TT></B></LI>
971                                         <LI>WavPack - copy <B><TT>flac_mac.exe</TT></B> on top of both <B><TT>External/wavpack.exe</TT></B> and <B><TT>External/wvunpack.exe</TT></B></LI>
972                                         <LI>RKAU - copy <B><TT>flac_mac.exe</TT></B> on top of <B><TT>External/rkau.exe</TT></B></LI>
973                                 </UL>
974                                 If you choose WavPack you will also be able to use the WavPack Configuration menu to add flac options.
975                         </LI>
976                         <LI>Now you can encode FLAC files as if you were using the replaced encoder.  The renamed <B><TT>flac_mac.exe</TT></B> utility will call <B><TT>flac.exe</TT></B> and afterwards, <B><TT>flac_ren.exe</TT></B> will rename the resulting file to have the .flac extension.</LI>
977                 </UL>
978         </P>
979         <P>
980                 Other front-ends may be wedged in the same way; if you have one in mind, post it to the <A HREF="http://lists.sourceforge.net/lists/listinfo/flac-dev">flac-dev</A> mailing list.
981         </P>
982         </FONT>
983         </TD></TR>
984         </TABLE>
985         <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
986 </TD></TR>
987 </TABLE>
988
989
990 </CENTER>
991
992 <P>&nbsp;Copyright (c) 2000,2001,2002,2003 Josh Coalson</P>
993
994 </BODY>
995 </HTML>