xref: /aosp_15_r20/external/flac/man/flac.md (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1% flac(1) Version 1.4.3 | Free Lossless Audio Codec conversion tool
2
3# NAME
4
5flac - Free Lossless Audio Codec
6
7# SYNOPSIS
8
9**flac** \[ *OPTIONS* \] \[ *infile.wav* \| *infile.rf64* \|
10*infile.aiff* \| *infile.raw* \| *infile.flac* \| *infile.oga* \|
11*infile.ogg* \| **-** *...* \]
12
13**flac** \[ **-d** \| **\--decode** \| **-t** \| **\--test** \| **-a** \|
14**\--analyze** \] \[ *OPTIONS* \] \[ *infile.flac* \| *infile.oga* \|
15*infile.ogg* \| **-** *...* \]
16
17# DESCRIPTION
18
19**flac** is a command-line tool for encoding, decoding, testing and
20analyzing FLAC streams.
21
22# GENERAL USAGE
23
24**flac** supports as input RIFF WAVE, Wave64, RF64, AIFF, FLAC or Ogg
25FLAC format, or raw interleaved samples. The decoder currently can output
26to RIFF WAVE, Wave64, RF64, or AIFF format, or raw interleaved samples.
27flac only supports linear PCM samples (in other words, no A-LAW, uLAW,
28etc.), and the input must be between 4 and 32 bits per sample.
29
30flac assumes that files ending in ".wav" or that have the RIFF WAVE
31header present are WAVE files, files ending in ".w64" or have the Wave64
32header present are Wave64 files, files ending in ".rf64" or have the
33RF64 header present are RF64 files, files ending in ".aif" or ".aiff" or
34have the AIFF header present are AIFF files, files ending in ".flac"
35or have the FLAC header present are FLAC files and files ending in ".oga"
36or ".ogg" or have the Ogg FLAC header present are Ogg FLAC files.
37
38Other than this, flac makes no assumptions about file extensions, though
39the convention is that FLAC files have the extension ".flac"
40(or ".fla" on ancient "8.3" file systems like FAT-16).
41
42Before going into the full command-line description, a few other things
43help to sort it out:
441. flac encodes by default, so you must use -d to decode
452. the options -0 .. -8 (or --fast and --best) that control the
46   compression level actually are just synonyms for different groups of
47   specific encoding options (described later) and you can get the same
48   effect by using the same options. When specific options are specified
49   they take priority over the compression level no matter the order
503. flac behaves similarly to gzip in the way it handles input and output
51   files
524. the order in which options are specified is generally not important
53
54Skip to the examples below for examples of some common tasks.
55
56flac will be invoked one of four ways, depending on whether you are
57encoding, decoding, testing, or analyzing. Encoding is the default
58invocation, but can be switch to decoding with **-d**, analysis with
59**-a** or testing with **-t**. Depending on which way is chosen,
60encoding, decoding, analysis or testing options can be used, see section
61OPTIONS for details. General options can be used for all.
62
63If only one inputfile is specified, it may be "-" for stdin. When stdin
64is used as input, flac will write to stdout. Otherwise flac will perform
65the desired operation on each input file to similarly named output files
66(meaning for encoding, the extension will be replaced with ".flac", or
67appended with ".flac" if the input file has no extension, and for
68decoding, the extension will be ".wav" for WAVE output and ".raw" for raw
69output). The original file is not deleted unless --delete-input-file is
70specified.
71
72If you are encoding/decoding from stdin to a file, you should use the -o
73option like so:
74
75    flac [options] -o outputfile
76    flac -d [options] -o outputfile
77
78which are better than:
79
80    flac [options] > outputfile
81    flac -d [options] > outputfile
82
83since the former allows flac to seek backwards to write the STREAMINFO or
84RIFF WAVE header contents when necessary.
85
86Also, you can force output data to go to stdout using -c.
87
88To encode or decode files that start with a dash, use -- to signal the
89end of options, to keep the filenames themselves from being treated as
90options:
91
92    flac -V -- -01-filename.wav
93
94The encoding options affect the compression ratio and encoding speed. The
95format options are used to tell flac the arrangement of samples if the
96input file (or output file when decoding) is a raw file. If it is a RIFF
97WAVE, Wave64, RF64, or AIFF file the format options are not needed since
98they are read from the file's header.
99
100In test mode, flac acts just like in decode mode, except no output file
101is written. Both decode and test modes detect errors in the stream, but
102they also detect when the MD5 signature of the decoded audio does not
103match the stored MD5 signature, even when the bitstream is valid.
104
105flac can also re-encode FLAC files. In other words, you can specify a
106FLAC or Ogg FLAC file as an input to the encoder and it will decoder it
107and re-encode it according to the options you specify. It will also
108preserve all the metadata unless you override it with other options (e.g.
109specifying new tags, seekpoints, cuesheet, padding, etc.).
110
111flac has been tuned so that the default settings yield a good speed vs.
112compression tradeoff for many kinds of input. However, if you are looking
113to maximize the compression rate or speed, or want to use the full power
114of FLAC's metadata system, see the page titled 'About the FLAC Format' on
115the FLAC website.
116
117# EXAMPLES
118
119Some common **encoding** tasks using flac:
120
121`flac abc.wav`
122:	Encode abc.wav to abc.flac using the default compression setting. abc.wav is not deleted.
123
124`flac --delete-input-file abc.wav`
125:	Like above, except abc.wav is deleted if there were no errors.
126
127`flac --delete-input-file -w abc.wav`
128:	Like above, except abc.wav is deleted if there were no errors or warnings.
129
130`flac --best abc.wav`
131:	Encode abc.wav to abc.flac using the highest compression setting.
132
133`flac --verify abc.wav`
134:	Encode abc.wav to abc.flac and internally decode abc.flac to make sure it matches abc.wav.
135
136`flac -o my.flac abc.wav`
137:	Encode abc.wav to my.flac.
138
139`flac -T "TITLE=Bohemian Rhapsody" -T "ARTIST=Queen" abc.wav`
140:	Encode abc.wav and add some tags at the same time to abc.flac.
141
142`flac *.wav`
143:	Encode all .wav files in the current directory.
144
145`flac abc.aiff`
146:	Encode abc.aiff to abc.flac.
147
148`flac abc.rf64`
149:	Encode abc.rf64 to abc.flac.
150
151`flac abc.w64`
152:	Encode abc.w64 to abc.flac.
153
154`flac abc.flac --force`
155:	This one's a little tricky: notice that flac is in encode mode by
156	default (you have to specify -d to decode) so this command actually
157	recompresses abc.flac back to abc.flac. --force is needed to make
158	sure you really want to overwrite abc.flac with a new version. Why
159	would you want to do this? It allows you to recompress an existing
160	FLAC file with (usually) higher compression options or a newer
161	version of FLAC and preserve all the metadata like tags too.
162
163Some common **decoding** tasks using flac:
164
165`flac -d abc.flac`
166:	Decode abc.flac to abc.wav. abc.flac is not deleted. NOTE: Without
167	-d it means re-encode abc.flac to abc.flac (see above).
168
169`flac -d --force-aiff-format abc.flac`
170`flac -d -o abc.aiff abc.flac`
171:	Two different ways of decoding abc.flac to abc.aiff (AIFF format).
172	abc.flac is not deleted.
173
174`flac -d --force-rf64-format abc.flac`
175`flac -d -o abc.rf64 abc.flac`
176:	Two different ways of decoding abc.flac to abc.rf64 (RF64 format).
177	abc.flac is not deleted.
178
179`flac -d --force-wave64-format abc.flac`
180`flac -d -o abc.w64 abc.flac`
181:	Two different ways of decoding abc.flac to abc.w64 (Wave64 format).
182	abc.flac is not deleted.
183
184`flac -d -F abc.flac`
185:	Decode abc.flac to abc.wav and don't abort if errors are found
186	(useful for recovering as much as possible from corrupted files).
187
188
189# OPTIONS
190
191A summary of options is included below. For a complete description, see
192the HTML documentation.
193
194## GENERAL OPTIONS
195
196**-v, \--version**
197:	Show the flac version number
198
199**-h, \--help**
200:	Show basic usage and a list of all options
201
202**-H, \--explain**
203:	Show detailed explanation of usage and all options
204
205**-d, \--decode**
206:	Decode (the default behavior is to encode)
207
208**-t, \--test**
209:	Test a flac encoded file (same as -d except no decoded file is written)
210
211**-a, \--analyze**
212:	Analyze a FLAC encoded file (same as -d except an analysis file is
213	written)
214
215**-c, \--stdout**
216:	Write output to stdout
217
218**-s, \--silent**
219:	Silent mode (do not write runtime encode/decode statistics to stderr)
220
221**\--totally-silent**
222: Do not print anything of any kind, including warnings or errors. The
223	exit code will be the only way to determine successful completion.
224
225**\--no-utf8-convert**
226:	Do not convert tags from local charset to UTF-8. This is useful for
227	scripts, and setting tags in situations where the locale is wrong.
228	This option must appear before any tag options!
229
230**-w, \--warnings-as-errors**
231:	Treat all warnings as errors (which cause flac to terminate with a
232	non-zero exit code).
233
234**-f, \--force**
235:	Force overwriting of output files. By default, flac warns that the
236	output file already exists and continues to the next file.
237
238**-o** *filename***, \--output-name=***filename*
239:	Force the output file name (usually flac just changes the extension).
240	May only be used when encoding a single file. May not be used in
241	conjunction with \--output-prefix.
242
243**\--output-prefix=***string*
244:	Prefix each output file name with the given string. This can be
245	useful for encoding or decoding files to a different directory. Make
246	sure if your string is a path name that it ends with a trailing \`/'
247	(slash).
248
249**\--delete-input-file**
250:	Automatically delete the input file after a successful encode or
251	decode. If there was an error (including a verify error) the input
252	file is left intact.
253
254**\--preserve-modtime**
255:	Output files have their timestamps/permissions set to match those of
256	their inputs (this is default). Use \--no-preserve-modtime to make
257	output files have the current time and default permissions.
258
259**\--keep-foreign-metadata**
260:	If encoding, save WAVE, RF64, or AIFF non-audio chunks in FLAC
261	metadata. If decoding, restore any saved non-audio chunks from FLAC
262	metadata when writing the decoded file. Foreign metadata cannot be
263	transcoded, e.g. WAVE chunks saved in a FLAC file cannot be restored
264	when decoding to AIFF. Input and output must be regular files (not
265	stdin or stdout). With this option, FLAC will pick the right output
266	format on decoding.
267
268**\--keep-foreign-metadata-if-present**
269:	Like \--keep-foreign-metadata, but without throwing an error if
270	foreign metadata cannot be found or restored, instead printing a
271	warning.
272
273**\--skip={***\#***\|***mm:ss.ss***}**
274:	Skip over the first number of samples of the input. This works for
275	both encoding and decoding, but not testing. The alternative form
276	mm:ss.ss can be used to specify minutes, seconds, and fractions of a
277	second.
278
279**\--until={***\#***\|\[***+***\|***-***\]***mm:ss.ss***}**
280:	Stop at the given sample number for each input file. This works for
281	both encoding and decoding, but not testing. The given sample number
282	is not included in the decoded output. The alternative form mm:ss.ss
283	can be used to specify minutes, seconds, and fractions of a second.
284	If a \`+' (plus) sign is at the beginning, the \--until point is
285	relative to the \--skip point. If a \`-' (minus) sign is at the
286	beginning, the \--until point is relative to end of the audio.
287
288**\--ogg**
289:	When encoding, generate Ogg FLAC output instead of native FLAC. Ogg
290	FLAC streams are FLAC streams wrapped in an Ogg transport layer. The
291	resulting file should have an '.oga' extension and will still be
292	decodable by flac. When decoding, force the input to be treated as
293	Ogg FLAC. This is useful when piping input from stdin or when the
294	filename does not end in '.oga' or '.ogg'.
295
296**\--serial-number=***\#*
297:	When used with \--ogg, specifies the serial number to use for the
298	first Ogg FLAC stream, which is then incremented for each additional
299	stream. When encoding and no serial number is given, flac uses a
300	random number for the first stream, then increments it for each
301	additional stream. When decoding and no number is given, flac uses
302	the serial number of the first page.
303
304## ANALYSIS OPTIONS
305
306**\--residual-text**
307:	Includes the residual signal in the analysis file. This will make the
308	file very big, much larger than even the decoded file.
309
310**\--residual-gnuplot**
311:	Generates a gnuplot file for every subframe; each file will contain
312	the residual distribution of the subframe. This will create a lot of
313	files.
314
315## DECODING OPTIONS
316
317**\--cue=\[***\#.#***\]\[-\[***\#.#***\]\]**
318:	Set the beginning and ending cuepoints to decode. The optional first
319	\#.# is the track and index point at which decoding will start; the
320	default is the beginning of the stream. The optional second \#.# is
321	the track and index point at which decoding will end; the default is
322	the end of the stream. If the cuepoint does not exist, the closest
323	one before it (for the start point) or after it (for the end point)
324	will be used. If those don't exist, the start of the stream (for the
325	start point) or end of the stream (for the end point) will be used.
326	The cuepoints are merely translated into sample numbers then used as
327	\--skip and \--until. A CD track can always be cued by, for example,
328	\--cue=9.1-10.1 for track 9, even if the CD has no 10th track.
329
330**-F, \--decode-through-errors**
331:	By default flac stops decoding with an error and removes the
332	partially decoded file if it encounters a bitstream error. With -F,
333	errors are still printed but flac will continue decoding to
334	completion. Note that errors may cause the decoded audio to be
335	missing some samples or have silent sections.
336
337**\--apply-replaygain-which-is-not-lossless\[=\<specification\>\]**
338:	Applies ReplayGain values while decoding. **WARNING: THIS IS NOT
339	LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH
340	THIS OPTION.** This option is useful for example in transcoding
341	media servers, where the client does not support ReplayGain. For
342	details on the use of this option, see the section **ReplayGain
343	application specification**.
344
345## ENCODING OPTIONS
346
347**-V, \--verify**
348:	Verify a correct encoding by decoding the output in parallel and
349	comparing to the original
350
351**\--lax**
352:	Allow encoder to generate non-Subset files. The resulting FLAC file
353	may not be streamable or might have trouble being played in all
354	players (especially hardware devices), so you should only use this
355	option in combination with custom encoding options meant for
356	archival.
357
358**\--replay-gain**
359:	Calculate ReplayGain values and store them as FLAC tags, similar to
360	vorbisgain. Title gains/peaks will be computed for each input file,
361	and an album gain/peak will be computed for all files. All input
362	files must have the same resolution, sample rate, and number of
363	channels. Only mono and stereo files are allowed, and the sample
364	rate must be 8, 11.025, 12, 16, 18.9, 22.05, 24, 28, 32, 36, 37.8,
365	44.1, 48, 56, 64, 72, 75.6, 88.2, 96, 112, 128, 144, 151.2, 176.4,
366	192, 224, 256, 288, 302.4, 352.8, 384, 448, 512, 576, or 604.8 kHz.
367	Also note that this option may leave a few extra bytes in a PADDING
368	block as the exact size of the tags is not known until all files
369	are processed. Note that this option cannot be used when encoding
370	to standard output (stdout).
371
372**\--cuesheet=***filename*
373:	Import the given cuesheet file and store it in a CUESHEET metadata
374	block. This option may only be used when encoding a single file. A
375	seekpoint will be added for each index point in the cuesheet to the
376	SEEKTABLE unless \--no-cued-seekpoints is specified.
377
378**\--picture={***FILENAME***\|***SPECIFICATION***}**
379:	Import a picture and store it in a PICTURE metadata block. More than
380	one \--picture option can be specified. Either a filename for the
381	picture file or a more complete specification form can be used. The
382	SPECIFICATION is a string whose parts are separated by \| (pipe)
383	characters. Some parts may be left empty to invoke default values.
384	FILENAME is just shorthand for "\|\|\|\|FILENAME". For the format of
385	SPECIFICATION, see the section **picture specification**.
386
387**\--ignore-chunk-sizes**
388:	When encoding to flac, ignore the file size headers in WAV and AIFF
389	files to attempt to work around problems with over-sized or malformed
390	files. WAV and AIFF files both have an unsigned 32 bit numbers in
391	the file header which specifes the length of audio data. Since this
392	number is unsigned 32 bits, that limits the size of a valid file to
393	being just over 4 Gigabytes. Files larger than this are mal-formed,
394	but should be read correctly using this option.
395
396**-S {***\#***\|***X***\|***\#x***\|***\#s***}, \--seekpoint={***\#***\|***X***\|***\#x***\|***\#s***}**
397:	Include a point or points in a SEEKTABLE. Using \#, a seek point at
398	that sample number is added. Using X, a placeholder point is added at
399	the end of a the table. Using \#x, \# evenly spaced seek points will
400	be added, the first being at sample 0. Using \#s, a seekpoint will be
401	added every \# seconds (# does not have to be a whole number; it can
402	be, for example, 9.5, meaning a seekpoint every 9.5 seconds). You may
403	use many -S options; the resulting SEEKTABLE will be the unique-ified
404	union of all such values. With no -S options, flac defaults to
405	'-S 10s'. Use \--no-seektable for no SEEKTABLE. Note: '-S \#x' and
406	'-S \#s' will not work if the encoder can't determine the input size
407	before starting. Note: if you use '-S \#' and \# is \>= samples in
408	the input, there will be either no seek point entered (if the input
409	size is determinable before encoding starts) or a placeholder point
410	(if input size is not determinable).
411
412**-P** *\#***, \--padding=***\#*
413:	Tell the encoder to write a PADDING metadata block of the given
414	length (in bytes) after the STREAMINFO block. This is useful if you
415	plan to tag the file later with an APPLICATION block; instead of
416	having to rewrite the entire file later just to insert your block,
417	you can write directly over the PADDING block. Note that the total
418	length of the PADDING block will be 4 bytes longer than the length
419	given because of the 4 metadata block header bytes. You can force no
420	PADDING block at all to be written with \--no-padding. The encoder
421	writes a PADDING block of 8192 bytes by default (or 65536 bytes if
422	the input audio stream is more that 20 minutes long).
423
424**-T** *FIELD=VALUE***, \--tag=***FIELD=VALUE*
425:	Add a FLAC tag. The comment must adhere to the Vorbis comment spec;
426	i.e. the FIELD must contain only legal characters, terminated by an
427	'equals' sign. Make sure to quote the comment if necessary. This
428	option may appear more than once to add several comments. NOTE: all
429	tags will be added to all encoded files.
430
431**\--tag-from-file=***FIELD=FILENAME*
432:	Like \--tag, except FILENAME is a file whose contents will be read
433	verbatim to set the tag value. The contents will be converted to
434	UTF-8 from the local charset. This can be used to store a cuesheet
435	in a tag (e.g. \--tag-from-file="CUESHEET=image.cue"). Do not try to
436	store binary data in tag fields! Use APPLICATION blocks for that.
437
438**-b** *\#***, \--blocksize=***\#*
439:	Specify the blocksize in samples. The default is 1152 for -l 0,
440	else 4096. For subset streams this must be \<= 4608 if the samplerate
441	\<= 48kHz, for subset streams with higher samplerates it must be \<=
442	16384.
443
444**-m, \--mid-side**
445:	Try mid-side coding for each frame (stereo input only)
446
447**-M, \--adaptive-mid-side**
448:	Adaptive mid-side coding for all frames (stereo input only)
449
450**-0..-8, \--compression-level-0..\--compression-level-8**
451:	Fastest compression..highest compression (default is -5). These are
452	synonyms for other options:
453
454**-0, \--compression-level-0**
455:	Synonymous with -l 0 -b 1152 -r 3 \--no-mid-side
456
457**-1, \--compression-level-1**
458:	Synonymous with -l 0 -b 1152 -M -r 3
459
460**-2, \--compression-level-2**
461:	Synonymous with -l 0 -b 1152 -m -r 3
462
463**-3, \--compression-level-3**
464:	Synonymous with -l 6 -b 4096 -r 4 \--no-mid-side
465
466**-4, \--compression-level-4**
467:	Synonymous with -l 8 -b 4096 -M -r 4
468
469**-5, \--compression-level-5**
470:	Synonymous with -l 8 -b 4096 -m -r 5
471
472**-6, \--compression-level-6**
473:	Synonymous with -l 8 -b 4096 -m -r 6 -A subdivide_tukey(2)
474
475**-7, \--compression-level-7**
476:	Synonymous with -l 12 -b 4096 -m -r 6 -A subdivide_tukey(2)
477
478**-8, \--compression-level-8**
479:	Synonymous with -l 12 -b 4096 -m -r 6 -A subdivide_tukey(3)
480
481**\--fast**
482:	Fastest compression. Currently synonymous with -0.
483
484**\--best**
485:	Highest compression. Currently synonymous with -8.
486
487**-e, \--exhaustive-model-search**
488:	Do exhaustive model search (expensive!)
489
490**-A** *function***, \--apodization=***function*
491:	Window audio data with given the apodization function. See section
492	**Apodization functions** for details.
493
494**-l** *\#***, \--max-lpc-order=***\#*
495:	Specifies the maximum LPC order. This number must be \<= 32. For
496	subset streams, it must be \<=12 if the sample rate is \<=48kHz. If
497	0, the encoder will not attempt generic linear prediction, and use
498	only fixed predictors. Using fixed predictors is faster but usually
499	results in files being 5-10% larger.
500
501**-p, \--qlp-coeff-precision-search**
502:	Do exhaustive search of LP coefficient quantization (expensive!).
503	Overrides -q; does nothing if using -l 0
504
505**-q** *\#***, \--qlp-coeff-precision=***\#*
506:	Precision of the quantized linear-predictor coefficients, 0 =\> let
507	encoder decide (min is 5, default is 0)
508
509**-r \[***\#***,\]***\#***, \--rice-partition-order=\[***\#***,\]***\#*
510:	Set the \[min,\]max residual partition order (0..15). min defaults to
511	0 if unspecified. Default is -r 5.
512
513## FORMAT OPTIONS
514
515**\--endian={***big***\|***little***}**
516:	Set the byte order for samples
517
518**\--channels=***\#*
519:	Set number of channels.
520
521**\--bps=***\#*
522:	Set bits per sample.
523
524**\--sample-rate=***\#*
525:	Set sample rate (in Hz).
526
527**\--sign={***signed***\|***unsigned***}**
528:	Set the sign of samples.
529
530**\--input-size=***\#*
531:	Specify the size of the raw input in bytes. If you are encoding raw
532	samples from stdin, you must set this option in order to be able to
533	use \--skip, \--until, \--cuesheet, or other options that need to
534	know the size of the input beforehand. If the size given is greater
535	than what is found in the input stream, the encoder will complain
536	about an unexpected end-of-file. If the size given is less, samples
537	will be truncated.
538
539**\--force-raw-format**
540:	Force input (when encoding) or output (when decoding) to be treated
541	as raw samples (even if filename ends in *.wav*).
542
543**\--force-aiff-format**
544**\--force-rf64-format**
545**\--force-wave64-format**
546:	Force the decoder to output AIFF/RF64/WAVE64 format respectively.
547	This option is not needed if the output filename (as set by -o)
548	ends with *.aif* or *.aiff*, *.rf64* and *.w64* respectively. Also,
549	this option has no effect when encoding since input is
550	auto-detected. When none of these options nor
551	--keep-foreign-metadata are given and no output filename is set,
552	the output format is WAV by default.
553
554**\--force-legacy-wave-format**
555**\--force-extensible-wave-format**
556:	Instruct the decoder to output a WAVE file with WAVE_FORMAT_PCM and
557	WAVE_FORMAT_EXTENSIBLE respectively. If none of these options nor
558	--keep-foreign-metadata are given, FLAC outputs WAVE_FORMAT_PCM
559	for mono or stereo with a bit depth of 8 or 16 bits, and
560	WAVE_FORMAT_EXTENSIBLE for all other audio formats.
561
562**\--force-aiff-c-none-format**
563**\--force-aiff-c-sowt-format**
564:	Instruct the decoder to output an AIFF-C file with format NONE and
565	sowt respectively.
566
567## NEGATIVE OPTIONS
568
569**\--no-adaptive-mid-side**
570**\--no-cued-seekpoints**
571**\--no-decode-through-errors**
572**\--no-delete-input-file**
573**\--no-preserve-modtime**
574**\--no-keep-foreign-metadata**
575**\--no-exhaustive-model-search**
576**\--no-force**
577**\--no-lax**
578**\--no-mid-side**
579**\--no-ogg**
580**\--no-padding**
581**\--no-qlp-coeff-prec-search**
582**\--no-replay-gain**
583**\--no-residual-gnuplot**
584**\--no-residual-text**
585**\--no-seektable**
586**\--no-silent**
587**\--no-verify**
588**\--no-warnings-as-errors**
589
590These flags can be used to invert the sense of the corresponding normal
591option.
592
593## ReplayGain application specification
594The option \--apply-replaygain-which-is-not-lossless\[=\<specification\>\]**
595applies ReplayGain values while decoding. **WARNING: THIS IS NOT
596LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS
597OPTION.** This option is useful for example in transcoding media servers,
598where the client does not support ReplayGain.
599
600The equals sign and \<specification\> is optional. If omitted, the
601default specification is 0aLn1.
602
603The \<specification\> is a shorthand notation for describing how to	apply
604ReplayGain. All components are optional but order is important. '\[\]'
605means 'optional'. '\|' means 'or'. '{}' means required. The format is:
606
607\[\<preamp\>\]\[a\|t\]\[l\|L\]\[n{0\|1\|2\|3}\]
608
609In which the following parameters are used:
610
611-	**preamp**: A floating point number in dB. This is added to the
612	existing gain value.
613
614-	**a\|t**: Specify 'a' to use the album gain, or 't' to use the track
615	gain. If tags for the preferred kind (album/track) do not exist but
616	tags for the other (track/album) do, those will be used instead.
617
618-	**l\|L**: Specify 'l' to peak-limit the output, so that the
619	ReplayGain peak value is full-scale. Specify 'L' to use a 6dB hard
620	limiter that kicks in when the signal approaches full-scale.
621
622-	**n{0\|1\|2\|3}**: Specify the amount of noise shaping. ReplayGain
623	synthesis happens in floating point; the result is dithered before
624	converting back to integer. This quantization adds noise. Noise
625	shaping tries to move the noise where you won't hear it as much.
626	0 means no noise shaping, 1 means 'low', 2 means 'medium', 3 means
627	'high'.
628
629For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB
630hard limit, low noise shaping. \--apply-replaygain-which-is-not-lossless=3
631means 3dB preamp, use album gain, no limiting, no noise shaping.
632
633flac uses the ReplayGain tags for the calculation. If a stream does
634not have the required tags or they can't be parsed, decoding will
635continue with a warning, and no ReplayGain is applied to that stream.
636
637## Picture specification
638This described the specification used for the **\--picture** option.
639\[TYPE\]\|\[MIME-TYPE\]\|\[DESCRIPTION\]\|\[WIDTHxHEIGHTxDEPTH\[/COLORS\]\]\|FILE
640
641TYPE is optional; it is a number from one of:
642
6430. Other
6441. 32x32 pixels 'file icon' (PNG only)
6452. Other file icon
6463. Cover (front)
6474. Cover (back)
6485. Leaflet page
6496. Media (e.g. label side of CD)
6507. Lead artist/lead performer/soloist
6518. Artist/performer
6529. Conductor
65310. Band/Orchestra
65411. Composer
65512. Lyricist/text writer
65613. Recording Location
65714. During recording
65815. During performance
65916. Movie/video screen capture
66017. A bright coloured fish
66118. Illustration
66219. Band/artist logotype
66320. Publisher/Studio logotype
664
665The default is 3 (front cover). There may only be one picture each of
666type 1 and 2 in a file.
667
668MIME-TYPE is optional; if left blank, it will be detected from the file.
669For best compatibility with players, use pictures with MIME type
670image/jpeg or image/png. The MIME type can also be \--\> to mean that
671FILE is actually a URL to an image, though this use is discouraged.
672
673DESCRIPTION is optional; the default is an empty string.
674
675The next part specifies the resolution and color information. If the
676MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave
677this empty and they can be detected from the file. Otherwise, you must
678specify the width in pixels, height in pixels, and color depth in
679bits-per-pixel. If the image has indexed colors you should also specify
680the number of colors used. When manually specified, it is not checked
681against the file for accuracy.
682
683FILE is the path to the picture file to be imported, or the URL if MIME
684type is \--\>
685
686For example, "\|image/jpeg\|\|\|../cover.jpg" will embed the JPEG file
687at ../cover.jpg, defaulting to type 3 (front cover) and an empty
688description. The resolution and color info will be retrieved from the
689file itself.
690
691The specification
692"4\|\--\>\|CD\|320x300x24/173\|http://blah.blah/backcover.tiff" will
693embed the given URL, with type 4 (back cover), description "CD", and a
694manually specified resolution of 320x300, 24 bits-per-pixel, and 173
695colors. The file at the URL will not be fetched; the URL itself is
696stored in the PICTURE metadata block.
697
698## Apodization functions
699To improve LPC analysis, audio data is windowed . The window can be
700selected with one or more **-A** options. Possible functions are:
701bartlett, bartlett_hann, blackman, blackman_harris_4term_92db,
702connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall,
703rectangle, triangle, tukey(P), partial_tukey(n\[/ov\[/P\]\]),
704punchout_tukey(n\[/ov\[/P\]\]), subdivide_tukey(n\[/P\]) welch.
705
706- For gauss(STDDEV), STDDEV is the standard deviation (0\<STDDEV\<=0.5).
707
708- For tukey(P), P specifies the fraction of the window that is tapered
709(0\<=P\<=1; P=0 corresponds to "rectangle" and P=1 corresponds to
710"hann").
711
712- For partial_tukey(n) and punchout_tukey(n), n apodization functions are
713added that span different parts of each block. Values of 2 to 6 seem to
714yield sane results. If necessary, an overlap can be specified, as can be
715the taper parameter, for example partial_tukey(2/0.2) or
716partial_tukey(2/0.2/0.5). ov should be smaller than 1 and can be
717negative. The use of this is that different parts of a block are ignored
718as the might contain transients which are hard to predict anyway. The
719encoder will try each different added apodization (each covering a
720different part of the block) to see which resulting predictor results in
721the smallest representation.
722
723- subdivide_tukey(n) is a more efficient reimplementation of partial_tukey
724and punchout_tukey taken together, recycling as much data as possible. It
725combines all possible non-redundant partial_tukey(n) and punchout_tukey(n)
726up to the n specified.  Specifying subdivide_tukey(3) is equivalent to
727specifying tukey, partial_tukey(2), partial_tukey(3) and punchout_tukey(3),
728specifying subdivide_tukey(5) equivalently adds partial_tukey(4),
729punchout_tukey(4), partial_tukey(5) and punchout_tukey(5). To be able to
730reuse data as much as possible, the tukey taper is taken equal for all
731windows, and the P specified is applied for the smallest used window.
732In other words, subdivide_tukey(2/0.5) results in a taper equal to that
733of tukey(0.25) and subdivide_tukey(5) in a taper equal to that of
734tukey(0.1). The default P for subdivide_tukey when none is specified is
7350.5.
736
737Note that P, STDDEV and ov are locale specific, so a comma as
738decimal separator might be required instead of a dot. Use scientific
739notation for a locale-independent specification, for example
740tukey(5e-1) instead of tukey(0.5) or tukey(0,5).
741
742More than one -A option (up to 32) may be used. Any function that is
743specified erroneously is silently dropped. The encoder chooses suitable
744defaults in the absence of any -A options; any -A option specified
745replaces the default(s).
746
747When more than one function is specified, then for every subframe the
748encoder will try each of them separately and choose the window that
749results in the smallest compressed subframe. Multiple functions can
750greatly increase the encoding time.
751
752# SEE ALSO
753
754**metaflac(1)**
755
756# AUTHOR
757
758This manual page was initially written by Matt Zimmerman
759\<[email protected]\> for the Debian GNU/Linux system (but may be used by
760others). It has been kept up-to-date by the Xiph.org Foundation.
761