flac 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

flac 命令安装:


-bash/zsh: flac command not found

#Debian
apt-get install flac

#Ubuntu
apt-get install flac

#Alpine
apk add flac

#Arch Linux
pacman -S flac

#Kali Linux
apt-get install flac

#CentOS
yum install flac

#Fedora
dnf install flac

#OS X
brew install flac

#Raspbian
apt-get install flac

#Docker
docker run cmd.cat/flac flac

flac 命令补充说明:


flac 是命令行文件编码器/解码器。编码器当前支持将 RIFF WAVE、Wave64、RF64、AIFF、FLAC 或 Ogg FLAC 格式或原始交错样本作为输入。解码器当前可以输出为 RIFF WAVE、Wave64、RF64 或 AIFF 格式,或原始交错样本。

flac 仅支持线性 PCM 样本(换句话说:不支持 A-LAW 、uLAW 等),每个样本的输入必须在 4 到 24 位之间。这不是 FLAC 格式的限制,仅是参考编码器/解码器。

flac 命令语法:


下面列出 flac 命令的一般选项,其他选项请参考官网手册:

flac [ OPTIONS ] [ infile.wav | infile.aiff | infile.raw | infile.flac | infile.oga | infile.ogg | - ... ]
flac [ -d | --decode | -t | --test | -a | --analyze ] [ OPTIONS ] [ infile.flac | infile.oga | infile.ogg | - ... ]

flac 命令选项:


-v, --version
Show the flac version number

-h, --help
Show basic usage and a list of all options

-H, --explain
Show detailed explanation of usage and all options

-d, --decode
Decode (the default behavior is to encode)

-t, --test
Test a flac encoded file (same as -d except no decoded file is written)

-a, --analyze
Analyze a FLAC encoded file (same as -d except an analysis file is written)

-c, --stdout
Write output to stdout

-s, --silent
Silent mode (do not write runtime encode/decode statistics to stderr)

--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.

--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!

-w, --warnings-as-errors
Treat all warnings as errors (which cause flac to terminate with a non-zero exit code).

-f, --force
Force overwriting of output files. By default, flac warns that the output file already exists and continues to the next file.

-o filename, --output-name=filename
Force the output file name (usually flac just 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).

--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.

--keep-foreign-metadata
If encoding, save WAVE 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).

--skip={#|mm:ss.ss}
Skip over the first number of samples of the input. This works for both encoding and decoding, but not testing. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second.

--until={#|[+|-]mm:ss.ss}
Stop at the given sample number for each input file. This works for both encoding and decoding, but not testing. The given sample number is not included in the decoded output. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. If a '+' (plus) sign is at the beginning, the --until point is relative to the --skip point. If a '-' (minus) sign is at the beginning, the --until point is relative to end of the audio.

--ogg
When encoding, generate Ogg FLAC output instead of native FLAC. Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer. The resulting file should have an '.oga' extension and will still be decodable by flac.
When decoding, force the input to be treated as Ogg FLAC. This is useful when piping input from stdin or when the filename does not end in '.oga' or '.ogg'.

--serial-number=#
When used with --ogg, 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.

flac 命令参数:


目标音频文件

flac 命令实例:


flac 将 wav 文件编码为 flac(这将在与 wav 文件相同的位置创建一个 flac 文件):

flac path/to/file.wav

flac 将 wav 文件编码为 flac,指定输出文件:

flac -o path/to/output.flac path/to/file.wav

将 flac 文件解码为 wav,指定输出文件:

flac -d -o path/to/output.wav path/to/file.flac

测试一个 flac 文件的正确编码:

flac -t path/to/file.flac

flac 命令扩展阅读:




flac 命令评论