How to Show Audio Visualization in mpv?
This article provides a quick overview and step-by-step guide on how
to enable and customize audio visualizations when playing music-only
files in the mpv media player. By default, mpv opens a blank or minimal
window for audio tracks, but you can easily configure it to display
dynamic visualizers like waveform, avectors,
or showwaves using built-in FFmpeg filters. Below, you will
find the command-line flags and configuration settings needed to bring
your audio files to life.
Enabling the Default Visualizer
The quickest way to display a visualization in mpv is by using the
--lavfi-complex property via the command line. This
leverages FFmpeg’s multimedia filters to generate a video stream from
your audio input.
To launch a basic waveform visualizer, open your terminal and run the following command:
mpv --lavfi-complex="[aid1] asplit [a1][a2]; [a1] showwaves=mode=line:s=1280x720 [v]; [a2] ao [ao]" musicfile.mp3
In this command:
asplitsplits the audio track into two identical streams.showwavesconverts one of those audio streams into a visual waveform video stream ([v]).aosends the second audio stream to your audio output ([ao]) so you can still hear the music.
Exploring Different Visualization Styles
FFmpeg offers several built-in filters that change the aesthetic of
the visualization. You can substitute showwaves in the
command above with other popular options:
avectorscope: Displays an audio vector scope, which is perfect for visualizing stereo balance and phase.Example:
[a1] avectorscope=s=1280x720 [v]showcqt: Generates a musical pitch spectrum using a Constant-Q Transform, displaying a colorful frequency scale.Example:
[a1] showcqt=s=1280x720 [v]showspectrum: Converts the audio into a standard frequency spectrum power visualization.Example:
[a1] showspectrum=s=1280x720 [v]
Making the Changes Permanent
If you do not want to type out a long command every time you play an
audio file, you can add these settings directly to your mpv
configuration file (mpv.conf).
- Locate your
mpv.conffile (typically found in~/.config/mpv/on Linux/macOS or%APPDATA%\mpv\on Windows). - Append the following lines to the file:
# Automatically enable a vectorscope visualization for audio files
lavfi-complex="[aid1] asplit [a1][a2]; [a1] avectorscope=s=1280x720:m=lissajous [v]; [a2] ao [ao]"Once saved, mpv will automatically render the specified visualizer whenever you open a music-only file.