I have a Radeon Vega 64, and installed AMDGPU
from the official website, but I have no idea where to go from here.
I want to use hardware acceleration for converting video with FFmpeg
. What is the corresponding FFmpeg
command and how should I like the device/driver to FFmpeg
?
I'll provide instructions for both Windows and Linux, as you've not indicated what platform you're on. Use these instructions that are applicable to your case.
If you're on Windows, you can access the related encoders via AMF, aptly named
h264_amf
andhevc_amf
, whose usage can be viewed via:You'd need to build an FFmpeg binary for Windows, either natively, or as recommended, cross-compiling. This project is a great start on that subject.
If you use the cross-compile option, pass the arguments below for a build with the features you'll need:
Note that the resulting build above is non-redistributable, and is only for personal use.
On Linux, using the opensource mesa amdgpu driver (not the proprietary package installed from AMD), you can access VAAPI-based encoders, aptly named h264_vaapi and hevc_vaapi, whose usage can be viewed via:
To the best of my knowledge (correct me if I'm wrong), VP8 and VP9 encoding isn't exposed on AMD's side via VAAPI. You can confirm this by running:
On your system and confirming what encoders are supported. It's most likely that FFmpeg with VAAPI enabled is the default on the likes of Ubuntu. However, you can also build a copy from source, if so needed. See the compilation guide on the FFmpeg Wiki, and adapt as needed. You may also find helpers, such as this, useful.
There's a possibility that the AMD AMF-based encoders will eventually land on Linux, using a Vulkan-based interop. Take this as a work in progress.
On MacOS Catalina via an external GPU over Thunderbolt 3, I had success using flag
-hwaccel videotoolbox
via the default brew installed copy. I could then use default
libx265
encoder, at about 20x speed over encoder via CPU.full: