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

Configuring 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.0 and 1.0 (default is 0.125), or in decibels by appending dB (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.03 and 0.1 (roughly -30dB to -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.0 to 20.0 (default is 2.0), representing the compression ratio (e.g., 4 means a 4:1 ratio).
  • Configuration: A ratio of 2:1 to 3:1 offers subtle, natural ducking. Ratios between 4:1 and 6:1 provide standard broadcasting ducking, making dialogue clearly audible over loud music. Ratios above 10:1 act 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.01 to 2000 (default is 20ms).
  • 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 10ms and 50ms are 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.01 to 9000 (default is 250ms).
  • 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 (over 1000ms), the music will take too long to return to its standard volume after speaking finishes. For natural speech pauses, values between 250ms and 500ms yield the best balance.
  • Voiceover Ducking (Standard): sidechaincompress=threshold=0.03:ratio=4:attack=20:release=350 Drops music smoothly behind speech and maintains consistent background level between words.

  • Aggressive Podcast Ducking: sidechaincompress=threshold=0.02:ratio=8:attack=10:release=400 Ensures 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=250 Gently nudges audio down without an obvious change in overall mix volume.