1FLAC(1) FLAC(1)
2
3
4
6 flac - Free Lossless Audio Codec
7
9 flac [ OPTIONS ] [ infile.wav | infile.aiff | infile.raw | infile.flac
10 | infile.oga | infile.ogg | - ... ]
11
12
13 flac [ -d | --decode | -t | --test | -a | --analyze ] [ OPTIONS ] [
14 infile.flac | infile.oga | infile.ogg | - ... ]
15
16
18 flac is a command-line tool for encoding, decoding, testing and analyz‐
19 ing FLAC streams.
20
22 A summary of options is included below. For a complete description,
23 see the HTML documentation.
24
25 GENERAL OPTIONS
26 -v, --version
27 Show the flac version number
28
29 -h, --help
30 Show basic usage and a list of all options
31
32 -H, --explain
33 Show detailed explanation of usage and all options
34
35 -d, --decode
36 Decode (the default behavior is to encode)
37
38 -t, --test
39 Test a flac encoded file (same as -d except no decoded file is
40 written)
41
42 -a, --analyze
43 Analyze a FLAC encoded file (same as -d except an analysis file
44 is written)
45
46 -c, --stdout
47 Write output to stdout
48
49 -s, --silent
50 Silent mode (do not write runtime encode/decode statistics to
51 stderr)
52
53 --totally-silent
54 Do not print anything of any kind, including warnings or errors.
55 The exit code will be the only way to determine successful com‐
56 pletion.
57
58 --no-utf8-convert
59 Do not convert tags from local charset to UTF-8. This is useful
60 for scripts, and setting tags in situations where the locale is
61 wrong. This option must appear before any tag options!
62
63 -w, --warnings-as-errors
64 Treat all warnings as errors (which cause flac to terminate with
65 a non-zero exit code).
66
67 -f, --force
68 Force overwriting of output files. By default, flac warns that
69 the output file already exists and continues to the next file.
70
71 -o filename, --output-name=filename
72 Force the output file name (usually flac just changes the exten‐
73 sion). May only be used when encoding a single file. May not
74 be used in conjunction with --output-prefix.
75
76 --output-prefix=string
77 Prefix each output file name with the given string. This can be
78 useful for encoding or decoding files to a different directory.
79 Make sure if your string is a path name that it ends with a
80 trailing `/' (slash).
81
82 --delete-input-file
83 Automatically delete the input file after a successful encode or
84 decode. If there was an error (including a verify error) the
85 input file is left intact.
86
87 --keep-foreign-metadata
88 If encoding, save WAVE or AIFF non-audio chunks in FLAC meta‐
89 data. If decoding, restore any saved non-audio chunks from FLAC
90 metadata when writing the decoded file. Foreign metadata cannot
91 be transcoded, e.g. WAVE chunks saved in a FLAC file cannot be
92 restored when decoding to AIFF. Input and output must be regu‐
93 lar files (not stdin or stdout).
94
95 --skip={#|mm:ss.ss}
96 Skip over the first number of samples of the input. This works
97 for both encoding and decoding, but not testing. The alterna‐
98 tive form mm:ss.ss can be used to specify minutes, seconds, and
99 fractions of a second.
100
101 --until={#|[+|-]mm:ss.ss}
102 Stop at the given sample number for each input file. This works
103 for both encoding and decoding, but not testing. The given sam‐
104 ple number is not included in the decoded output. The alterna‐
105 tive form mm:ss.ss can be used to specify minutes, seconds, and
106 fractions of a second. If a `+' (plus) sign is at the begin‐
107 ning, the --until point is relative to the --skip point. If a
108 `-' (minus) sign is at the beginning, the --until point is rela‐
109 tive to end of the audio.
110
111 --ogg When encoding, generate Ogg FLAC output instead of native FLAC.
112 Ogg FLAC streams are FLAC streams wrapped in an Ogg transport
113 layer. The resulting file should have an '.oga' extension and
114 will still be decodable by flac.
115
116 When decoding, force the input to be treated as Ogg FLAC. This
117 is useful when piping input from stdin or when the filename does
118 not end in '.oga' or '.ogg'.
119
120 --serial-number=#
121 When used with --ogg, specifies the serial number to use for the
122 first Ogg FLAC stream, which is then incremented for each addi‐
123 tional stream. When encoding and no serial number is given,
124 flac uses a random number for the first stream, then increments
125 it for each additional stream. When decoding and no number is
126 given, flac uses the serial number of the first page.
127
128 ANALYSIS OPTIONS
129 --residual-text
130 Includes the residual signal in the analysis file. This will
131 make the file very big, much larger than even the decoded file.
132
133 --residual-gnuplot
134 Generates a gnuplot file for every subframe; each file will con‐
135 tain the residual distribution of the subframe. This will cre‐
136 ate a lot of files.
137
138 DECODING OPTIONS
139 --cue=[#.#][-[#.#]]
140 Set the beginning and ending cuepoints to decode. The optional
141 first #.# is the track and index point at which decoding will
142 start; the default is the beginning of the stream. The optional
143 second #.# is the track and index point at which decoding will
144 end; the default is the end of the stream. If the cuepoint does
145 not exist, the closest one before it (for the start point) or
146 after it (for the end point) will be used. If those don't
147 exist, the start of the stream (for the start point) or end of
148 the stream (for the end point) will be used. The cuepoints are
149 merely translated into sample numbers then used as --skip and
150 --until. A CD track can always be cued by, for example,
151 --cue=9.1-10.1 for track 9, even if the CD has no 10th track.
152
153 -F, --decode-through-errors
154 By default flac stops decoding with an error and removes the
155 partially decoded file if it encounters a bitstream error. With
156 -F, errors are still printed but flac will continue decoding to
157 completion. Note that errors may cause the decoded audio to be
158 missing some samples or have silent sections.
159
160 ENCODING OPTIONS
161 -V, --verify
162 Verify a correct encoding by decoding the output in parallel and
163 comparing to the original
164
165 --lax Allow encoder to generate non-Subset files. The resulting FLAC
166 file may not be streamable or might have trouble being played in
167 all players (especially hardware devices), so you should only
168 use this option in combination with custom encoding options
169 meant for archival.
170
171 --replay-gain
172 Calculate ReplayGain values and store them as FLAC tags, similar
173 to vorbisgain. Title gains/peaks will be computed for each
174 input file, and an album gain/peak will be computed for all
175 files. All input files must have the same resolution, sample
176 rate, and number of channels. Only mono and stereo files are
177 allowed, and the sample rate must be one of 8, 11.025, 12, 16,
178 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may
179 leave a few extra bytes in a PADDING block as the exact size of
180 the tags is not known until all files are processed. Note that
181 this option cannot be used when encoding to standard output
182 (stdout).
183
184 --cuesheet=filename
185 Import the given cuesheet file and store it in a CUESHEET meta‐
186 data block. This option may only be used when encoding a single
187 file. A seekpoint will be added for each index point in the
188 cuesheet to the SEEKTABLE unless --no-cued-seekpoints is speci‐
189 fied.
190
191 --picture={FILENAME|SPECIFICATION}
192 Import a picture and store it in a PICTURE metadata block. More
193 than one --picture command can be specified. Either a filename
194 for the picture file or a more complete specification form can
195 be used. The SPECIFICATION is a string whose parts are sepa‐
196 rated by | (pipe) characters. Some parts may be left empty to
197 invoke default values. FILENAME is just shorthand for
198 "||||FILENAME". The format of SPECIFICATION is
199
200 [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COL‐
201 ORS]]|FILE
202
203 TYPE is optional; it is a number from one of:
204
205 0: Other
206
207 1: 32x32 pixels 'file icon' (PNG only)
208
209 2: Other file icon
210
211 3: Cover (front)
212
213 4: Cover (back)
214
215 5: Leaflet page
216
217 6: Media (e.g. label side of CD)
218
219 7: Lead artist/lead performer/soloist
220
221 8: Artist/performer
222
223 9: Conductor
224
225 10: Band/Orchestra
226
227 11: Composer
228
229 12: Lyricist/text writer
230
231 13: Recording Location
232
233 14: During recording
234
235 15: During performance
236
237 16: Movie/video screen capture
238
239 17: A bright coloured fish
240
241 18: Illustration
242
243 19: Band/artist logotype
244
245 20: Publisher/Studio logotype
246
247 The default is 3 (front cover). There may only be one picture
248 each of type 1 and 2 in a file.
249
250 MIME-TYPE is optional; if left blank, it will be detected from
251 the file. For best compatibility with players, use pictures
252 with MIME type image/jpeg or image/png. The MIME type can also
253 be --> to mean that FILE is actually a URL to an image, though
254 this use is discouraged.
255
256 DESCRIPTION is optional; the default is an empty string.
257
258 The next part specfies the resolution and color information. If
259 the MIME-TYPE is image/jpeg, image/png, or image/gif, you can
260 usually leave this empty and they can be detected from the file.
261 Otherwise, you must specify the width in pixels, height in pix‐
262 els, and color depth in bits-per-pixel. If the image has
263 indexed colors you should also specify the number of colors
264 used. When manually specified, it is not checked against the
265 file for accuracy.
266
267 FILE is the path to the picture file to be imported, or the URL
268 if MIME type is -->
269
270 For example, "|image/jpeg|||../cover.jpg" will embed the JPEG
271 file at ../cover.jpg, defaulting to type 3 (front cover) and an
272 empty description. The resolution and color info will be
273 retrieved from the file itself.
274
275 The specification
276 "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will
277 embed the given URL, with type 4 (back cover), description "CD",
278 and a manually specified resolution of 320x300, 24 bits-per-
279 pixel, and 173 colors. The file at the URL will not be fetched;
280 the URL itself is stored in the PICTURE metadata block.
281
282 --sector-align
283 Align encoding of multiple CD format files on sector boundaries.
284 See the HTML documentation for more information.
285
286 -S {#|X|#x|#s}, --seekpoint={#|X|#x|#s}
287 Include a point or points in a SEEKTABLE. Using #, a seek point
288 at that sample number is added. Using X, a placeholder point is
289 added at the end of a the table. Using #x, # evenly spaced seek
290 points will be added, the first being at sample 0. Using #s, a
291 seekpoint will be added every # seconds (# does not have to be a
292 whole number; it can be, for example, 9.5, meaning a seekpoint
293 every 9.5 seconds). You may use many -S options; the resulting
294 SEEKTABLE will be the unique-ified union of all such values.
295 With no -S options, flac defaults to '-S 10s'. Use --no-seek‐
296 table for no SEEKTABLE. Note: '-S #x' and '-S #s' will not work
297 if the encoder can't determine the input size before starting.
298 Note: if you use '-S #' and # is >= samples in the input, there
299 will be either no seek point entered (if the input size is
300 determinable before encoding starts) or a placeholder point (if
301 input size is not determinable).
302
303 -P #, --padding=#
304 Tell the encoder to write a PADDING metadata block of the given
305 length (in bytes) after the STREAMINFO block. This is useful if
306 you plan to tag the file later with an APPLICATION block;
307 instead of having to rewrite the entire file later just to
308 insert your block, you can write directly over the PADDING
309 block. Note that the total length of the PADDING block will be
310 4 bytes longer than the length given because of the 4 metadata
311 block header bytes. You can force no PADDING block at all to be
312 written with --no-padding. The encoder writes a PADDING block
313 of 8192 bytes by default (or 65536 bytes if the input audio
314 stream is more that 20 minutes long).
315
316 -T FIELD=VALUE, --tag=FIELD=VALUE
317 Add a FLAC tag. The comment must adhere to the Vorbis comment
318 spec; i.e. the FIELD must contain only legal characters, termi‐
319 nated by an 'equals' sign. Make sure to quote the comment if
320 necessary. This option may appear more than once to add several
321 comments. NOTE: all tags will be added to all encoded files.
322
323 --tag-from-file=FIELD=FILENAME
324 Like --tag, except FILENAME is a file whose contents will be
325 read verbatim to set the tag value. The contents will be con‐
326 verted to UTF-8 from the local charset. This can be used to
327 store a cuesheet in a tag (e.g. --tag-from-
328 file="CUESHEET=image.cue"). Do not try to store binary data in
329 tag fields! Use APPLICATION blocks for that.
330
331 -b #, --blocksize=#
332 Specify the block size in samples. Subset streams must use one
333 of 192, 576, 1152, 2304, 4608, 256, 512, 1024, 2048, 4096 (and
334 8192 or 16384 if the sample rate is >48kHz).
335
336 -m, --mid-side
337 Try mid-side coding for each frame (stereo input only)
338
339 -M, --adaptive-mid-side
340 Adaptive mid-side coding for all frames (stereo input only)
341
342 -0..-8, --compression-level-0..--compression-level-8
343 Fastest compression..highest compression (default is -5). These
344 are synonyms for other options:
345
346 -0, --compression-level-0
347 Synonymous with -l 0 -b 1152 -r 3
348
349 -1, --compression-level-1
350 Synonymous with -l 0 -b 1152 -M -r 3
351
352 -2, --compression-level-2
353 Synonymous with -l 0 -b 1152 -m -r 3
354
355 -3, --compression-level-3
356 Synonymous with -l 6 -b 4096 -r 4
357
358 -4, --compression-level-4
359 Synonymous with -l 8 -b 4096 -M -r 4
360
361 -5, --compression-level-5
362 Synonymous with -l 8 -b 4096 -m -r 5
363
364 -6, --compression-level-6
365 Synonymous with -l 8 -b 4096 -m -r 6
366
367 -7, --compression-level-7
368 Synonymous with -l 8 -b 4096 -m -e -r 6
369
370 -8, --compression-level-8
371 Synonymous with -l 12 -b 4096 -m -e -r 6
372
373 --fast Fastest compression. Currently synonymous with -0.
374
375 --best Highest compression. Currently synonymous with -8.
376
377 -e, --exhaustive-model-search
378 Do exhaustive model search (expensive!)
379
380 -A function, --apodization=function
381 Window audio data with given the apodization function. The
382 functions are: bartlett, bartlett_hann, blackman, blackman_har‐
383 ris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann,
384 kaiser_bessel, nuttall, rectangle, triangle, tukey(P), welch.
385
386 For gauss(STDDEV), STDDEV is the standard deviation (0<STD‐
387 DEV<=0.5).
388
389 For tukey(P), P specifies the fraction of the window that is
390 tapered (0<=P<=1; P=0 corresponds to "rectangle" and P=1 corre‐
391 sponds to "hann").
392
393 More than one -A option (up to 32) may be used. Any function
394 that is specified erroneously is silently dropped. The encoder
395 chooses suitable defaults in the absence of any -A options; any
396 -A option specified replaces the default(s).
397
398 When more than one function is specified, then for every sub‐
399 frame the encoder will try each of them separately and choose
400 the window that results in the smallest compressed subframe.
401 Multiple functions can greatly increase the encoding time.
402
403 -l #, --max-lpc-order=#
404 Specifies the maximum LPC order. This number must be <= 32. For
405 Subset streams, it must be <=12 if the sample rate is <=48kHz.
406 If 0, the encoder will not attempt generic linear prediction,
407 and use only fixed predictors. Using fixed predictors is faster
408 but usually results in files being 5-10% larger.
409
410 -p, --qlp-coeff-precision-search
411 Do exhaustive search of LP coefficient quantization (expen‐
412 sive!). Overrides -q; does nothing if using -l 0
413
414 -q #, --qlp-coeff-precision=#
415 Precision of the quantized linear-predictor coefficients, 0 =>
416 let encoder decide (min is 5, default is 0)
417
418 -r [#,]#, --rice-partition-order=[#,]#
419 Set the [min,]max residual partition order (0..16). min defaults
420 to 0 if unspecified. Default is -r 5.
421
422 FORMAT OPTIONS
423 --endian={big|little}
424 Set the byte order for samples
425
426 --channels=#
427 Set number of channels.
428
429 --bps=#
430 Set bits per sample.
431
432 --sample-rate=#
433 Set sample rate (in Hz).
434
435 --sign={signed|unsigned}
436 Set the sign of samples (the default is signed).
437
438 --input-size=#
439 Specify the size of the raw input in bytes. If you are encoding
440 raw samples from stdin, you must set this option in order to be
441 able to use --skip, --until, --cue-sheet, or other options that
442 need to know the size of the input beforehand. If the size
443 given is greater than what is found in the input stream, the
444 encoder will complain about an unexpected end-of-file. If the
445 size given is less, samples will be truncated.
446
447 --force-aiff-format
448 Force the decoder to output AIFF format. This option is not
449 needed if the output filename (as set by -o) ends with .aiff.
450 Also, this option has no effect when encoding since input AIFF
451 is auto-detected.
452
453 --force-raw-format
454 Force input (when encoding) or output (when decoding) to be
455 treated as raw samples (even if filename ends in .wav).
456
457 NEGATIVE OPTIONS
458 --no-adaptive-mid-side
459
460 --no-decode-through-errors
461
462 --no-delete-input-file
463
464 --no-exhaustive-model-search
465
466 --no-lax
467
468 --no-mid-side
469
470 --no-ogg
471
472 --no-padding
473
474 --no-qlp-coeff-precision-search
475
476 --no-residual-gnuplot
477
478 --no-residual-text
479
480 --no-sector-align
481
482 --no-seektable
483
484 --no-silent
485
486 --no-verify
487
488 --no-warnings-as-errors
489 These flags can be used to invert the sense of the corresponding
490 normal option.
491
493 metaflac(1).
494
495 The programs are documented fully by HTML format documentation, avail‐
496 able in /usr/share/doc/flac/html on Debian GNU/Linux systems.
497
499 This manual page was written by Matt Zimmerman <mdz@debian.org> for the
500 Debian GNU/Linux system (but may be used by others).
501
502
503
504 14 September 2007 FLAC(1)