Split the voice with asplit, key sidechaincompress on the music with one copy, then amix: music sinks about 17 dB under speech and returns in pauses. As one ReelSDK call, an 11-second clip cost under a fifth of a cent at $0.02 per compute minute.
Duck music under a voice with ffmpeg
A threshold of 0.03 and a ratio of 8 let the voice push the music down by itself, with no volume curve to draw. ReelSDK's slideshow renderer ducks its music under voiceovers with this exact graph, a quick attack and a slower release included.
GuidesUpdated
ffmpeg -i in.mp4 -i music.mp3 -filter_complex \
"[0:a]asplit=2[vo][key];\
[1:a][key]sidechaincompress=threshold=0.03:ratio=8:attack=15:release=350:makeup=1[duck];\
[vo][duck]amix=inputs=2:duration=first:normalize=0[a]" \
-map 0:v -map "[a]" -c:v copy -c:a aac -b:a 192k ducked.mp4The voice is split in two: one copy goes into the mix, the other drives the compressor on the music. The video is copied.
Variations
The other commands you will need
Check the loudness after
ebur128 prints the integrated loudness and true peak of the result. Ours: -14.1 LUFS and -1.3 dB.
measure ffmpeg -i ducked.mp4 -af ebur128=peak=true -f null -
The flags
The options in this graph
| Flag | What it does | Used here |
|---|---|---|
asplit=2 | Makes two copies of the voice: one to hear, one to listen to | Graph |
[1:a][key] | The music is compressed, the voice copy is the key; order matters | Graph |
threshold=0.03 | Key level where ducking starts, about -30.5 dB; the default 0.125 is louder | Graph |
ratio=8 | How hard the music is pushed down above the threshold; the default is 2 | Graph |
attack=15 | Milliseconds to duck once the voice starts; the default is 20 | Graph |
release=350 | Milliseconds to come back up after it stops; the default is 250 | Graph |
amix=...:duration=first:normalize=0 | Adds voice and ducked music, as long as the voice, without halving them | Graph |
ebur128=peak=true | Measures loudness and true peak | Check |
Sources: ffmpeg filters: sidechaincompress, ffmpeg filters: amix, checked November 2026.
How the sidechain works
sidechaincompress takes two inputs. It compresses the first, and decides how much from the level of the second. Put the music first and the voice second, and the music gets quieter exactly when the voice is loud. Swap them and you duck the voice under the music instead.
The voice is needed twice, once as the key and once in the final mix, so asplit makes the two copies. The key copy is never heard.
What it did to our clip
We compared the ducked music with the original, a tenth of a second at a time. Under speech it sat about 17 dB lower; in the pauses, only about 2 dB. That is the effect you want: the voice stays clear and the music fills the gaps.
The plain mix without the compressor peaked at -0.5 dB, close to clipping. The ducked mix came out at -14.1 LUFS with more headroom, so ducking also keeps the sum under control.
Tuning the four numbers
threshold is where the compressor starts listening. The default 0.125 only reacts to loud speech; 0.03 catches a normal voice. ratio sets how far the music goes down; 8 is a firm duck. attack and release are how fast it moves, in milliseconds. A short attack catches the first word; a longer release stops the music from pumping up between words.
These are the values our own slideshow renderer uses under voiceovers. If the music still feels loud, lower it before the compressor with volume, as in mixing audio.
Without installing ffmpeg
The same command as one API call
Send the same graph to POST /v1/ffmpeg with both URLs in inputs. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in a few seconds and cost under a fifth of a cent. Our slideshow renderer ducks its music with the same graph.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"in.mp4": "https://api.reelsdk.com/f/lib/demo/clip.mp4",
"music.mp3": "https://api.reelsdk.com/f/lib/music/chill/calm-currents.mp3"
},
"args": [
"-i", "in.mp4", "-i", "music.mp3", "-filter_complex",
"[0:a]asplit=2[vo][key];[1:a][key]sidechaincompress=threshold=0.03:ratio=8:attack=15:release=350:makeup=1[duck];[vo][duck]amix=inputs=2:duration=first:normalize=0[a]",
"-map", "0:v", "-map", "[a]", "-c:v", "copy", "-c:a", "aac", "-b:a",
"192k", "ducked.mp4"
],
"outputs": ["ducked.mp4"]
}'FAQ
Questions, answered
How do I lower music when someone talks with ffmpeg?
Use sidechaincompress with the music as the first input and the voice as the second, then amix the voice back in: [0:a]asplit=2[vo][key];[1:a][key]sidechaincompress=threshold=0.03:ratio=8[duck];[vo][duck]amix=inputs=2:duration=first:normalize=0.
Why do I need asplit?
The voice feeds two places: the compressor's key input and the final mix. asplit gives each one its own copy.
Why does my ducked music pump up and down?
The release is too short, so the music jumps back between words. Raise release (we use 350 ms) or lower the ratio.
Can I duck audio with an API?
Yes. POST the same graph to https://api.reelsdk.com/v1/ffmpeg with the video and music URLs in inputs. It costs $0.02 per compute minute, billed per second, and failed jobs are free.
- Add music to videoMix a looped music track under a video's own audio with ducking and a fade-out in one ffmpeg call, for a fraction of a cent.
- Narrated slideshow APISend images and a script; get back a video narrated in one of 40 voices, with captions and music under the voice.
- Mix two audio tracks with ffmpegLay music under a voice or combine any two tracks with amix, set their levels with weights, and avoid the three defaults that bite.
- Normalize audio loudness with ffmpeg loudnormBring any track to a loudness target such as -14 LUFS with loudnorm: one pass, or a measured second pass that keeps the dynamics.
- Replace the audio in a video with ffmpegSwap a video's soundtrack for another file with -map and -shortest, keep the picture untouched, and pad audio that runs short.
- ffmpeg -filter_complex explainedLabels, commas and semicolons: how a filtergraph wires inputs to outputs, with four working graphs and the errors they fix.
- FFmpeg onlineRun your own ffmpeg command on your files in the browser, free and without installing or uploading anything.
- Slideshow API: photos to a narrated video for $0.03 a minuteSend 1 to 100 photo URLs and get an MP4 with Ken Burns motion, transitions, an AI voiceover, music and captions. $0.03 per output minute, plus $0.05 per 1,000 voiceover characters.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
