How to Enable Hardware Acceleration in mpv?

This article provides a straightforward guide on how to enable hardware acceleration in the mpv media player to lower CPU utilization and ensure smoother video playback. It covers the necessary configuration file edits, the specific video decoding API options available for different operating systems, and how to verify that hardware acceleration is active during playback.

Understanding mpv Hardware Acceleration

By default, mpv may rely on software decoding, which uses your CPU to process video frames. For high-resolution files like 4K or HEVC, this can lead to high CPU usage, stuttering, and increased power consumption. Enabling hardware acceleration offloads this processing to your dedicated or integrated Graphics Processing Unit (GPU), resulting in cooler system temperatures and seamless playback.

Step-by-Step Configuration

To permanently enable hardware acceleration, you need to add a specific command to your mpv.conf configuration file.

1. Locate or Create your mpv.conf File

The location of the configuration file depends on your operating system:

If the file does not exist, create a blank text file and name it mpv.conf.

2. Add the Hardware Decoding Command

Open the mpv.conf file in a text editor and add the following line for a safe, auto-detecting setup:

hwdec=auto-safe

The auto-safe option tells mpv to automatically select the best hardware decoding method available for your system that is known to be stable. If you want mpv to try any available hardware decoder, including experimental ones, you can use:

hwdec=auto

3. Advanced Platform-Specific Options

If auto-safe does not deliver the desired results, you can manually specify the API tailored to your hardware:

Replace auto-safe with your chosen API in the mpv.conf file, save it, and restart mpv.

How to Verify Hardware Acceleration is Working

To ensure that mpv is successfully using your GPU instead of your CPU, follow these steps during video playback: