How to Use the FFmpeg ebur128 Filter

This guide explains how to use the ebur128 filter in FFmpeg to measure and analyze the loudness of your audio files. You will learn the basic command syntax for loudness analysis, how to interpret the console output against industry standards like EBU R128, and how to generate a visual loudness graph.

What is the ebur128 Filter?

The ebur128 filter is an audio filter in FFmpeg that measures the loudness of an audio stream according to the EBU R128 standard. This standard is widely used in broadcasting and streaming to ensure consistent audio levels, preventing sudden jumps in volume between different programs or tracks. It measures integrated loudness (overall volume), loudness range (dynamic range), and true peak levels.

How to Analyze Audio Loudness

To analyze an audio or video file without producing a new output file, you can run the filter and direct the output to a null sink.

Run the following command in your terminal:

ffmpeg -i input.mp4 -filter_complex ebur128=peak=true -f null -

Command breakdown: * -i input.mp4: Specifies your input video or audio file. * -filter_complex ebur128=peak=true: Enables the EBU R128 filter. Setting peak=true tells FFmpeg to also calculate the True Peak (TP) levels, which is crucial for preventing digital clipping. * -f null -: Tells FFmpeg not to write any physical output file, as you only need to read the measurement metadata printed in the console.

Understanding the Console Output

As the command runs, FFmpeg will print real-time statistics. At the very end of the process, you will see a summary block resembling this:

[Parsed_ebur128_0 @ 0x...] Summary:

  Integrated loudness:
    I:         -18.5 LUFS
    Threshold: -28.5 LUFS

  Loudness range:
    LRA:         6.2 LU
    Threshold: -38.5 LUFS
    LRA low:   -22.1 LUFS
    LRA high:  -15.9 LUFS

  True peak:
    Peak:       -1.2 dBTP

Key metrics to look for: * Integrated loudness (I): The average loudness of the entire file, measured in LUFS (Loudness Units relative to Full Scale). For EU television broadcast, the target is usually -23 LUFS. For streaming platforms like YouTube or Spotify, the target is typically around -14 LUFS. * Loudness range (LRA): The dynamic range of the audio (the difference between the quietest and loudest parts). * True peak (Peak): The maximum absolute peak level of the signal, measured in dBTP (decibels relative to True Peak). To avoid distortion, this should ideally remain below -1.0 dBTP.

How to Generate a Visual Loudness Graph

The ebur128 filter can also generate a real-time video stream visualizing the loudness levels over time. You can save this visualization as a video file.

Run this command to create a video graph of your audio’s loudness:

ffmpeg -i input.mp4 -filter_complex ebur128=video=1:size=640x480[out0][out1] -map [out0] -map [out1] output_visualization.mp4

Command breakdown: * video=1: Activates the video visualization mode. * size=640x480: Sets the resolution of the output video. * [out0][out1]: Maps both the video visualization stream and the original audio stream to the output. * -map [out0] -map [out1]: Ensures both the generated video graph and the source audio are exported into the final output_visualization.mp4 file.