Does mpv support VideoToolbox on macOS?

This article provides a comprehensive overview of hardware-decoded video playback in the mpv media player on macOS using Apple’s VideoToolbox framework. It covers the current support status, the advantages of using hardware acceleration over software decoding, and the specific configuration steps required to enable it. Additionally, it addresses common troubleshooting scenarios and limitations users might encounter when configuring mpv for optimal performance on Mac hardware.

Understanding mpv and macOS VideoToolbox

The mpv media player fully supports hardware-decoded video playback on macOS through Apple’s native VideoToolbox framework. VideoToolbox allows mpv to offload the heavy lifting of video decoding from the CPU to the Mac’s dedicated graphics hardware (GPU or Apple Silicon media engines).

Using hardware decoding is highly recommended for modern high-resolution formats like 4K or 8K video, as well as codecs like H.264, HEVC (H.265), and VP9 (on supported hardware). The primary benefits include:

How to Enable VideoToolbox in mpv

By default, mpv will often attempt to use hardware decoding if available, but you can explicitly force it to use VideoToolbox to ensure peak performance. This can be done via the command line or by editing your configuration file.

Command Line Method

To test VideoToolbox playback for a single video file, open your Terminal and run the following command:

mpv --hwdec=videotoolbox filename.mp4

Permanent Configuration Method

To enable hardware decoding permanently so you don’t have to type it every time, add the setting to your mpv.conf file (typically located at ~/.config/mpv/mpv.conf):

# Enable VideoToolbox hardware decoding
hwdec=videotoolbox

Copy-Back vs. Native Decoding Modes

When configuring VideoToolbox, you can choose between two primary operational modes depending on your specific rendering needs:

videotoolbox (Native)

This mode decodes the video directly into GPU memory. It offers the absolute best performance and lowest power consumption because the video frames never travel back to the CPU.

videotoolbox-copy (Copy-Back)

This mode decodes the video using the hardware but copies the decoded frames back into system RAM. While it consumes slightly more CPU power than native mode, it is required if you want to use advanced mpv video filters (like subtitle styling or custom shaders) that need access to the raw video frames.

To use the copy-back variant, update your configuration to:

hwdec=videotoolbox-copy

Troubleshooting and Limitations

While VideoToolbox support is robust, performance depends heavily on your specific Mac hardware: