Make a Waveform Video from an Audio File with ffmpeg

August 2021

Here's a code snippet that generates a video with a waveform in it from an mp3.

IN="/Users/alan/_Desktop/ffmpeg-viz/input.mp3"
OUT="/Users/alan/_Desktop/ffmpeg-viz/output.mkv"

ffmpeg -y \
-i "$IN" \
-filter_complex \
"[0:a]showwaves=s=1920x1080:mode=cline,format=yuv420p[v]" \
-map "[v]" \
-map 0:a \
-c:v libx264 \
-c:a copy \
"$OUT"

Here's an example of the output:

It may not be super impressive, but it's very cool in general.

-a

end of line

Endnotes

Update Oct. 2025

Just saw this one linked which makes bars:

visualize-audio

The video I got this snippet from is: How to Convert an Audio to a Video WaveForm

(It's really long to just get to the snippet of code, but such is the way of things more often than not)

There's some more examples in this StackOverflow answer