flac(1)
flac(1) โ Free Lossless Audio Codec conversion tool ๐ โจ
๐ธ NAME ๐ธ
flac โ Free Lossless Audio Codec
๐ฆ SYNOPSIS ๐ฆ
flac [ OPTIONS ] [ infile.wav | infile.rf64 | infile.aiff | infile.raw |
infile.flac | infile.oga | infile.ogg | - ... ]
flac [ -d | --decode | -t | --test | -a | --analyze ] [ OPTIONS ] [ infile.flac | infile.oga | infile.ogg | - ... ]
๐ DESCRIPTION ๐
okay so flac is literally a command-line tool for encoding, decoding, testing and analyzing FLAC streams. Thatโs the whole vibe. ๐
๐ GENERAL USAGE ๐
bestie, listen: flac supports as input RIFF WAVE, Wave64, RF64, AIFF, FLAC or Ogg FLAC format, or raw interleaved samples. The decoder currently can output to RIFF WAVE, Wave64, RF64, or AIFF format, or raw interleaved samples. flac only supports linear PCM samples (in other words, no A-LAW, uLAW, etc.), and the input must be between 4 and 32 bits per sample. no cap.
flac assumes that files ending in โ.wavโ or that have the RIFF WAVE header present are WAVE files, files ending in โ.w64โ or have the Wave64 header present are Wave64 files, files ending in โ.rf64โ or have the RF64 header present are RF64 files, files ending in โ.aifโ or โ.aiffโ or have the AIFF header present are AIFF files, files ending in โ.flacโ or have the FLAC header present are FLAC files and files ending in โ.ogaโ or โ.oggโ or have the Ogg FLAC header present are Ogg FLAC files.
Other than this, flac makes no assumptions about file extensions, though the convention is that FLAC files have the extension โ.flacโ (or โ.flaโ on ancient โ8.3โ file systems like FAT-16).
Before going into the full command-line description, a few other things help to sort it out:
flacencodes by default, so you must use-dto decode- Encoding options
-0..-8(or--fastand--best) that control the compression level actually are just synonyms for different groups of specific encoding options (described later). - The order in which options are specified is generally not important except when they contradict each other, then the latter takes precedence except that compression presets are overridden by any option given before or after. For example,
-0M,-M0,-M2and-2Mare all the same as-1, and-l 12 -6the same as-7. flacbehaves similarly togzipin the way it handles input and output files
Skip to the EXAMPLES section below for examples of some typical tasks. ๐
flac will be invoked one of four ways, depending on whether you are encoding, decoding, testing, or analyzing. Encoding is the default invocation, but can be switch to decoding with -d, analysis with -a or testing with -t. Depending on which way is chosen, encoding, decoding, analysis or testing options can be used, see section OPTIONS for details. General options can be used for all.
If only one inputfile is specified, it may be โ-โ for stdin. When stdin is used as input, flac will write to stdout. Otherwise flac 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.
If you are encoding/decoding from stdin to a file, you should use the -o option like so:
flac [options] -o outputfile
flac -d [options] -o outputfile
which are better than:
flac [options] > outputfile
flac -d [options] > outputfile
since the former allows flac to seek backwards to write the STREAMINFO or RIFF WAVE header contents when necessary.
Also, you can force output data to go to stdout using -c.
To encode or decode files that start with a dash, use -- to signal the end of options, to keep the filenames themselves from being treated as options:
flac -V -- -01-filename.wav
The encoding options affect the compression ratio and encoding speed. The format options are used to tell flac the arrangement of samples if the input file (or output file when decoding) is a raw file. If it is a RIFF WAVE, Wave64, RF64, or AIFF file the format options are not needed since they are read from the fileโs header.
In test mode, flac 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.
flac can also re-encode FLAC files. In other words, you can specify a FLAC or Ogg FLAC file as an input to the encoder and it will decoder it and re-encode it according to the options you specify. It will also preserve all the metadata unless you override it with other options (e.g. specifying new tags, seekpoints, cuesheet, padding, etc.).
flac has been tuned so that the default settings 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, see the page titled `About the FLAC Format' on the FLAC website. ๐ฆ
๐ธ EXAMPLES ๐ธ
Okay bestie, here's the tea โ some typical encoding and decoding tasks using flac: ๐
๐ Encoding examples ๐
flac abc.wavโ encodesabc.wavtoabc.flacusing the default compression setting. And no,abc.wavis not deleted. She stays. โจflac --delete-input-file abc.wavโ like the one above, exceptabc.wavgets deleted if there were no errors.flac --delete-input-file -w abc.wavโ same as above, exceptabc.wavgets deleted only if there were no errors and no warnings. She's picky, okay? ๐flac --best abc.wavorflac -8 abc.wavโ encodesabc.wavtoabc.flacusing the highest compression preset. Max effort, main character energy. ๐flac --verify abc.wavorflac -V abc.wavโ encodesabc.wavtoabc.flacand then internally decodesabc.flacto make sure it matchesabc.wav. Self-check queen. โflac -o my.flac abc.wavโ encodesabc.wavtomy.flac. Cute custom name, we love that for her. ๐flac abc.aiff foo.rf64 bar.w64โ encodesabc.aifftoabc.flac,foo.rf64tofoo.flacandbar.w64tobar.flac. One command, three glow-ups. โจflac *.wav *.aif?โ wildcards are supported, periodt. This command will encode all.wavfiles and all.aif/.aiff/.aifcfiles (as well as other supported files ending in.aifplus one character) in the current directory.flac abc.flac --forceorflac abc.flac -fโ recompresses, keeping metadata like tags. The syntax is a little tricky, ngl: this is an encoding command (which is the default โ you need to specify-dfor decoded output), and will thus want to output the fileabc.flac, which already exists. Soflacwill require the--forceor shortform-foption to overwrite an existing file. Recompression will first write a temporary file, which afterwards replaces the oldabc.flac(providedflachas write access to that file). The example above uses default settings. More often, recompression is combined with a different โ usually higher โ compression option. Note: If the FLAC file does not end with.flacโ say, it'sabc.flaโ the-fis not needed: a newabc.flacwill be created and the old one kept, just like for an uncompressed input file. ๐flac --tag-from-file="ALBUM=albumtitle.txt" -T "ARTIST=Queen" *.wavโ encodes every.wavfile in the directory and adds some tags. Every file will get the same set of tags. โ ๏ธ Warning: will wipe all existing tags when the input file is (Ogg) FLAC โ not just those tags listed in the option. Use themetaflacutility to tag FLAC files.flac --keep-foreign-metadata-if-present abc.wavโ FLAC files can store non-audio chunks of input WAVE/AIFF/RF64/W64 files. The related option--keep-foreign-metadataworks the same way, but will instead exit with an error if the input has no such non-audio chunks. The encoder only stores the chunks as they are โ it cannot import the content into its own tags (vorbis comments). To transfer such tags from a source file, use tagging software which supports them. ๐ฆflac -Vj2 -m3fo Track07.flac -- -7.wavโ okay this one is iconic and also kind of a puzzle, let's break it down.flacemploys the commonplace convention that options in a short version โ invoked with a single dash โ can be shortened together until one that takes an argument. Here-jand-odo, and after the โ2โ a whitespace is needed to start new options with single/double dash. The-moption does not, and the following โ3โ is the-3compression setting. The options could equally well have been written out as-V -j 2 -m -3 -f -o Track04.flac, or as-fo Track04.flac -3mVj2.flacalso employs the convention that--(with whitespace!) signifies end of options, treating everything to follow as filename. That is needed when input filenames could otherwise be read as an option, and โ-7โ is one such. In total, this line takes the input file-7.wavas input;-owill give output filename asTrack07.flac, and the-fwill overwrite if the fileTrack04.flacis already present. The encoder will select encoding preset-3modified with the-mswitch, and use two CPU threads. Afterwards, the-Vwill make it decode the flac file and compare the audio to the input, to ensure they are indeed equal. ๐ง
๐ฆ Decoding examples ๐ฆ
flac --decode abc.flacorflac -d abc.flacโ decodesabc.flactoabc.wav.abc.flacis not deleted. Ifabc.wavis already present, the process will exit with an error instead of overwriting; use--force/-fto force overwrite. NOTE: A mereflac abc.flacwithout--decodeor its shortform-dwould mean re-encodingabc.flactoabc.flac(see above), and that command would err out becauseabc.flacalready exists. ๐ญflac -d --force-aiff-format abc.flacorflac -d -o abc.aiff abc.flacโ two different ways of decodingabc.flactoabc.aiff(AIFF format).abc.flacis not deleted.-d -ocould be shortened to-do. The decoder can force other output formats, or different versions of the WAVE/AIFF formats โ see the options below. โจflac -d --keep-foreign-metadata-if-present abc.flacโ if the FLAC file has non-audio chunks stored from the original input file, this option will restore both audio and non-audio. The chunks will reveal the original file type, and the decoder will select output format and output file extension accordingly โ note that this is not compatible with forcing a particular output format except if it coincides with the original, since the decoder cannot transcode non-audio between formats. If there are no such chunks stored, it will decode toabc.wav. The related option--keep-foreign-metadatawill instead exit with an error if no such non-audio chunks are found.flac -d -F abc.flacโ decodesabc.flactoabc.wavand doesn't abort if errors are found. This is potentially useful for recovering as much as possible from a corrupted file. Note: be careful about trying to โrepairโ files this way. Often it will only conceal an error, and not play any subjectively โbetterโ than the corrupted file. It is a good idea to at least keep it, and possibly try several decoders, including the one that generated the file, and hear if one has less detrimental audible errors than another. Make sure output volume is limited, as corrupted audio can generate loud noises. ๐ฅ
๐ OPTIONS ๐
A summary of options is included below. Several of the options can be negated โ see the Negative options section below. ๐
โจ GENERAL OPTIONS โจ
-v,--versionโ show the flac version number, and quit. Quick lil vibe check. ๐-h,--helpโ show basic usage and a list of all options, and quit.-d,--decodeโ decode (the default behavior is to encode).-t,--testโ test a flac encoded file. This works the same as-dexcept no decoded file is written, and with some additional checks like parsing of all metadata blocks. Just here to snoop, no output. ๐-a,--analyzeโ analyze a FLAC encoded file. This works the same as-dexcept the output is an analysis file, not a decoded file. ๐-c,--stdoutโ write output to stdout. Piping girlies rise up. ๐-f,--forceโ force overwriting of output files. By default,flacwarns that the output file already exists and continues to the next file.--delete-input-fileโ 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. She's forgiving like that. ๐ซถ-o FILENAME,--output-name=FILENAMEโ force the output file name (usuallyflacjust changes the extension). May only be used when encoding a single file. May not be used in conjunction with--output-prefix.--output-prefix=STRINGโ prefix each output file name with the given string. This can be useful for encoding or decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing/(slash). โญ--preserve-modtimeโ (enabled by default.) Output files have their timestamps/permissions set to match those of their inputs. Use--no-preserve-modtimeto make output files have the current time and default permissions. Time machine but make it filesystem. ๐ฐ๏ธ--keep-foreign-metadataโ if encoding, save WAVE, RF64, or AIFF non-audio chunks in FLAC metadata. If decoding, restore any saved non-audio chunks from FLAC metadata when writing the decoded file. Foreign metadata cannot be transcoded โ e.g. WAVE chunks saved in a FLAC file cannot be restored when decoding to AIFF. Input and output must be regular files (not stdin or stdout). With this option, FLAC will pick the right output format on decoding. It will exit with error if no such chunks are found.--keep-foreign-metadata-if-presentโ like--keep-foreign-metadata, but without throwing an error if foreign metadata cannot be found or restored. Instead, prints a warning. Chill version, no drama. ๐--skip={#|MM:SS}โ skip the first number of samples of the input. To skip over a given initial time, specify instead minutes and seconds: there must then be at least one digit on each side of the colon sign. Fractions of a second can be specified, with locale-dependent decimal point, e.g.--skip=123:9,867if your decimal point is a comma. A--skipoption is applied to each input file if more are given. This option cannot be used with-t. When used with-a, the analysis file will enumerate frames from starting point. ๐--until={#|[+]MM:SS}โ stop at the given sample number (which is not included). A negative number is taken relative to the end of the audio, a+(plus) sign means that the--untilpoint is taken relative to the--skippoint. For other considerations, see--skip.--no-utf8-convertโ do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! โ ๏ธ-s,--silentโ silent mode (do not write runtime encode/decode statistics to stderr). Shhh, she's in her quiet era. ๐คซ--totally-silentโ do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion. Literally zero words, just vibes. ๐-w,--warnings-as-errorsโ treat all warnings as errors (which causeflacto terminate with a non-zero exit code). No more being lenient, bestie. ๐ค
๐ DECODING OPTIONS ๐
-F,--decode-through-errorsโ okay so by default, if flac hits a bitstream error while decoding it just gives up, prints an error message, and yeets the partially decoded file into the void. With-Fit still tells you about the errors (it's not silencing anything, bestie) but it keeps decoding all the way to the end. Just know: those errors might mean the decoded audio is missing some samples or has silent sections. Not lossless behavior, just saying. ๐ซถ--cue=[#.#][-[#.#]]โ set where decoding starts and stops, using cuepoints. The decimal points are locale-dependent (so dot or comma, depending on your locale, iykyk). The optional first#.#is the track-and-index point where decoding starts; default is the beginning of the stream. The optional second#.#is the track-and-index point where decoding ends; default is the end of the stream. If that cuepoint doesn't exist, it grabs the closest one before it (for the start point) or after it (for the end point). And if those don't exist either, it falls back to the start of the stream (start point) or end of the stream (end point). Under the hood these cuepoints are just translated into sample numbers and then used as--skipand--until. Also iconic detail: a CD track can always be cued โ like--cue=9.1-10.1for track 9 โ even if the CD has no 10th track. Slay.โdecode-chained-streamโ decode all the links in a chained Ogg stream, not just the first one. โจ--apply-replaygain-which-is-not-lossless[=SPECIFICATION]โ applies ReplayGain values while decoding.
โ ๏ธ WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS OPTION. Not a vibe for archivists, fr fr.
It's useful for stuff like transcoding media servers, where the client doesn't support ReplayGain. For all the details on how to use it, go look at the section ReplayGain application specification. ๐
๐ธ ENCODING OPTIONS ๐ธ
Quick heads up before we dive in: encoding defaults to -5, -A "tukey(5e-1)" and one CPU thread. That's the baseline, bestie.
-V,--verifyโ verify the encoding is correct by decoding the output in parallel and comparing it against the original. Self-check queen. ๐-0,--compression-level-0,--fastโ the fastest compression preset. Currently synonymous with-l 0 -b 1152 -r 3 --no-mid-side. Zoom zoom. ๐จ-1,--compression-level-1โ currently synonymous with-l 0 -b 1152 -M -r 3.-2,--compression-level-2โ currently synonymous with-l 0 -b 1152 -m -r 3.-3,--compression-level-3โ currently synonymous with-l 6 -b 4096 -r 4 --no-mid-side.-4,--compression-level-4โ currently synonymous with-l 8 -b 4096 -M -r 4.-5,--compression-level-5โ currently synonymous with-l 8 -b 4096 -m -r 5.-6,--compression-level-6โ currently synonymous with-l 8 -b 4096 -m -r 6 -A "subdivide_tukey(2)".-7,--compression-level-7โ currently synonymous with-l 12 -b 4096 -m -r 6 -A "subdivide_tukey(2)".-8,--compression-level-8,--bestโ currently synonymous with-l 12 -b 4096 -m -r 6 -A "subdivide_tukey(3)". The final boss of compression. ๐-l #,--max-lpc-order=#โ sets the max LPC order. This number must be <= 32. For subset streams it must be<=12if the sample rate is<=48kHz. If it's0, the encoder won't even attempt generic linear prediction and will only pick from a set of fixed (hard-coded) predictors. Restricting to fixed predictors only is faster, but compresses weaker โ typically five percentage points / ten percent larger files. So, tradeoffs, as always.-b #,--blocksize=#โ specify the blocksize in samples. Current default is1152for-l 0, otherwise4096. Blocksize must be between16and65535(inclusive). For subset streams it must be<= 4608if the samplerate is<= 48kHz, and for subset streams with higher samplerates it must be<= 16384. Respect the boundaries, bestie. ๐ง-m,--mid-sideโ try mid-side coding for each frame (stereo only, otherwise it's just ignored, no biggie).-M,--adaptive-mid-sideโ adaptive mid-side coding for all frames (stereo only, otherwise ignored).-r [#,]#,--rice-partition-order=[#,]#โ set the[min,]maxresidual partition order (0..15). For subset streams, max must be<=8.mindefaults to0. Default is-r 5. The actual partitioning gets restricted by block size and prediction order, and the encoder will silently reduce values that are too high. Sneaky but helpful.-A FUNCTION(S),--apodization=FUNCTION(S)โ window the audio data with the given apodization function. You can give more of them, comma-separated. See the section Apodization functions for the deets. ๐ชโจ-e,--exhaustive-model-searchโ do an exhaustive model search. (expensive!) Your CPU has been warned. ๐-q #,--qlp-coeff-precision=#โ precision of the quantized linear-predictor coefficients. This number must be between5and16, or0(the default) to let the encoder decide for itself. Does nothing if you're using-l 0.-p,--qlp-coeff-precision-searchโ do an exhaustive search of LP coefficient quantization. (expensive!) Overrides-q; does nothing if you're using-l 0.--laxโ allow the encoder to generate non-Subset files.
๐ฌ The resulting FLAC file may not be streamable, or might have trouble playing in all players (especially hardware devices), so you should only use this option together with custom encoding options meant for archival. Be careful, bestie.
--limit-min-bitrateโ limit the minimum bitrate by not allowing frames that consist of only constant subframes. This guarantees a bitrate of at least 1 bit/sample, like48kbit/sfor 48kHz input. Mainly useful for internet streaming. ๐-j #,--threads=#โ try to set a max number of threads to use for encoding. If multithreading wasn't enabled at compile time, or if you set a thread count that's too high, this fails with a warning. The value0means a default set by the encoder; currently that's 1 thread (i.e. no multithreading), but that could totally change in the future. Currently up to128threads are supported. And ngl, using a value higher than the number of available CPU threads harms performance โ don't do it, it's not the flex you think it is. ๐--ignore-chunk-sizesโ when encoding to flac, ignore the file size headers inWAVandAIFFfiles to try to work around problems with over-sized or malformed files. BothWAVandAIFFfiles specify the length of audio data with an unsigned 32-bit number, which limits audio to just over 4 gigabytes. Files larger than that are malformed, but should be read correctly using this option.
๐ Beware though โ it could misinterpret any data following the audio chunk as audio. Rude.
--replay-gainโ calculate ReplayGain values and store them as FLAC tags, similar tovorbisgain. Title gains/peaks get computed for each input file, and an album gain/peak gets computed for all files together. 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,18.9,22.05,24,28,32,36,37.8,44.1,48,56,64,72,75.6,88.2,96,112,128,144,151.2,176.4,192,224,256,288,302.4,352.8,384,448,512,576, or604.8kHz. Also note that this option may leave a few extra bytes in aPADDINGblock, since the exact size of the tags isn't known until all files are processed. And one more thing: this option cannot be used when encoding to standard output (stdout). Sorry, streamers. ๐ญ--cuesheet=FILENAMEโ import the given cuesheet file and store it in aCUESHEETmetadata block. This option may only be used when encoding a single file. A seekpoint gets added for each index point in the cuesheet to theSEEKTABLE, unless--no-cued-seekpointsis specified. ๐ฏ--picture={FILENAME|SPECIFICATION}โ import a picture and store it in aPICTUREmetadata block. You can specify more than one--pictureoption. You can either give a filename for the picture file, or use a more complete specification form. TheSPECIFICATIONis a string whose parts are separated by|(pipe) characters. Some parts may be left empty to invoke default values. Specifying onlyFILENAMEis just shorthand for"||||FILENAME". For theSPECIFICATIONformat, go read the section Picture specification. ๐ผ๏ธโจ-S {#|X|#x|#s},--seekpoint={#|X|#x|#s}โ specifies point(s) to include in theSEEKTABLE, overriding the encoder's default choice of one per ten seconds (-s 10s). Here's the breakdown, bestie:- Using
#, a seek point at that sample number is added. - Using
X, a placeholder point is added at the end of the table. - Using
#x,#evenly spaced seek points get added, the first being at sample0. - Using
#s, a seekpoint is added every#seconds, where decimal points are locale-dependent, e.g.-s 9.5sor-s 9,5s.
- Using
Several -S options may be given; the resulting SEEKTABLE will contain all seekpoints specified (duplicates removed).
๐ Note:-S #xand-S #swill not work if the encoder can't determine the input size before starting. ๐ Note: if you use-S #with#being>=the number of samples in the input, there'll be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if the input size isn't determinable). Use--no-seektableif you want noSEEKTABLEat all.
-P #,--padding=#โ tell the encoder to write aPADDINGmetadata block of the given length (in bytes) after theSTREAMINFOblock. (Default: 8192 bytes, although 65536 for input above 20 minutes.) This is useful for later tagging, where you can write over thePADDINGblock instead of having to rewrite the entire file. Note that a block header of 4 bytes will come on top of the length you specified. ๐-T โFIELD=VALUEโ,--tag=โFIELD=VALUEโโ add a FLAC tag. The comment must adhere to the Vorbis comment spec; i.e. theFIELDmust contain only legal characters, terminated by anequalssign. Make sure to quote the content if necessary. This option may appear more than once to add several Vorbis comments.
โ ๏ธ NOTE: all tags will be added to all encoded files. Every single one. No cap. ๐
--tag-from-file=โFIELD=FILENAMEโโ it's giving--tag, but the value comes from a whole entire file bestie. FILENAME gets read verbatim and that becomes the tag value, and the contents get converted to UTF-8 from your local charset. Main character use case: stashing a cuesheet inside a tag, like--tag-from-file=โCUESHEET=image.cueโ. Do not try to store binary data in tag fields! Use APPLICATION blocks for that, fr fr. ๐
โจ FORMAT OPTIONS โจ
okay so the defaults, listen up: encoding defaults to FLAC and not OGG. Decoding defaults to WAVE โ more specifically WAVE_FORMAT_PCM for mono/stereo with 8/16 bits, and WAVE_FORMAT_EXTENSIBLE otherwise โ except: it will be overridden by chunks found by --keep-foreign-metadata-if-present or --keep-foreign-metadata. slay. ๐ฆ
--oggโ when you're encoding, generate Ogg FLAC output instead of native FLAC. Ogg FLAC streams are just FLAC streams wrapped in an Ogg transport layer, no cap. The resulting file should have an.ogaextension and will still be decodable by flac. When you're decoding, it forces the input to be treated as Ogg FLAC. This is so useful when you're piping input from stdin or when the filename does not end in.ogaor.ogg. ๐--serial-number=#โ when used with--ogg, this specifies the serial number to use for the first Ogg FLAC stream, which is then incremented for each additional stream. When encoding and no serial number is given, flac uses a random number for the first stream, then increments it for each additional stream. When decoding and no number is given, flac uses the serial number of the first page. ๐ฅ--force-aiff-format,--force-rf64-format,--force-wave64-formatโ for decoding: override the default output format and force output to AIFF / RF64 / WAVE64, respectively. This option is not needed if the output filename (as set by-o) ends with.aifor.aiff,.rf64and.w64respectively. The encoder auto-detects format and ignores this option. ๐--force-legacy-wave-format,--force-extensible-wave-formatโ instruct the decoder to output a WAVE file withWAVE_FORMAT_PCMandWAVE_FORMAT_EXTENSIBLErespectively, overriding the default choice. โจ--force-aiff-c-none-format,--force-aiff-c-sowt-formatโ instruct the decoder to output an AIFF-C file with format NONE and sowt respectively. ๐--force-raw-formatโ force input (when encoding) or output (when decoding) to be treated as raw samples, even if the filename suggests otherwise. sneaky, love that for you ๐
๐ raw format options ๐
When encoding from or decoding to raw PCM, format must be specified. no skipping this step bestie, it's not optional.
--sign={signed|unsigned}โ specify the sign of samples. ๐ฅ--endian={big|little}โ specify the byte order for samples. ๐ฆ--channels=#โ (Input only) specify number of channels. The channels must be interleaved, and in the order of the FLAC format (see the format specification); the encoder (/decoder) cannot re-order channels. ๐--bps=#โ (Input only) specify bits per sample (per channel: 16 for CDDA). โญ--sample-rate=#โ (Input only) specify sample rate (in Hz. Only integers supported.) ๐--input-size=#โ (Input only) specify the size of the raw input in bytes. This option is only compulsory when encoding from stdin and using options that need to know the input size beforehand (like,--skip,--until,--cuesheet). The encoder will truncate at the specified size if the input stream is bigger. If the input stream is smaller, it will complain about an unexpected end-of-file. ๐
๐ ANALYSIS OPTIONS ๐
--residual-textโ includes the residual signal in the analysis file. This will make the file very big, much larger than even the decoded file. like, huge huge. ๐ญ--residual-gnuplotโ generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe. This will create a lot of files. gnuplot must be installed separately. ๐ธ
๐ซ NEGATIVE OPTIONS ๐ซ
The following will negate an option previously given. yes bestie, they undo stuff you already asked for. periodt. ๐
--no-adaptive-mid-side--no-cued-seekpoints--no-decode-through-errors--no-delete-input-file--no-preserve-modtime--no-keep-foreign-metadata--no-exhaustive-model-search--no-force--no-lax--no-mid-side--no-ogg--no-padding--no-qlp-coeff-prec-search--no-replay-gain--no-residual-gnuplot--no-residual-text--no-seektable--no-silent--no-verify--no-warnings-as-errors
๐๏ธ ReplayGain application specification ๐๏ธ
The option --apply-replaygain-which-is-not-lossless[=<specification>] applies ReplayGain values while decoding.
WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS OPTION. ๐
This option is useful for example in transcoding media servers, where the client does not support ReplayGain. iykyk.
The <specification> is a shorthand notation for describing how to apply ReplayGain. All elements are optional โ defaulting to 0aLn1 โ but order is important. The format is:
[<preamp>][a|t][l|L][n{0|1|2|3}]
In which the following parameters are used:
- preamp: A floating point number in dB. This is added to the existing gain value. โจ
- a|t: Specify
ato use the album gain, ortto use the track gain. If tags for the preferred kind (album/track) do not exist but tags for the other (track/album) do, those will be used instead. ๐ฆ - l|L: Specify
lto peak-limit the output, so that the ReplayGain peak value is full-scale. SpecifyLto use a 6dB hard limiter that kicks in when the signal approaches full-scale. ๐ฅ - n{0|1|2|3}: Specify the amount of noise shaping. ReplayGain synthesis happens in floating point; the result is dithered before converting back to integer. This quantization adds noise. Noise shaping tries to move the noise where you won't hear it as much.
0means no noise shaping,1meanslow,2meansmedium,3meanshigh. ๐
For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB hard limit, low noise shaping. --apply-replaygain-which-is-not-lossless=3 means 3dB preamp, use album gain, no limiting, no noise shaping. ๐
flac uses the ReplayGain tags for the calculation. If a stream does not have the required tags or they can't be parsed, decoding will continue with a warning, and no ReplayGain is applied to that stream. ๐
๐ผ๏ธ Picture specification ๐ผ๏ธ
This described the specification used for the --picture option.
[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE
TYPE is optional; it is a number from one of:
- Other
- 32x32 pixels
file icon(PNG only) - Other file icon
- Cover (front)
- Cover (back)
- Leaflet page
- Media (e.g. label side of CD)
- Lead artist/lead performer/soloist
- Artist/performer
- Conductor
- Band/Orchestra
- Composer
- Lyricist/text writer
- Recording Location
- During recording
- During performance
- Movie/video screen capture
- A bright coloured fish ๐ (iconic, no notes)
- Illustration
- Band/artist logotype
- Publisher/Studio logotype
The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file. ๐
MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged. ๐
DESCRIPTION is optional; the default is an empty string. โจ
The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. ๐
FILE is the path to the picture file to be imported, or the URL if MIME type is -->. ๐ฆ
Specification examples: โ|image/jpeg|||../cover.jpgโ will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself. โ4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiffโ will embed the given URL, with type 4 (back cover), description โCDโ, and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. ๐
๐ธ Apodization functions ๐ธ
To improve LPC analysis, the audio data is windowed. An -A option applies the specified apodization function(s) instead of the default (which is โtukey(5e-1)โ, though different for presets -6 to -8.) Specifying one more function effectively means, for each subframe, to try another weighting of the data and see if it happens to result in a smaller encoded subframe. Specifying several functions is time-expensive, at typically diminishing compression gains. ๐
The subdivide_tukey(N) functions (see below) used in presets -6 to -8 were developed to recycle calculations for speed, compared to using a number of independent functions. Even then, a high number like N>4 or 5, will often become less efficient than other options considered expensive, like the slower -p, though results vary with signal. ๐ญ
Up to 32 functions can be given as comma-separated list and/or individual -A options. Any mis-specified function is silently ignored. Quoting a function which takes options (and has parentheses) may be necessary, depending on shell. Currently the following functions are implemented: bartlett, bartlett_hann, blackman, blackman_harris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall, rectangle, triangle, tukey(P), partial_tukey(N[/OV[/P]]), punchout_tukey(N[/OV[/P]]), subdivide_tukey(N[/P]), welch. ๐
For parameters P, STDDEV and OV, scientific notation is supported, e.g. tukey(5e-1). Otherwise, the decimal point must agree with the locale, e.g. tukey(0.5) or tukey(0,5) depending on your system. ๐
- For
gauss(STDDEV), STDDEV is the standard deviation (0<STDDEV<=5e-1). โญ - For
tukey(P), P (between 0 and 1) specifies the fraction of the window that is cosine-tapered; P=0 corresponds toโrectangleโand P=1 toโhannโ. ๐ partial_tukey(N)andpunchout_tukey(N)โ bestie, these two are largely obsoleted by the much more time-effectivesubdivide_tukey(N)(peep the next bullet, it's the moment ๐ ). They generateNfunctions, and each one spans a part of each block. Optional arguments? You get an overlapOV(<1, and yes it can be negative), likepartial_tukey(2/2e-1); and then a taper parameterP, likepartial_tukey(2/2e-1/5e-1).subdivide_tukey(N)โ okay so this is the glow-up: a more efficient reimplementation ofpartial_tukeyandpunchout_tukeytaken together, combining the windows they would generate up to the specifiedN. Specifyingsubdivide_tukey(3)entails atukey, apartial_tukey(2), apartial_tukey(3)and apunchout_tukey(3); specifyingsubdivide_tukey(5)will, on top of that, add apartial_tukey(4), apunchout_tukey(4), apartial_tukey(5)and apunchout_tukey(5)โ but all with tapering chosen to facilitate the re-use of computation. So thePparameter (defaulting to5e-1) is applied for the smallest used window: for example,subdivide_tukey(2/5e-1)results in the same taper as that oftukey(25e-2)andsubdivide_tukey(5)in the same taper as oftukey(1e-1). Obsessed, honestly. ๐ฅ
๐ SEE ALSO
๐ AUTHOR
This manual page was initially written by Matt Zimmerman <mdz@debian.org> for the Debian GNU/Linux system (but may be used by others). It has been kept up-to-date by the Xiph.org Foundation.
And that's the whole page, bestie โ you made it to the end ๐ซถ This is flac(1) from Version 1.5.0, and now you know it through and through. Go forth and encode, periodt. ๐โจ๐
๐ฆ where this page comes from
- fedora 43: flac 1.5.0-3.fc43 ยท BSD-3-Clause AND GPL-2.0-or-later AND GFDL-1.3-or-later
- fedora 43: flac 1.5.0-5.fc43 ยท BSD-3-Clause AND GPL-2.0-or-later AND GFDL-1.3-or-later
- fedora 44: flac 1.5.0-8.fc44 ยท BSD-3-Clause AND GPL-2.0-or-later AND GFDL-1.3-or-later
- fedora 44: flac 1.5.0-8.fc44 ยท BSD-3-Clause AND GPL-2.0-or-later AND GFDL-1.3-or-later
- nixpkgs unstable: flac 1.5.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms