How do i get ffmpeg 4.3 to work with navi 10 GPU via vulkan?

Hi Level1Tech,

I have some the last 2 weeks tried to get ffmpeg 4.3 to work properly with my AMD RX 5700 XT via Vulkan as it should be able to do some encoding the AMF encoder as mentioned by phoronix here: FFmpeg-4.3-Released

So my question goes: how do i utilize the new ffmpeg features to encode via my AMD GPU on linux ?
or have i completely missed what was added for ffmpeg ?

You have to ensure the ffmpeg version you are using was compiled to support desired feature.

Here is the output of ffmpeg that I compiled myself. Inspect the configuration line.

Example:

ffmpeg version N-98314-ga8fb761 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --prefix=/home/lbrown/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/$USER/ffmpeg_build/include --extra-ldflags=-L/home/$USER/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/$USER/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Missing argument for option 'v'.
Error splitting the argument list: Invalid argument

My output is like so:

fmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Hyper fast Audio and Video encoder

Im not quite sure what the feature is called :confused:

I searched the wiki and did not find it so more than likely it has not really been documented as of yet. best bet would be to reach out to the team on freenode or something and get some help from them. I am pretty sure they could use some community members to test.

I have been able to compile ffmpeg with amf extensions.

important steps

  • get latest version from git repository. must include this commit “https://github.com/FFmpeg/FFmpeg/commit/f8ad2ddd7a51df5d6e768ba2a6f65ee64b94e29b#diff-3adfff78d6c720bbaa2e75bd85524380
  • add headers for amd AMF folder. Please google search I don’t remember where I found it but I know it is somewhere on github.
  • compile ffmpeg with command --enable-amf (ffmpeg has compile instructions)
  • install amd linux driver and manually install the amf package that is included but not installed by default
  • make sure your system is pointing to the amd vulkan package not your system default
  • run ffmpeg with h264_amf encoder

After all these steps I got my 480 doing 1080 encodes in real time.

Note h265/hevc is not supported in linux by amd and I found the vappi hardware encoder to get maybe half the fps of amf. Wendell said he had a project to get h265 working on linux here https://www.youtube.com/watch?v=Z76E-0AhIUY&t=7m19s I hope he can get it done without being at the mercy of amd porting the functionality to vulkan. If AMF h265 were working on the 5700 I’d assume it could be backwards compatible with other cards that AMF works with.

Anyways good luck.

2 Likes