How to Measure Active Sound Level with FFmpeg
This article provides a practical guide on how to measure active
sound levels using FFmpeg. While FFmpeg does not contain a native filter
named asdr (which is commonly a typographical mix-up with
the astats filter or ADSR envelope concepts), it offers
industry-standard tools like astats and
ebur128 to measure volume, RMS, and active loudness. You
will learn the exact command-line syntax required to analyze your audio
files and extract these precise measurements.
Measuring
Audio Statistics with the astats Filter
The astats filter is the most effective tool in FFmpeg
for measuring active sound levels, signal power, and peak values. It
calculates various statistics for each audio channel.
To run a analysis on an audio file without generating a new output file, use the following command:
ffmpeg -i input.mp3 -filter_complex astats=metadata=1 -f null -Key Parameters Explained: *
-i input.mp3: Specifies your input audio or video file. *
-filter_complex astats: Invokes the audio statistics
filter. * -f null -: Tells FFmpeg to process the audio and
discard the video/audio output, printing only the metadata results to
the console.
What to Look For in the Output: * RMS level (dB): Represents the average active energy of the sound. * Peak level (dB): The maximum amplitude reached by the audio signal. * Crest factor: The ratio of the peak value to the RMS value, which indicates how dynamic the audio is.
Measuring
Active Loudness with the ebur128 Filter
If you need to measure the perceived active sound level according to
the EBU R128 standard (which is the modern broadcast standard for
measuring loudness), you should use the ebur128 filter.
Run the following command to measure the integrated and momentary loudness of your file:
ffmpeg -i input.mp3 -filter_complex ebur128=peak=true -f null -Key Parameters Explained: *
ebur128=peak=true: Enables the EBU R128 loudness filter and
includes True Peak measurements in the output.
What to Look For in the Output: * I (Integrated Loudness): This is the overall active sound level of the entire file, measured in LUFS (Loudness Units Full Scale). It automatically gates silent parts to measure only the “active” parts of the audio. * Threshold: The silence gate threshold used to determine what constitutes “active” sound during measurement.
Understanding the “asdr” Terminology
In audio engineering, ADSR stands for Attack, Decay,
Sustain, and Release, which describes the envelope of a sound over time
rather than its measurement. If you are looking to shape the active
level of a sound using an envelope in FFmpeg, you would use dynamic
processors like the agate (audio gate) or
acompressor filters rather than a measurement filter. For
volume analysis and active sound level extraction, stick to
astats and ebur128.