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:

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:

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).

  1. Locate your mpv.conf file (typically found in ~/.config/mpv/ on Linux/macOS or %APPDATA%\mpv\ on Windows).
  2. 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.