Find Max Volume of Audio Stream Using FFmpeg

This article explains how to quickly determine the maximum volume level (peak amplitude) of an audio stream using FFmpeg without performing any file conversion or re-encoding. By utilizing a specific audio filter alongside a null output format, you can analyze your media files instantly and efficiently.

To find the maximum volume of an audio stream, you should use FFmpeg’s volumedetect filter. Running this filter with a null output tells FFmpeg to analyze the file and print the volume statistics to the console without writing a new output file.

The Command

Run the following command in your terminal:

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

(Note: Replace input.mp3 with your actual audio or video file path.)

How It Works

Interpreting the Output

After running the command, look at the terminal output. Near the end of the text block, you will see lines that look like this:

[parsed_volumedetect_0 @ 0x7f9a1bc04100] n_samples: 441000
[parsed_volumedetect_0 @ 0x7f9a1bc04100] mean_volume: -16.5 dB
[parsed_volumedetect_0 @ 0x7f9a1bc04100] max_volume: -1.2 dB
[parsed_volumedetect_0 @ 0x7f9a1bc04100] histogram_1db: 1

The line containing max_volume shows the peak volume of the audio stream: