How to Reduce Volume Differences with FFmpeg’s acompressor
The FFmpeg acompressor filter lowers only the loud parts, which reduces the difference in volume. It is useful for audio that you have to keep adjusting the volume for, such as recordings where speakers are at different loudness levels, or videos with sudden loud sounds.
In my test environment, I created audio that alternates between a loud section and a quiet section with a 20 dB difference, changed the acompressor settings, and measured how much the difference shrank. With the default settings, the difference shrank only to 14.37 dB, but with threshold=-30dB:ratio=4 it shrank to 5.07 dB.
The test environment was Ubuntu 24.04.5 with FFmpeg 6.1.1 (Ubuntu package 6.1.1-3ubuntu5). The audio was a 440 Hz sine wave generated with FFmpeg's aevalsrc (48 kHz, 16-bit, mono, 12 seconds). The sections at 0–3 s and 6–9 s had an amplitude of 0.05 (RMS -29.03 dBFS), and the sections at 3–6 s and 9–12 s had an amplitude of 0.5 (RMS -9.03 dBFS), so the loud sections were 20 dB louder than the quiet ones. I converted the audio to 16-bit PCM and calculated the RMS and peak for each section with a Python script. I did not test human speech, music recordings, stereo audio, or the knee, detection, link, and mix options.
acompressor reduces the part above threshold by ratio
According to the official acompressor documentation, when the sound becomes louder than threshold, this filter divides the amount above the threshold by ratio to make it quieter. The documentation gives an example: if threshold is -12 dB, the sound is -6 dB, and ratio is 2, the output is -9 dB.
Sounds that are well below threshold remain unchanged. Only the loud sounds are lowered, so the difference between loud and quiet sounds shrinks. The official documentation also describes a knee option, which makes the effect gradual near threshold. In my test, with threshold=-27dB:ratio=4, the quiet section (-29.03 dBFS), which was about 2 dB below threshold, was also lowered to -29.95 dBFS.
The default threshold is 0.125 (about -18 dB) and the default ratio is 2. The result of running it with no options is shown below.
ffmpeg -i src.wav -af "acompressor" def.wav
| Section | Original | After default settings |
|---|---|---|
| Quiet section (2–3 s) | -29.03 dBFS | -29.03 dBFS |
| Loud section (5–6 s) | -9.03 dBFS | -14.66 dBFS |
| Difference | 20.00 dB | 14.37 dB |
The quiet section is below -18 dB, so it stayed the same as the original. The loud section dropped by about 5.6 dB, and the difference became 14.37 dB. To shrink the difference further, change threshold and ratio.
Lowering threshold and raising ratio shrinks the difference
threshold can be written as a 0–1 multiplier, but I could also write it in dB, such as -30dB. The results for threshold=-30dB and for threshold=0.031623, which is the same value written as a multiplier, matched to two decimal places for the measured RMS and peak (the MD5 of the files was different).
ffmpeg -i src.wav -af "acompressor=threshold=-30dB:ratio=4" r4.wav
These are the results with threshold set to -30 dB and various ratio values.
| Setting | Quiet section | Loud section | Difference |
|---|---|---|---|
| Default (-18 dB, ratio=2) | -29.03 dBFS | -14.66 dBFS | 14.37 dB |
| threshold=-30dB (ratio=2) | -30.68 dBFS | -20.63 dBFS | 10.05 dB |
| threshold=-30dB:ratio=4 | -31.50 dBFS | -26.43 dBFS | 5.07 dB |
| threshold=-30dB:ratio=8 | -31.91 dBFS | -29.33 dBFS | 2.58 dB |
| threshold=-30dB:ratio=20 | -32.16 dBFS | -31.07 dBFS | 1.09 dB |

ratio can be set from 1 to 20, and the higher it is, the smaller the difference. At ratio=20, the difference was about 1 dB, so the loud and quiet sections were almost the same loudness.
The quiet section at -29.03 dBFS is slightly louder than -30 dB, so with threshold=-30dB it was also lowered a little.
Lifting the reduced level with makeup
Lowering threshold and raising ratio shrinks the difference, but it also makes the whole audio quieter. With ratio=4 above, the loud section dropped to -26.43 dBFS.
The official documentation says you can lift the reduced level with makeup. makeup is a multiplier from 1 to 64. I tried 4 times (about +12 dB).
ffmpeg -i src.wav -af "acompressor=threshold=-30dB:ratio=4:makeup=4" mk4.wav
The quiet section became -19.46 dBFS and the loud section became -14.39 dBFS. The difference stayed at 5.07 dB, and the whole audio became louder. Compared with the original, the quiet section is about 9.6 dB louder and the loud section is about 5.4 dB quieter.
With makeup, the short moment right after a loud sound starts also gets louder. With the settings above, the 10 ms peak at the start of the loud section reached -1.89 dBFS, close to the 0 dBFS ceiling. This is about 9.5 dB higher than the peak after the loud section settles (-11.38 dBFS).
The loudness at the start can be changed with attack, described in the next section. Adding attack=5 changed the starting peak to -5.25 dBFS. The difference was 5.03 dB, which barely changed.
ffmpeg -i src.wav -af "acompressor=threshold=-30dB:ratio=4:makeup=4:attack=5" mk4a5.wav
attack and release change how fast it starts and recovers
The official documentation describes attack as the time from when the sound exceeds threshold until the volume starts to be reduced, and release as the time from when the sound falls below threshold until the reduction starts to be released. Both are in milliseconds, and the defaults are 20 for attack and 250 for release.
I kept threshold=-30dB:ratio=4 and changed each value separately, measuring RMS every 10 ms.
| Setting | Peak in the first 10 ms | Peak after settling | Time to settle in the loud section | Time to return to the quiet section |
|---|---|---|---|---|
| attack=5 | -17.30 dBFS | -23.76 dBFS | 0.01 s | 0.32 s |
| attack=20 (default) | -13.93 dBFS | -23.42 dBFS | 0.02 s | 0.32 s |
| attack=100 | -10.44 dBFS | -22.56 dBFS | 0.07 s | 0.34 s |
| release=50 | -13.69 dBFS | -22.56 dBFS | 0.01 s | 0.07 s |
| release=1000 | -14.03 dBFS | -23.75 dBFS | 0.03 s | 1.25 s |
"Peak after settling" is the peak from 5 to 6 s. "Time to settle" is the time from 3 s until the 10 ms RMS falls within 0.5 dB of the RMS for 5–6 s. "Time to return" is the time from 6 s until the RMS for 8–9 s is back within 0.5 dB.
Looking at the measurements, even with the default attack=20, the volume started to drop within the first 10 ms, before the 20 ms had passed (the original peak was -6.02 dBFS). The smaller the value, the sooner the reduction was fully applied. For release, a smaller value also meant a faster recovery.
The longer attack was, the more the start of the loud sound remained unreduced. With attack=100, the starting peak was about 12 dB louder than the peak after settling.
The longer release was, the longer the quiet section stayed reduced after the loud sound ended. Even with the default 250, it took 0.32 s to recover.
The graph below was measured with the makeup=4:attack=5 setting from the previous section. The settled value of the quiet section is -19.76 dBFS, but during the first 10 ms right after the loud sound ends at 6.00 s, it is -34.39 dBFS, about 15 dB lower. It then gradually recovers and returns to -19.86 dBFS by 6.33 s.

Lifting quiet sounds with mode=upward
mode has downward, which is the default, and upward. When I tried mode=upward:threshold=-18dB:ratio=4, the sounds below threshold were raised instead of lowering the loud sounds.
ffmpeg -i src.wav -af "acompressor=mode=upward:threshold=-18dB:ratio=4" up.wav
The quiet section rose from -29.03 dBFS to -22.43 dBFS, and the loud section stayed at -9.03 dBFS. The difference was 13.40 dB. This is useful when you want to keep the loudness of the loud sounds unchanged.
Applying it to the audio of a video
To apply it to the audio of a video, specify it with -af in the same way. The video can be copied as is with -c:v copy. in.mp4 is a 12-second video with the audio above encoded as AAC 128 kbps, together with a 320×180 H.264 video.
ffmpeg -i in.mp4 -af "acompressor=threshold=-30dB:ratio=4:makeup=4:attack=5" -c:v copy -c:a aac -b:a 128k out.mp4
In out.mp4, the quiet section of the audio was -19.76 dBFS and the loud section was -14.73 dBFS, so the difference was 5.03 dB. The MD5 of the video part was the same as in the original in.mp4.
acompressor reduces the volume difference within a single file. It does not set the overall loudness of the file to a fixed value. If you want to match the volume of many videos, use loudnorm, which is covered in the separate article "How to Match Volume Across Videos with FFmpeg's loudnorm."




