Compress Audio Dynamic Range with FFmpeg Compand

This article explains how to use the compand (compressor/expander) filter in FFmpeg to compress the dynamic range of an audio file. You will learn the basic syntax of the filter, understand its key parameters—such as attack/decay times, transfer function points, and make-up gain—and see a practical, copy-pasteable command-line example to level out your audio.

Understanding the FFmpeg Compand Filter

Dynamic range compression reduces the volume of loud sounds and amplifies quiet sounds, creating a more consistent overall volume. This is highly useful for podcasts, dialogue tracks, and movie audio where quiet whispers are too soft and explosions are too loud.

In FFmpeg, this is achieved using the compand audio filter. The basic syntax for the filter is:

compand=attacks:decays:points:[soft-knee:[gain:[volume:[delay]]]]

Key Parameters Explained

Practical Example Command

Below is a standard FFmpeg command used to compress dynamic range for a stereo audio file, making the quiet parts louder and the loud parts quieter:

ffmpeg -i input.mp3 -filter:a "compand=attacks=0.3|0.3:decays=0.8|0.8:points=-90/-90|-40/-30|-20/-15|0/-10:soft-knee=6:gain=0:volume=-90:delay=0.2" output.mp3

In this command: * -filter:a (or -af) applies the audio filter. * attacks=0.3|0.3 and decays=0.8|0.8 apply independent compression timing for the left and right stereo channels. * The points mapping squashes the dynamic range by pushing quiet parts up and limiting peaks. * delay=0.2 gives the compressor a 200-millisecond lookahead window to catch sudden peaks before they distort.