Skip to content
FramesField
FIX 24 · FFMPEG & DELIVERY
raw .md ↗ Verified Dec 1, 2026

Fix Aggressive Audio Ducking Pumping in FFmpeg

Direct Fix: Pre-attenuate music by -15 dB, bandpass-filter a split sidechain key (120–3500 Hz), set sidechaincompress to linear threshold=0.03 (~-30 dBFS), ratio=4, detection=rms, knee=5, attack=35ms, release=550ms, makeup=1, disable amix normalization (normalize=0), and cap output with loudnorm.
Exact Error / Visual Signature
Audible volume pumping/breathing between spoken syllables | [sidechaincompress] threshold=0.001 + ratio=20 + release=50ms -> -24 dB gain drops, vocal clipping, and +6 dB surge after speech ends
OBSERVED SYMPTOM

Your automated FFmpeg narration-over-music mix sounds amateurish: the background track slams nearly silent on every consonant, surges back up loudly during tiny half-second pauses between words, distorts on loud vocal peaks, or jumps abruptly in level the instant the narrator finishes speaking.

TECHNICAL ROOT CAUSE

FFmpeg sidechaincompress expects threshold as linear amplitude (0.000976563 to 1.0) rather than decibels, defaults to short release times that track syllable gaps instead of spoken phrases, and produces harsh gain jumps or clipping when paired with unattenuated 0 dBFS music beds, default amix normalize=1, or unfiltered plosives in the sidechain key.

Copy-Paste Verified Fix

Broadcast-Clean FFmpeg Sidechain Ducking & Loudness Conform Script fix-smooth-audio-ducking.sh
#!/usr/bin/env bash
set -euo pipefail

VIDEO="${1:-video.mp4}"
VOICE="${2:-voice.wav}"
MUSIC="${3:-music.wav}"
OUT="${4:-final_smooth_ducking.mp4}"

# Threshold reference (linear amplitude -> dBFS):
#   0.015 ≈ -36 dBFS (sensitive, quiet narration)
#   0.030 ≈ -30 dBFS (recommended studio default for TTS / lav mic)
#   0.050 ≈ -26 dBFS (noisy room or loud voiceover)
ffmpeg -y -i "$VIDEO" -i "$VOICE" -stream_loop -1 -i "$MUSIC" \
  -filter_complex "\
    [1:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,highpass=f=80,apad,asplit=2[vo_mix][vo_key]; \
    [vo_key]highpass=f=120,lowpass=f=3500[vo_sc]; \
    [2:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,volume=-15dB[bed_base]; \
    [bed_base][vo_sc]sidechaincompress=threshold=0.03:ratio=4:attack=35:release=550:knee=5:detection=rms:makeup=1[bed_ducked]; \
    [vo_mix][bed_ducked]amix=inputs=2:duration=longest:normalize=0,loudnorm=I=-14:TP=-1.0:LRA=7[aout]" \
  -map 0:v:0 -map "[aout]" -shortest \
  -c:v copy -c:a aac -b:a 192k -ar 48000 -ac 2 -movflags +faststart \
  "$OUT"

Before vs. After (Broken Pattern vs. Verified Fix)

Broken · Pumping Filtergraph (Peak Detection + 0.001 Threshold + 50ms Release + Default amix)
ffmpeg -i video.mp4 -i voice.wav -i music.wav \
  -filter_complex "[2:a][1:a]sidechaincompress=threshold=0.001:ratio=20:attack=5:release=50:detection=peak:makeup=2[bg];[bg][1:a]amix=inputs=2[aout]" \
  -map 0:v -map "[aout]" -shortest pumping_distorted.mp4
Verified · Broadcast-Smooth Ducking (Pre-Leveled Bed + Bandpass Key + RMS + 550ms Release + loudnorm)
ffmpeg -y -i video.mp4 -i voice.wav -stream_loop -1 -i music.wav \
  -filter_complex "[1:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,highpass=f=80,apad,asplit=2[vo_mix][vo_key];[vo_key]highpass=f=120,lowpass=f=3500[vo_sc];[2:a]aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo,volume=-15dB[bed];[bed][vo_sc]sidechaincompress=threshold=0.03:ratio=4:attack=35:release=550:knee=5:detection=rms:makeup=1[ducked];[vo_mix][ducked]amix=inputs=2:duration=longest:normalize=0,loudnorm=I=-14:TP=-1.0:LRA=7[aout]" \
  -map 0:v:0 -map "[aout]" -shortest -c:v copy -c:a aac -b:a 192k -ar 48000 -movflags +faststart smooth_mix.mp4

Why this works: Using RMS envelope detection with a 120–3500 Hz bandpass key, soft knee=5, and 550ms release holds the pre-leveled score smoothly beneath full spoken phrases while loudnorm locks -14 LUFS and -1.0 dBTP with zero clipping.

Under the Hood

Why This Failure Happens in Real Pipelines

Most broken FFmpeg ducking scripts fail because of linear-versus-decibel confusion inside sidechaincompress. Passing threshold=0.001 tells FFmpeg to engage compression at -60 dBFS—so faint room tone, microphone breaths, and ElevenLabs TTS noise floors trigger heavy ducking continuously. Combining that tiny threshold with ratio=15 or ratio=20, detection=peak, and release=50 milliseconds forces the compressor to slam the music bed down by 18 to 24 dB on every hard consonant and snap straight back to full gain during brief 150-millisecond pauses between words, creating the unmistakable rhythmic breathing artifact known as pumping.

A second frequent mistake is wiring the raw, full-bandwidth voiceover directly into the sidechain detector—or accidentally reversing the two filter inputs so [vo][bg] ducks the speaker instead of the score. Remember that FFmpeg sidechaincompress always treats input #0 as the main signal to attenuate (the music bed) and input #1 as the sidechain trigger (the narration). Conditioning a dedicated sidechain key branch via asplit=2 and filtering only the detector path with highpass=f=120,lowpass=f=3500 removes sub-bass plosives and sharp sibilant spikes from gain detection without altering the audible vocal timbre.

The final source of distortion and level jumps happens downstream at the mix bus. Mastered AI music from Suno v6 or stock libraries routinely arrives brickwall-limited at -8 to -6 LUFS. Feeding full-scale music straight into sidechaincompress without pre-attenuating it first (volume=-15dB), leaving makeup above 1, or omitting normalize=0 inside amix causes inter-sample clipping and sudden +6 dB volume surges when narration hits end-of-file. Pre-leveling the score, padding the voiceover with apad, switching sidechaincompress to detection=rms with a wide soft knee (knee=5), moderate ratio=4, smooth attack=35ms, and musical release=550ms, then conforming the summed mix with loudnorm=I=-14:TP=-1.0:LRA=7 yields transparent broadcast ducking.

Step-by-Step Resolution & Verification

  1. 01

    Pre-level the music bed and verify input order ([main][sidechain])

    Confirm the music bed enters sidechaincompress first and the voiceover enters second. Attenuate mastered music by -14 dB to -16 dB before compression so the ducking circuit only shaves 4 to 8 dB smoothly rather than slamming 24 dB.

  2. 02

    Bandpass-filter the sidechain key and switch to RMS + 550ms release

    Split the voiceover with asplit=2 so the audible track stays full-range while the detector branch filters strictly to 120–3500 Hz speech fundamentals. Pair threshold=0.03, ratio=4, knee=5, detection=rms, attack=35, and release=550.

  3. 03

    Disable amix normalization, pad voiceover, and audit true peak

    Keep apad on the narration track and normalize=0 inside amix so music never jumps +6 dB when speech ends, then verify with the loudnorm summary probe that True Peak remains at or below -1.0 dBTP.

Verification Check · Measure Final Integrated Loudness, True Peak & Dynamic Range
ffmpeg -hide_banner -i final_smooth_ducking.mp4 -af "loudnorm=I=-14:TP=-1.0:LRA=7:print_format=summary" -f null - 2>&1 | grep -E "Input Integrated|Input True Peak|Input LRA"
Expected healthy output:
Input Integrated:    -14.2 LUFS
Input True Peak:      -1.1 dBTP   # Must stay <= -1.0 dBTP (zero digital clipping)
Input LRA:             4.8 LU     # Controlled, smooth dynamics without pumping spikes

How to Prevent This Error From Recurring

GUARDRAIL 01

Never set sidechaincompress threshold below 0.015 without gating room tone

Linear threshold values below 0.01 (-40 dBFS) react to mic hiss, keyboard noise, and TTS breaths, keeping music permanently crushed or jittering unpredictably.

GUARDRAIL 02

Always pair release=450–700ms with detection=rms for dialogue mixes

Phrase-length release times bridge normal 200–350ms gaps between spoken words so listeners perceive an intentional musical bed rather than mechanical breathing.

GUARDRAIL 03

Keep makeup=1 and let trailing loudnorm handle final delivery gain

Raising makeup inside sidechaincompress amplifies quiet music tails into audible distortion; delegating final loudness to EBU R128 loudnorm guarantees clean -1.0 dBTP headroom.

Troubleshooting FAQs

How do I convert decibels into FFmpeg sidechaincompress linear threshold values?
Use the formula linear = 10^(dB / 20). For example, -20 dBFS equals 0.10, -26 dBFS equals 0.05, -30 dBFS equals 0.0316, -36 dBFS equals 0.0158, and -40 dBFS equals 0.01. Most clean studio voiceovers sit cleanly between 0.025 and 0.04.
Why did my voiceover get quieter instead of the music bed?
You passed the two input labels in reverse order. FFmpeg sidechaincompress always attenuates the FIRST input pad ([main]) based on the volume of the SECOND input pad ([sidechain]), so the wiring must always be [music][voice]sidechaincompress.
Can I make the ducking even gentler for cinematic brand films?
Yes. Lower ratio from 4 to 2.8, raise release to 700 milliseconds, and add mix=0.75 inside sidechaincompress to blend 25% of the uncompressed music bed back in for subtle parallel ducking.
Why does single-pass loudnorm sometimes change loudness slightly on very short 5-second clips?
Single-pass EBU R128 loudnorm uses dynamic lookahead that can fluctuate on clips under 8 seconds. For ultra-consistent 5-second ad variants, run a two-pass loudnorm measurement (measured_I, measured_TP, measured_LRA, measured_thresh) with linear=true.
How do I keep subtle pauses in ElevenLabs narration from releasing music too early?
Increase release from 550 to 750 milliseconds and insert a gentle dynamics floor or dynaudnorm=f=150:g=15 on the voiceover chain before asplit=2 so quieter trailing syllables keep the sidechain detector steadily engaged.
Use this page in AI tools or notes
raw .md