How to Use VP9 Hardware Decoding in FFmpeg on macOS

This article provides a straightforward guide on how to leverage hardware-accelerated VP9 video decoding using FFmpeg on macOS. By utilizing Apple’s VideoToolbox framework, you can significantly reduce CPU usage and speed up transcoding times when processing VP9 videos on compatible Apple Silicon or Intel-based Mac hardware.

Step 1: Verify FFmpeg Support for VideoToolbox

Before starting, ensure your version of FFmpeg supports the macOS hardware-accelerated VP9 decoder. Open your terminal and run the following command:

ffmpeg -decoders | grep vp9

In the output, look for vp9_videotoolbox. If it is listed, your FFmpeg installation is ready to use hardware-accelerated VP9 decoding.

Note: Hardware-accelerated VP9 decoding requires macOS Big Sur or later and compatible hardware (Apple Silicon M-series chips or Intel CPUs with Ice Lake or newer).

Step 2: Run the Transcoding Command

To use the hardware decoder, you must specify the decoder flag before the input file in your FFmpeg command.

Here is the standard command to transcode a VP9 .webm video to an H.264 .mp4 video using hardware acceleration for both decoding and encoding:

ffmpeg -c:v vp9_videotoolbox -i input.webm -c:v h264_videotoolbox -b:v 5M output.mp4

Command Breakdown

Alternative: Software Encoding with Hardware Decoding

If you prefer to use a high-quality software encoder like libx264 while still saving CPU cycles during the decoding phase, use the following command:

ffmpeg -c:v vp9_videotoolbox -i input.webm -c:v libx264 -crf 20 output.mp4