How to Use FFmpeg showvolume Filter

This guide explains how to use the showvolume filter in FFmpeg to generate a real-time, visual volume meter overlay on top of your video. You will learn the basic command syntax, how to customize the meter’s appearance—including its size, orientation, and responsiveness—and how to overlay this visual meter directly onto your video stream.

The Basic Command Structure

The showvolume filter converts an audio stream into a visual volume meter video stream. To display this meter on top of your existing video, you must use FFmpeg’s filter_complex to generate the meter and then overlay it on your video source.

Here is the standard template command:

ffmpeg -i input.mp4 -filter_complex "[0:a]showvolume=f=0.5:w=400:h=20[volume]; [0:v][volume]overlay=10:10[outv]" -map "[outv]" -map 0:a output.mp4

How This Command Works

  1. [0:a]showvolume...[volume]: This takes the audio from the input file (0:a), runs it through the showvolume filter, and saves the resulting visual meter stream as a temporary video label named [volume].
  2. [0:v][volume]overlay=10:10[outv]: This takes the original input video (0:v) and overlays the newly created [volume] video stream on top of it. The 10:10 parameters position the meter 10 pixels from the left and 10 pixels from the top of the video frame.
  3. -map "[outv]" and -map 0:a: These arguments tell FFmpeg to use the newly generated overlay video and the original unmodified audio for the final output file.

Customizing the Volume Meter

The showvolume filter offers several options to change the behavior and look of the volume bar. You can add these options inside the showvolume filter separated by colons (e.g., showvolume=option1=value1:option2=value2).

Advanced Example: Vertical Meter on the Right Side

To create a vertical volume meter located on the right side of a 1920x1080 video, you can adjust the orientation and the overlay coordinates:

ffmpeg -i input.mp4 -filter_complex "[0:a]showvolume=o=v:w=30:h=400:f=0.4[volume]; [0:v][volume]overlay=1850:100[outv]" -map "[outv]" -map 0:a output.mp4

In this command, o=v changes the meter to a vertical layout, and overlay=1850:100 positions it near the top-right corner of a standard 1080p video frame.