AMF in linux using FFmpeg

Discussion created by davidbfg on Sep 10, 2019
Latest reply on Aug 12, 2020 by davidbfg

I have been trying to utilize the amf-amdgpu-pro package from driver 19.30 in Ubuntu 18.04 using the latest branch of FFmpeg to do an h264_amf encode with varying success.


I have a dual GPU system with a rx vega 56 and a rx 480. I have noticed when the vega 56 card is active I have the capability to do an encode with ffmpeg using the h264_amf encoder. The problem arises when I use VFIO to do pci pass-through for the vega 56 card to a vm. This effectively disables my vega gpu during boot and the rx 480 is the only accessible card.


In that scenario a simple command that worked earlier (i.e. "./ffmpeg -i videoplayback.flv -c:v h264_amf accel.mkv") will report "AMF failed to initialise on the given Vulkan device: 1." From looking through the source the call that is failing is to InitVulkan it appears to be passed Null by ffmpeg based on the documentation this should retrieve the default vulkan device. The error InitVulkan returns is 1 meaning AMF_FAIL while the documentation states the only expected errors are AMF_NOT_SUPPORTED and AMF_ALREADY_INITIALIZED that might just be a clerical error to not include.


Since this is a new package and has a soft release where it is not installed automatically I can certainly understand that not everything would work perfect out of the box. I was hoping someone could get back to me with if the rx 480 is known to be supported by the amf-amdgpu-pro package in the 19.30 driver or not. Thanks.


I am aware vaapi is an alternative way of accessing the hardware encoding on the gpu but I've run into a lot of performance problems with it. That is why I was really hoping the amf package would be able to do the trick with the rx 480.