FFmpeg Sidechain Compressor Settings Guide
This article provides an overview of configuring the
sidechaincompress audio filter in FFmpeg to create dynamic
audio ducking, such as lowering background music beneath a voiceover. By
adjusting the threshold, ratio, attack, and release parameters, you can
control precisely when gain reduction triggers, how heavily the sound is
compressed, and how quickly the volume ducks and returns to normal.
Understanding the Filter Syntax
FFmpeg uses the sidechaincompress filter inside a
-filter_complex graph. The filter takes two audio inputs:
the first stream (input 0) is the audio you want to compress (e.g.,
background music), and the second stream (input 1) is the control signal
that triggers the compression (e.g., speech).
A standard command template looks like this:
ffmpeg -i music.mp3 -i voice.mp3 -filter_complex "[0:a][1:a]sidechaincompress=threshold=0.03:ratio=4:attack=20:release=300[aout]" -map "[aout]" output.mp3Configuring the Key Parameters
1. Threshold
(threshold)
The threshold determines the input volume level of the
control signal that must be reached before compression is activated.
- Format: Expressed as a linear amplitude between
0.0and1.0(default is0.125), or in decibels by appendingdB(e.g.,-20dB). - Configuration: Lower values make the compressor
more sensitive, triggering gain reduction even on quiet sounds. Higher
values ensure that only loud peaks in the voiceover trigger ducking. A
typical starting point for spoken voice is between
0.03and0.1(roughly-30dBto-20dB).
2. Ratio (ratio)
The ratio sets the strength of the gain reduction
applied to the target track once the threshold is exceeded.
- Format: A number from
1.0to20.0(default is2.0), representing the compression ratio (e.g.,4means a 4:1 ratio). - Configuration: A ratio of
2:1to3:1offers subtle, natural ducking. Ratios between4:1and6:1provide standard broadcasting ducking, making dialogue clearly audible over loud music. Ratios above10:1act closer to a limiter, aggressively muting the background track whenever the key track is active.
3. Attack (attack)
The attack parameter defines how long it takes for the
gain reduction to fully engage once the trigger signal crosses the
threshold.
- Format: Expressed in milliseconds, ranging from
0.01to2000(default is20ms). - Configuration: For voice ducking, set the attack
fast enough that the initial syllables of speech are not obscured by
loud music, but not so fast that it causes an audible click or unnatural
drop. Values between
10msand50msare ideal for speech.
4. Release (release)
The release parameter sets the time it takes for the
compressed audio to restore to its original volume after the trigger
signal falls below the threshold.
- Format: Expressed in milliseconds, ranging from
0.01to9000(default is250ms). - Configuration: If the release is too short (under
100ms), the music will noticeably swell between words, creating a distracting "pumping" artifact. If it is too long (over1000ms), the music will take too long to return to its standard volume after speaking finishes. For natural speech pauses, values between250msand500msyield the best balance.
Recommended Baseline Configurations
Voiceover Ducking (Standard):
sidechaincompress=threshold=0.03:ratio=4:attack=20:release=350Drops music smoothly behind speech and maintains consistent background level between words.Aggressive Podcast Ducking:
sidechaincompress=threshold=0.02:ratio=8:attack=10:release=400Ensures heavy music instantly drops out of the way of soft-spoken dialogue.Subtle Ambient Ducking:
sidechaincompress=threshold=0.08:ratio=2.5:attack=50:release=250Gently nudges audio down without an obvious change in overall mix volume.