1FLAC(1) FLAC(1)
2
3
4
6 flac - Free Lossless Audio Codec
7
9 flac [ OPTIONS ] [ infile.wav | infile.rf64 | infile.aiff | infile.raw
10 | infile.flac | 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 --preserve-modtime
88 Output files have their timestamps/permissions set to match
89 those of their inputs (this is default). Use --no-preserve-mod‐
90 time to make output files have the current time and default per‐
91 missions.
92
93 --keep-foreign-metadata
94 If encoding, save WAVE, RF64, or AIFF non-audio chunks in FLAC
95 metadata. If decoding, restore any saved non-audio chunks from
96 FLAC metadata when writing the decoded file. Foreign metadata
97 cannot be transcoded, e.g. WAVE chunks saved in a FLAC file can‐
98 not be restored when decoding to AIFF. Input and output must be
99 regular files (not stdin or stdout).
100
101 --skip={#|mm:ss.ss}
102 Skip over the first number of samples of the input. This works
103 for both encoding and decoding, but not testing. The alterna‐
104 tive form mm:ss.ss can be used to specify minutes, seconds, and
105 fractions of a second.
106
107 --until={#|[+|-]mm:ss.ss}
108 Stop at the given sample number for each input file. This works
109 for both encoding and decoding, but not testing. The given sam‐
110 ple number is not included in the decoded output. The alterna‐
111 tive form mm:ss.ss can be used to specify minutes, seconds, and
112 fractions of a second. If a `+' (plus) sign is at the begin‐
113 ning, the --until point is relative to the --skip point. If a
114 `-' (minus) sign is at the beginning, the --until point is rela‐
115 tive to end of the audio.
116
117 --ogg When encoding, generate Ogg FLAC output instead of native FLAC.
118 Ogg FLAC streams are FLAC streams wrapped in an Ogg transport
119 layer. The resulting file should have an '.oga' extension and
120 will still be decodable by flac.
121
122 When decoding, force the input to be treated as Ogg FLAC. This
123 is useful when piping input from stdin or when the filename does
124 not end in '.oga' or '.ogg'.
125
126 --serial-number=#
127 When used with --ogg, specifies the serial number to use for the
128 first Ogg FLAC stream, which is then incremented for each addi‐
129 tional stream. When encoding and no serial number is given,
130 flac uses a random number for the first stream, then increments
131 it for each additional stream. When decoding and no number is
132 given, flac uses the serial number of the first page.
133
134 ANALYSIS OPTIONS
135 --residual-text
136 Includes the residual signal in the analysis file. This will
137 make the file very big, much larger than even the decoded file.
138
139 --residual-gnuplot
140 Generates a gnuplot file for every subframe; each file will con‐
141 tain the residual distribution of the subframe. This will cre‐
142 ate a lot of files.
143
144 DECODING OPTIONS
145 --cue=[#.#][-[#.#]]
146 Set the beginning and ending cuepoints to decode. The optional
147 first #.# is the track and index point at which decoding will
148 start; the default is the beginning of the stream. The optional
149 second #.# is the track and index point at which decoding will
150 end; the default is the end of the stream. If the cuepoint does
151 not exist, the closest one before it (for the start point) or
152 after it (for the end point) will be used. If those don't
153 exist, the start of the stream (for the start point) or end of
154 the stream (for the end point) will be used. The cuepoints are
155 merely translated into sample numbers then used as --skip and
156 --until. A CD track can always be cued by, for example,
157 --cue=9.1-10.1 for track 9, even if the CD has no 10th track.
158
159 -F, --decode-through-errors
160 By default flac stops decoding with an error and removes the
161 partially decoded file if it encounters a bitstream error. With
162 -F, errors are still printed but flac will continue decoding to
163 completion. Note that errors may cause the decoded audio to be
164 missing some samples or have silent sections.
165
166 --apply-replaygain-which-is-not-lossless[=<specification>]
167 Applies ReplayGain values while decoding.
168
169 WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDEN‐
170 TICAL TO THE ORIGINAL WITH THIS OPTION.
171
172 The equals sign and <specification> is optional. If omitted,
173 the default is 0aLn1.
174
175 The <specification> is a shorthand notation for describing how
176 to apply ReplayGain. All components are optional but order is
177 important. '[]' means 'optional'. '|' means 'or'. '{}' means
178 required. The format is:
179
180 [<preamp>][a|t][l|L][n{0|1|2|3}]
181
182 preamp A floating point number in dB. This is added to the
183 existing gain value.
184
185 a|t Specify 'a' to use the album gain, or 't' to use the
186 track gain. If tags for the preferred kind (album/track)
187 do not exist but tags for the other (track/album) do,
188 those will be used instead.
189
190 l|L Specify 'l' to peak-limit the output, so that the Replay‐
191 Gain peak value is full-scale. Specify 'L' to use a 6dB
192 hard limiter that kicks in when the signal approaches
193 full-scale.
194
195 n{0|1|2|3}
196 Specify the amount of noise shaping. ReplayGain synthe‐
197 sis happens in floating point; the result is dithered
198 before converting back to integer. This quantization
199 adds noise. Noise shaping tries to move the noise where
200 you won't hear it as much. 0 means no noise shaping, 1
201 means 'low', 2 means 'medium', 3 means 'high'.
202
203 For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB
204 hard limit, low noise shaping.
205
206 --apply-replaygain-which-is-not-lossless=3 means 3dB preamp, use album
207 gain, no limiting, no noise shaping.
208
209 flac uses the ReplayGain tags for the calculation. If a stream does
210 not have the required tags or they can't be parsed, decoding will con‐
211 tinue with a warning, and no ReplayGain is applied to that stream.
212
213 ENCODING OPTIONS
214 -V, --verify
215 Verify a correct encoding by decoding the output in parallel and
216 comparing to the original
217
218 --lax Allow encoder to generate non-Subset files. The resulting FLAC
219 file may not be streamable or might have trouble being played in
220 all players (especially hardware devices), so you should only
221 use this option in combination with custom encoding options
222 meant for archival.
223
224 --replay-gain
225 Calculate ReplayGain values and store them as FLAC tags, similar
226 to vorbisgain. Title gains/peaks will be computed for each
227 input file, and an album gain/peak will be computed for all
228 files. All input files must have the same resolution, sample
229 rate, and number of channels. Only mono and stereo files are
230 allowed, and the sample rate must be one of 8, 11.025, 12, 16,
231 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may
232 leave a few extra bytes in a PADDING block as the exact size of
233 the tags is not known until all files are processed. Note that
234 this option cannot be used when encoding to standard output
235 (stdout).
236
237 --cuesheet=filename
238 Import the given cuesheet file and store it in a CUESHEET meta‐
239 data block. This option may only be used when encoding a single
240 file. A seekpoint will be added for each index point in the
241 cuesheet to the SEEKTABLE unless --no-cued-seekpoints is speci‐
242 fied.
243
244 --picture={FILENAME|SPECIFICATION}
245 Import a picture and store it in a PICTURE metadata block. More
246 than one --picture command can be specified. Either a filename
247 for the picture file or a more complete specification form can
248 be used. The SPECIFICATION is a string whose parts are sepa‐
249 rated by | (pipe) characters. Some parts may be left empty to
250 invoke default values. FILENAME is just shorthand for
251 "||||FILENAME". The format of SPECIFICATION is
252
253 [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COL‐
254 ORS]]|FILE
255
256 TYPE is optional; it is a number from one of:
257
258 0: Other
259
260 1: 32x32 pixels 'file icon' (PNG only)
261
262 2: Other file icon
263
264 3: Cover (front)
265
266 4: Cover (back)
267
268 5: Leaflet page
269
270 6: Media (e.g. label side of CD)
271
272 7: Lead artist/lead performer/soloist
273
274 8: Artist/performer
275
276 9: Conductor
277
278 10: Band/Orchestra
279
280 11: Composer
281
282 12: Lyricist/text writer
283
284 13: Recording Location
285
286 14: During recording
287
288 15: During performance
289
290 16: Movie/video screen capture
291
292 17: A bright coloured fish
293
294 18: Illustration
295
296 19: Band/artist logotype
297
298 20: Publisher/Studio logotype
299
300 The default is 3 (front cover). There may only be one picture
301 each of type 1 and 2 in a file.
302
303 MIME-TYPE is optional; if left blank, it will be detected from
304 the file. For best compatibility with players, use pictures
305 with MIME type image/jpeg or image/png. The MIME type can also
306 be --> to mean that FILE is actually a URL to an image, though
307 this use is discouraged.
308
309 DESCRIPTION is optional; the default is an empty string.
310
311 The next part specfies the resolution and color information. If
312 the MIME-TYPE is image/jpeg, image/png, or image/gif, you can
313 usually leave this empty and they can be detected from the file.
314 Otherwise, you must specify the width in pixels, height in pix‐
315 els, and color depth in bits-per-pixel. If the image has
316 indexed colors you should also specify the number of colors
317 used. When manually specified, it is not checked against the
318 file for accuracy.
319
320 FILE is the path to the picture file to be imported, or the URL
321 if MIME type is -->
322
323 For example, "|image/jpeg|||../cover.jpg" will embed the JPEG
324 file at ../cover.jpg, defaulting to type 3 (front cover) and an
325 empty description. The resolution and color info will be
326 retrieved from the file itself.
327
328 The specification
329 "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will
330 embed the given URL, with type 4 (back cover), description "CD",
331 and a manually specified resolution of 320x300, 24 bits-per-
332 pixel, and 173 colors. The file at the URL will not be fetched;
333 the URL itself is stored in the PICTURE metadata block.
334
335 --sector-align
336 Align encoding of multiple CD format files on sector boundaries.
337 See the HTML documentation for more information. This option is
338 DEPRECATED and may not exist in future versions of flac.
339
340 --ignore-chunk-sizes
341 When encoding to flac, ignore the file size headers in WAV and
342 AIFF files to attempt to work around problems with over-sized or
343 malformed files.
344
345 WAV and AIFF files both have an unsigned 32 bit numbers in the
346 file header which specifes the length of audio data. Since this
347 number is unsigned 32 bits, that limits the size of a valid file
348 to being just over 4 Gigabytes. Files larger than this are mal-
349 formed, but should be read correctly using this option.
350
351 -S {#|X|#x|#s}, --seekpoint={#|X|#x|#s}
352 Include a point or points in a SEEKTABLE. Using #, a seek point
353 at that sample number is added. Using X, a placeholder point is
354 added at the end of a the table. Using #x, # evenly spaced seek
355 points will be added, the first being at sample 0. Using #s, a
356 seekpoint will be added every # seconds (# does not have to be a
357 whole number; it can be, for example, 9.5, meaning a seekpoint
358 every 9.5 seconds). You may use many -S options; the resulting
359 SEEKTABLE will be the unique-ified union of all such values.
360 With no -S options, flac defaults to '-S 10s'. Use --no-seek‐
361 table for no SEEKTABLE. Note: '-S #x' and '-S #s' will not work
362 if the encoder can't determine the input size before starting.
363 Note: if you use '-S #' and # is >= samples in the input, there
364 will be either no seek point entered (if the input size is
365 determinable before encoding starts) or a placeholder point (if
366 input size is not determinable).
367
368 -P #, --padding=#
369 Tell the encoder to write a PADDING metadata block of the given
370 length (in bytes) after the STREAMINFO block. This is useful if
371 you plan to tag the file later with an APPLICATION block;
372 instead of having to rewrite the entire file later just to
373 insert your block, you can write directly over the PADDING
374 block. Note that the total length of the PADDING block will be
375 4 bytes longer than the length given because of the 4 metadata
376 block header bytes. You can force no PADDING block at all to be
377 written with --no-padding. The encoder writes a PADDING block
378 of 8192 bytes by default (or 65536 bytes if the input audio
379 stream is more that 20 minutes long).
380
381 -T FIELD=VALUE, --tag=FIELD=VALUE
382 Add a FLAC tag. The comment must adhere to the Vorbis comment
383 spec; i.e. the FIELD must contain only legal characters, termi‐
384 nated by an 'equals' sign. Make sure to quote the comment if
385 necessary. This option may appear more than once to add several
386 comments. NOTE: all tags will be added to all encoded files.
387
388 --tag-from-file=FIELD=FILENAME
389 Like --tag, except FILENAME is a file whose contents will be
390 read verbatim to set the tag value. The contents will be con‐
391 verted to UTF-8 from the local charset. This can be used to
392 store a cuesheet in a tag (e.g. --tag-from-
393 file="CUESHEET=image.cue"). Do not try to store binary data in
394 tag fields! Use APPLICATION blocks for that.
395
396 -b #, --blocksize=#
397 Specify the block size in samples. Subset streams must use one
398 of 192, 576, 1152, 2304, 4608, 256, 512, 1024, 2048, 4096 (and
399 8192 or 16384 if the sample rate is >48kHz).
400
401 -m, --mid-side
402 Try mid-side coding for each frame (stereo input only)
403
404 -M, --adaptive-mid-side
405 Adaptive mid-side coding for all frames (stereo input only)
406
407 -0..-8, --compression-level-0..--compression-level-8
408 Fastest compression..highest compression (default is -5). These
409 are synonyms for other options:
410
411 -0, --compression-level-0
412 Synonymous with -l 0 -b 1152 -r 3
413
414 -1, --compression-level-1
415 Synonymous with -l 0 -b 1152 -M -r 3
416
417 -2, --compression-level-2
418 Synonymous with -l 0 -b 1152 -m -r 3
419
420 -3, --compression-level-3
421 Synonymous with -l 6 -b 4096 -r 4
422
423 -4, --compression-level-4
424 Synonymous with -l 8 -b 4096 -M -r 4
425
426 -5, --compression-level-5
427 Synonymous with -l 8 -b 4096 -m -r 5
428
429 -6, --compression-level-6
430 Synonymous with -l 8 -b 4096 -m -r 6
431
432 -7, --compression-level-7
433 Synonymous with -l 8 -b 4096 -m -e -r 6
434
435 -8, --compression-level-8
436 Synonymous with -l 12 -b 4096 -m -e -r 6
437
438 --fast Fastest compression. Currently synonymous with -0.
439
440 --best Highest compression. Currently synonymous with -8.
441
442 -e, --exhaustive-model-search
443 Do exhaustive model search (expensive!)
444
445 -A function, --apodization=function
446 Window audio data with given the apodization function. The
447 functions are: bartlett, bartlett_hann, blackman, blackman_har‐
448 ris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann,
449 kaiser_bessel, nuttall, rectangle, triangle, tukey(P), welch.
450
451 For gauss(STDDEV), STDDEV is the standard deviation (0<STD‐
452 DEV<=0.5).
453
454 For tukey(P), P specifies the fraction of the window that is
455 tapered (0<=P<=1; P=0 corresponds to "rectangle" and P=1 corre‐
456 sponds to "hann").
457
458 More than one -A option (up to 32) may be used. Any function
459 that is specified erroneously is silently dropped. The encoder
460 chooses suitable defaults in the absence of any -A options; any
461 -A option specified replaces the default(s).
462
463 When more than one function is specified, then for every sub‐
464 frame the encoder will try each of them separately and choose
465 the window that results in the smallest compressed subframe.
466 Multiple functions can greatly increase the encoding time.
467
468 -l #, --max-lpc-order=#
469 Specifies the maximum LPC order. This number must be <= 32. For
470 Subset streams, it must be <=12 if the sample rate is <=48kHz.
471 If 0, the encoder will not attempt generic linear prediction,
472 and use only fixed predictors. Using fixed predictors is faster
473 but usually results in files being 5-10% larger.
474
475 -p, --qlp-coeff-precision-search
476 Do exhaustive search of LP coefficient quantization (expen‐
477 sive!). Overrides -q; does nothing if using -l 0
478
479 -q #, --qlp-coeff-precision=#
480 Precision of the quantized linear-predictor coefficients, 0 =>
481 let encoder decide (min is 5, default is 0)
482
483 -r [#,]#, --rice-partition-order=[#,]#
484 Set the [min,]max residual partition order (0..16). min defaults
485 to 0 if unspecified. Default is -r 5.
486
487 FORMAT OPTIONS
488 --endian={big|little}
489 Set the byte order for samples
490
491 --channels=#
492 Set number of channels.
493
494 --bps=#
495 Set bits per sample.
496
497 --sample-rate=#
498 Set sample rate (in Hz).
499
500 --sign={signed|unsigned}
501 Set the sign of samples (the default is signed).
502
503 --input-size=#
504 Specify the size of the raw input in bytes. If you are encoding
505 raw samples from stdin, you must set this option in order to be
506 able to use --skip, --until, --cuesheet, or other options that
507 need to know the size of the input beforehand. If the size
508 given is greater than what is found in the input stream, the
509 encoder will complain about an unexpected end-of-file. If the
510 size given is less, samples will be truncated.
511
512 --force-raw-format
513 Force input (when encoding) or output (when decoding) to be
514 treated as raw samples (even if filename ends in .wav).
515
516 --force-aiff-format
517 Force the decoder to output AIFF format. This option is not
518 needed if the output filename (as set by -o) ends with .aif or
519 .aiff. Also, this option has no effect when encoding since
520 input AIFF is auto-detected.
521
522 --force-rf64-format
523 Force the decoder to output RF64 format. This option is not
524 needed if the output filename (as set by -o) ends with .rf64.
525 Also, this option has no effect when encoding since input RF64
526 is auto-detected.
527
528 --force-wave64-format
529 Force the decoder to output Wave64 format. This option is not
530 needed if the output filename (as set by -o) ends with .w64.
531 Also, this option has no effect when encoding since input Wave64
532 is auto-detected.
533
534 NEGATIVE OPTIONS
535 --no-adaptive-mid-side
536
537 --no-cued-seekpoints
538
539 --no-decode-through-errors
540
541 --no-delete-input-file
542
543 --no-preserve-modtime
544
545 --no-keep-foreign-metadata
546
547 --no-exhaustive-model-search
548
549 --no-force
550
551 --no-lax
552
553 --no-mid-side
554
555 --no-ogg
556
557 --no-padding
558
559 --no-qlp-coeff-prec-search
560
561 --no-replay-gain
562
563 --no-residual-gnuplot
564
565 --no-residual-text
566
567 --no-sector-align
568
569 --no-seektable
570
571 --no-silent
572
573 --no-verify
574
575 --no-warnings-as-errors
576 These flags can be used to invert the sense of the corresponding
577 normal option.
578
580 metaflac(1).
581
582 The programs are documented fully by HTML format documentation, avail‐
583 able in /usr/share/doc/libflac-doc/html on Debian GNU/Linux systems.
584
586 This manual page was written by Matt Zimmerman <mdz@debian.org> for the
587 Debian GNU/Linux system (but may be used by others).
588
589
590
591 2013/04/30 FLAC(1)