How to Enable Verbose Logging in mpv for Debugging?
When troubleshooting playback issues, audio sync problems, or unexpected crashes in the mpv media player, enabling verbose logging is the most effective way to diagnose the root cause. This article covers the specific command-line flags required to generate detailed logs, how to redirect that output to a file for easier analysis, and how to control log levels dynamically.
The Verbose Logging Flag
To enable verbose logging in mpv via the command line, you use the
-v flag. Each additional v
you append increases the log verbosity, allowing you to capture deeper
levels of debugging information.
- Standard Verbose:
mpv -v video.mp4 - Highly Verbose:
mpv -vv video.mp4
Alternatively, you can use the explicit, more descriptive flag:
mpv --log-file=output.txt video.mp4Using the --log-file flag is highly recommended for
debugging purposes because mpv text logs scroll quickly and can easily
overwhelm the terminal buffer. This command automatically sets a high
level of verbosity and saves the entire session output directly into a
readable text file named output.txt in your current working
directory.
Advanced Log Level Filtering
If you need to isolate specific issues without digging through
thousands of lines of unrelated data, mpv provides the
--msg-level flag. This allows you to set distinct verbosity
levels for different internal modules of the player.
The syntax follows a module=level format:
mpv --msg-level=ffmpeg=v,ao=debug video.mp4In this example, the FFmpeg wrapper module is set to verbose
(v), and the audio output (ao) module is set
to a deep debug level, while all other modules remain at
their default logging thresholds. Available levels range from
no (complete silence) and fatal, up to
v (verbose) and debug.