>FFmpegLab
FFmpeg Guide

Sidechain Compression & Audio Ducking in FFmpeg

Auto-duck background music when voiceover plays, create pumping EDM effects, and build professional audio mixes with the sidechaincompress filter.

Sidechain compression is one of the most powerful—and most misunderstood—audio techniques in FFmpeg. It's the secret behind:

Yet the FFmpeg documentation for sidechaincompress is sparse. Most users don't even know the filter exists, and those who do struggle to get it working because the filtergraph syntax is unforgiving.

This guide changes that. You'll learn exactly how sidechain compression works, how to tune the parameters for your specific use case, and how to debug the inevitable issues that arise.

Key takeaways

The Gap: Podcasters, Videographers, and EDM Producers Left in the Dark

The FFmpeg documentation for sidechaincompress is a single paragraph that lists parameters without any real-world examples[reference:2]. Search online, and you'll find scattered Stack Overflow posts with cryptic commands that "sort of work" but never explain why[reference:3].

This gap affects three distinct communities:

This guide bridges that gap with clear explanations, working examples, and troubleshooting steps.

The Symptom: "Why Can't I Hear the Voiceover?"

You've rendered your podcast or video. The background music sounds great—but the voiceover is buried. You try lowering the music volume, but then it's too quiet when nobody's speaking. You need the music to automatically dip when someone talks and rise again when they stop.

This is exactly what sidechain compression does. But without the right filtergraph, you'll end up with silence, distortion, or no effect at all.

Core Concepts: What Is Sidechain Compression?

A compressor reduces the volume of a signal when it exceeds a certain threshold. Normally, the compressor listens to the same signal it's compressing.

Sidechain compression flips this: the compressor listens to a different signal (the "sidechain") to decide when to compress the main signal.[reference:4]

In practice:

The sidechaincompress filter takes two input streams and returns one output stream. The first input is the signal to be processed (e.g., music). The second input is the sidechain signal that controls the compression (e.g., voiceover).[reference:5]

The sidechaincompress Filter Parameters

Here's every parameter you need to know, with practical guidance for each.[reference:6]

ParameterDefaultWhat it doesWhen to adjust
level_in 1.0 Input gain for the main signal Increase if the music is too quiet before compression
level_sc 1.0 Input gain for the sidechain signal Increase if the sidechain isn't triggering enough compression
threshold 0.125 Level above which compression kicks in Lower = more ducking. For voice ducking, try 0.001–0.01
ratio 2 How much compression to apply (1:2 means 4dB over threshold → 2dB over) Higher = more aggressive. For ducking, 10–20 is common
attack 20 ms How fast compression starts after threshold is exceeded Lower = faster ducking. For voice, 5–10 ms works well
release 250 ms How fast compression stops after signal drops below threshold Lower = faster recovery. For voice, 100–200 ms
makeup 1.0 Amplification applied after compression Increase to bring the compressed signal back to a normal level
knee 2.82843 Softens the transition around the threshold Higher = smoother compression. Leave at default unless you need a specific curve
link average Whether to use average or maximum level of sidechain channels average for stereo music, maximum for more aggressive triggering
detection rms Peak or RMS detection rms is smoother; peak is more responsive
mode downward Downward or upward compression Leave as downward for ducking
mix 1.0 How much compressed signal to mix with dry signal 1.0 = fully compressed; lower values blend with original

Practical Example 1: Podcast Ducking

Let's duck background music when a voiceover speaks. This is the most common use case.

ShareRenders { } Code Config
Generated Code Logs Customize
# Basic voice ducking — music dips when voice is present
ffmpeg -i background_music.mp3 -i voiceover.wav \
-filter_complex "[0:a][1:a]sidechaincompress=threshold=0.003:ratio=20:attack=5:release=150:makeup=2[out]" \
-map "[out]" -c:a libmp3lame -b:a 192k output_ducked.mp3

What's happening here?

Important: The threshold value depends on your voiceover's loudness. Start with 0.003 and adjust up or down based on how much ducking you hear.[reference:9]

Practical Example 2: EDM Pumping Effect

In electronic music, sidechain compression creates a "pumping" effect where the entire track pulses with the kick drum.

ShareRenders { } Code Config
Generated Code Logs Customize
# EDM pumping — track pulses with the kick drum
ffmpeg -i full_track.wav -i kick_drum.wav \
-filter_complex "[0:a][1:a]sidechaincompress=threshold=0.05:ratio=8:attack=1:release=50:makeup=1.5[out]" \
-map "[out]" -c:a pcm_s16le output_pumping.wav

Key differences from podcast ducking:

Advanced: Multi-Track & Time-Aligned Ducking

Real-world projects often have multiple audio tracks with different timing. Here's how to handle them.

Delaying the Sidechain (e.g., inserting a voiceover at a specific time)

Use adelay to place the voiceover at the right position, and apad to extend it with silence so the compression continues throughout.[reference:10]

ShareRenders { } Code Config
Generated Code Logs Customize
# Voiceover starts at 3 seconds — ducking only happens after that
ffmpeg -i background_music.mp3 -i voiceover.wav \
-filter_complex "[1:a]adelay=3000|3000,apad,asplit=2[sc][mix];[0:a][sc]sidechaincompress=threshold=0.003:ratio=20[bg];[bg][mix]amix=duration=shortest[out]" \
-map "[out]" output_ducked.mp3

Breaking it down:

Matching Sample Rates

Different audio files may have different sample rates. Always resample to match:

ShareRenders { } Code Config
Generated Code Logs Customize
# Resample both streams to 44.1kHz before sidechaining
ffmpeg -i music.mp3 -i voice.wav \
-filter_complex "[0:a]aresample=44100[music];[1:a]aresample=44100[voice];[music][voice]sidechaincompress=threshold=0.003:ratio=20[out]" \
-map "[out]" output.mp3

Debugging Common Sidechain Issues

Here are the most frequent problems users encounter with sidechaincompress—and how to fix them.

ProblemLikely CauseFix
No ducking effect (music stays at full volume) Threshold is too high; sidechain signal isn't triggering compression Lower threshold (try 0.001) or increase level_sc
Music is always quiet (ducking never releases) Threshold is too low; sidechain noise is triggering constant compression Raise threshold or check if the sidechain has background noise
Ducking sounds choppy Attack and release are too fast Increase attack (e.g., 10–20 ms) and release (e.g., 200–300 ms)
Ducking is too subtle Ratio is too low Increase ratio to 15–20 for aggressive ducking
Sync issues (ducking happens too early or too late) Audio streams aren't aligned in time Use adelay to adjust timing. Visualize the waveforms in the FFmpegLab IDE
Distortion after compression makeup gain is too high, causing clipping Lower makeup or add a compand filter after compression
Only one channel is ducked (stereo imbalance) Sidechain is mono but main signal is stereo Use pan to duplicate the mono sidechain to both channels

Visualize Sidechain with the FFmpegLab IDE

Sidechain compression is much easier to debug with visual feedback. The FFmpegLab IDE lets you:

Here's how a typical sidechain ducking session looks in the FFmpegLab IDE.

ShareRenders { } Code Config
Generated Code Logs Customize
# Live sidechain preview with gain reduction visualization
ffmpeg -i music.mp3 -i voice.wav \
-filter_complex "[0:a][1:a]sidechaincompress=threshold=0.003:ratio=20:attack=5:release=150:makeup=2[out]" \
-map "[out]" -f wav - | ffplay -i -

The IDE shows you exactly what's happening at each step—from the original music, to the voiceover triggering compression, to the final ducked output. You can adjust parameters with sliders and hear the result in real time.

Frequently Asked Questions (FAQ)

What's the difference between sidechaincompress and acompressor?

acompressor compresses a single audio stream based on its own signal. sidechaincompress compresses the first input stream based on the level of the second input stream. Sidechain compression is what enables ducking and pumping effects.[reference:15]

Why isn't my sidechain compression working?

The most common reasons are: (1) threshold is too high for your sidechain signal—try 0.001–0.01; (2) sample rates don't match—use aresample; (3) the sidechain stream is silent—check your input files; (4) you're using the wrong stream order—input 0 is the main signal, input 1 is the sidechain.[reference:16]

How do I duck stereo music with a mono voiceover?

The sidechaincompress filter handles this automatically. The mono voiceover will trigger compression on both stereo channels of the music. If you need to adjust the link behavior, use the link parameter—average (default) works well for stereo music.[reference:17]

Can I use sidechain compression with video files?

Yes. Use -filter_complex to process the audio streams independently from the video. The video stream can be passed through with -map 0:v while the audio is processed with sidechaincompress.

What's the difference between ducking and sidechain compression?

Ducking is a use case of sidechain compression—specifically, reducing the volume of background music when a voiceover is present. Sidechain compression is the technique—using one audio signal to control the compression of another. Ducking is the most common application, but sidechain compression is also used for EDM pumping, de-essing, and creative effects.

Final Word

Sidechain compression is one of FFmpeg's most powerful audio features—and one of the most under-documented. With the sidechaincompress filter, you can create professional ducking effects for podcasts, pumping EDM tracks, and dialogue that cuts through the mix.

The key is understanding the parameters: threshold controls when compression kicks in; ratio controls how much; attack and release control how fast. Tune these for your specific content, and you'll get perfect results every time.

With the FFmpegLab IDE's visual feedback, you can experiment, debug, and perfect your sidechain settings without the guesswork. Upload your tracks, adjust the sliders, and hear the result in real time.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.