Normalize Audio Dynamically with FFmpeg

This guide explains how to normalize audio levels dynamically using FFmpeg. While the standard volume filter is ideal for static gain adjustments and peak normalization, true dynamic normalization—adjusting quiet and loud parts on the fly—is best achieved using FFmpeg’s specialized dynamic volume filters, dynaudnorm and loudnorm. Below, you will find the exact commands and parameters needed to apply both peak and dynamic audio normalization to your media files.


Method 1: Peak Normalization using the volume Filter

Peak normalization adjusts the volume of the entire file by a constant factor so that the loudest peak reaches a target level (usually 0 dB). This prevents clipping but does not change the dynamic range.

To do this with the volume filter, you must use a two-step process:

Step 1: Analyze the Audio

Run the volumedetect filter to find the current maximum volume of your input file:

ffmpeg -i input.mp3 -filter:a volumedetect -f null -

Look at the terminal output for the max_volume line. For example: [parsed_volumedetect_0 @ 0x...] max_volume: -6.1 dB

Step 2: Apply the volume Filter

To bring the peak volume up to 0 dB, apply the inverse of your max_volume value using the volume filter:

ffmpeg -i input.mp3 -filter:a "volume=6.1dB" output.mp3

Method 2: Dynamic Normalization using the dynaudnorm Filter

If your audio has very quiet whispering and very loud explosions, peak normalization will not help the quiet parts. To dynamically adjust the volume throughout the playback, use the dynaudnorm (Dynamic Audio Normalizer) filter. This filter acts as a continuous intelligent volume controller.

Run the following command for standard dynamic normalization:

ffmpeg -i input.mp3 -filter:a dynaudnorm output.mp3

Key Customization Parameters for dynaudnorm:

Example with custom parameters:

ffmpeg -i input.mp3 -filter:a "dynaudnorm=f=500:g=31:m=15.0" output.mp3

Method 3: Standardized Dynamic Normalization using loudnorm

For broadcast-ready dynamic normalization, the loudnorm filter is recommended. It conforms to the EBU R128 loudness standard, dynamically compressing the dynamic range to meet a targeted integrated loudness.

Run this command for a quick, single-pass dynamic normalization:

ffmpeg -i input.mp3 -filter:a "loudnorm=I=-16:TP=-1.5:LRA=11" output.mp3