Normalize Video Audio Volume via FFmpeg in Linux

This article provides a straightforward guide on how to normalize the audio volume of a video file using FFmpeg on the Linux command line. You will learn the difference between peak and loudness normalization (EBU R128), followed by the exact commands needed to balance your audio without degrading video quality.

Understanding Your Normalization Options

Before running a command, it helps to understand the two primary ways to normalize audio. Choosing the right method depends on how precise you need the final volume to be.

Method 1: Quick Loudness Normalization (Single-Pass)

FFmpeg features a powerful filter called loudnorm that can normalize audio based on the EBU R128 standard in a single pass. This is the fastest way to get great results.

Open your Linux terminal and run the following command:

ffmpeg -i input.mp4 -c:v copy -af loudnorm output.mp4

Command Breakdown

Method 2: High-Precision Loudness Normalization (Two-Pass)

For professional results, a two-pass approach is recommended. The first pass measures the exact audio statistics of your file, and the second pass uses those precise metrics to normalize the audio perfectly.

Step 1: Analyze the Audio

Run the loudnorm filter with the print format enabled to measure your file:

ffmpeg -i input.mp4 -af loudnorm=print_format=json -f null -

This will output a block of JSON data at the end of the process that looks similar to this:

{
    "input_i" : "-18.5",
    "input_tp" : "-1.5",
    "input_lra" : "8.2",
    "input_thresh" : "-28.7",
    "output_i" : "-24.1",
    "output_tp" : "-2.0",
    "output_lra" : "6.5",
    "output_thresh" : "-34.3",
    "normalization_type" : "dynamic",
    "target_offset" : "0.1"
}

Step 2: Apply the Measured Values

Plug the measured input_ values from your terminal output into the following command to perform the final, precise normalization:

ffmpeg -i input.mp4 -c:v copy -af loudnorm=linear=true:measured_i=-18.5:measured_tp=-1.5:measured_lra=8.2:measured_thresh=-28.7 output.mp4

This ensures your audio is leveled exactly to industry standards without any dynamic compression artifacts.

Method 3: Simple Peak Normalization

If you prefer to simply boost the audio volume to its maximum safe limit without clipping, you can use the volumedetect filter.

Step 1: Find the Max Volume

ffmpeg -i input.mp4 -af volumedetect -f null -

Look through the terminal output for max_volume. For example, if it says max_volume: -6.0 dB, your audio has 6 dB of headroom before it distorts.

Step 2: Adjust the Volume

Boost the volume by the exact headroom amount you discovered:

ffmpeg -i input.mp4 -c:v copy -af volume=6dB output.mp4