Display Audio Levels on Command Line with FFmpeg

Visualizing audio levels directly in the terminal is a powerful way to monitor audio streams, check for clipping, and verify signal presence without launching a heavy graphical user interface. This article explains how to use FFmpeg, the versatile open-source multimedia framework, to display real-time dynamic audio levels and peak meters on the command line using built-in audio filters.

Real-Time Loudness and Peak Metering with EBUR128

The most effective way to display dynamic audio levels in the terminal is by using FFmpeg’s ebur128 filter. This filter conforms to the EBU R128 loudness standard and outputs real-time text-based metrics directly to the command line, including momentary loudness, short-term loudness, integrated loudness, and true peak levels.

To analyze an audio file in real time and output the level data to your terminal, run the following command:

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

Understanding the Output

As the file plays, FFmpeg will constantly update the terminal screen with lines of text resembling the following:

t: 1.4    M: -18.2 S: -19.5 I: -21.1  LRA:   0.0  FTPK:  -5.2  MTPK:  -5.2

Live Audio Input Monitoring

If you want to monitor a live audio input (such as a microphone or system loopback) in real time, you can replace the input file with your system’s audio device driver.

For Linux (ALSA):

ffmpeg -f alsa -i default -filter_complex ebur128=peak=true -f null -

For macOS (AVFoundation):

ffmpeg -f avfoundation -i ":0" -filter_complex ebur128=peak=true -f null -

For Windows (dshow):

ffmpeg -f dshow -i audio="Your Microphone Name" -filter_complex ebur128=peak=true -f null -

Displaying Peak Levels via the Astats Filter

If you do not need a continuous, frame-by-frame stream but instead want a quick terminal printout of the peak levels, dynamic range, and overall audio statistics, use the astats filter.

Run the following command:

ffmpeg -i input.wav -filter:a astats -f null -

FFmpeg will process the file at maximum speed and output a detailed text summary of both channels (or more) to your terminal. Look for the following fields in the console output to find your peak values: