How to Adjust FLAC Compression Level in FFmpeg
This article explains how to change the compression level when encoding audio to FLAC using FFmpeg. You will learn the exact command-line syntax to adjust this setting, understand how the compression scale from 0 to 8 impacts file size and encoding speed, and see practical examples of high-compression and fast-encoding commands.
In FFmpeg, you control the FLAC compression level using the
-compression_level option (or the alias
-lpc_passes). FLAC is a lossless format, meaning that
changing the compression level only affects the encoding speed and the
resulting file size, not the audio quality. The compression scale ranges
from 0 to 8:
- 0 (Fastest): Minimal compression, resulting in the fastest encoding speeds but larger file sizes.
- 5 (Default): The standard balance between encoding speed and file size compression.
- 8 (Smallest): Maximum compression, resulting in the smallest possible file size but requiring the longest encoding time.
Basic Syntax
To set the compression level, place the
-compression_level flag after specifying the FLAC encoder
(-c:a flac):
ffmpeg -i input.wav -c:a flac -compression_level 5 output.flacExamples
Maximum Compression (Level 8) If you want to save as much disk space as possible and do not mind a longer encoding process, use level 8:
ffmpeg -i input.wav -c:a flac -compression_level 8 output.flacFastest Encoding (Level 0) If you are encoding large batches of files and speed is your main priority, use level 0:
ffmpeg -i input.wav -c:a flac -compression_level 0 output.flacBy adjusting this single parameter, you can easily optimize FFmpeg’s FLAC encoder to suit either high-speed workflows or storage-efficient archiving.