RMS Audio Normalization in FFmpeg
This guide explains how to implement Root Mean Square (RMS) audio normalization using FFmpeg. You will learn the difference between peak and RMS normalization, how to measure your audio’s current RMS levels, and the precise commands needed to adjust your audio files to a target average volume.
Understanding RMS Normalization
RMS normalization adjusts the average signal amplitude of an audio file to a target level. This makes it ideal for standardizing the perceived volume of speech, podcasts, and music. Unlike peak normalization, which only prevents digital clipping based on the single loudest point, RMS normalization focuses on the overall energy of the audio over time.
The Two-Step RMS Normalization Process
Because FFmpeg does not have a native, single-step RMS normalization filter, the most accurate way to achieve true RMS normalization is a two-step process: measuring the current mean volume (RMS) and then applying the necessary gain.
Step 1: Analyze the Audio
First, run the volumedetect filter to analyze the
average volume of your input file:
ffmpeg -i input.mp3 -filter:a volumedetect -f null -In the terminal output, locate the mean_volume line. For
example:
[parsed_volumedetect_0 @ 0x...] mean_volume: -28.4 dB
This mean_volume value represents the RMS level of your
audio.
Step 2: Calculate and Apply the Gain
Decide on your target RMS level. A common target for speech and broadcast dialogue is -20 dB.
Subtract the detected mean_volume from your target
volume to find the required adjustment: * Target (-20 dB) - Current
(-28.4 dB) = +8.4 dB.
Apply this adjustment using the volume filter:
ffmpeg -i input.mp3 -filter:a "volume=8.4dB" output.mp3Alternative: Loudness Normalization (LUFS)
For a modern, single-pass alternative, you can use the
loudnorm filter. This filter uses the EBU R128 standard.
While technically based on LUFS (Loudness Units Full Scale), it
functions similarly to RMS normalization by targeting perceived human
hearing levels and can be executed in a single command:
ffmpeg -i input.mp3 -filter:a loudnorm=I=-20:TP=-1:LRA=11 output.mp3I=-20: Sets the integrated loudness target to -20 LUFS.TP=-1: Sets the maximum True Peak to -1 dB to prevent digital clipping.LRA=11: Sets the loudness range target to 11 LU.