2

I'm on the AWS g4ad server instance that has AMD Radeon Pro V520 GPU. I am trying to get my ffmpeg to use the GPU when doing conversion as such:

ffmpeg -i input.avi -c:v h264_amf output.mp4

When I install normall ffmpeg or use the ffmpeg from ppa:savoury1/ffmpeg4, these not have the amf codec enabled (even though 4.3 is suppose to the code enable by default). I will get this error:

Unknown encoder 'h264_amf'

Also, the different are installed from here: https://www.amd.com/en/support/linux-drivers

Then I tried to compile ffmpeg from the source with:

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
      --prefix="$HOME/ffmpeg_build" \
      --pkg-config-flags="--static" \
      --extra-cflags="-I$HOME/ffmpeg_build/include" \
      --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
      --extra-libs="-lpthread -lm" \
      --bindir="$HOME/bin" \
      --enable-libfdk-aac \
      --enable-gpl \
      --enable-libass \
      --enable-libfreetype \
      --enable-libmp3lame \
      --enable-libopus \
      --enable-libvorbis \
      --enable-libvpx \
      --enable-libx264 \
      --enable-libx265 \
      --enable-libtheora \
      --enable-openssl \
      --enable-amf \
      --enable-encoder=h264_amf \
      --enable-nonfree

But I get the error

ERROR: amf requested but not found

And the instructions for how to include AMF are vague.

Can anyone provide a way of getting FFMPEG working with ffmpeg?

1

1 Answer 1

1

Must put AMF repo in home folder

cd ~/
git clone https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git
sudo mkdir /usr/local/include/AMF
cd /usr/local/include/AMF
sudo ln -sf ~/AMF/amf/public/include/core
sudo ln -sf ~/AMF/amf/public/include/components

[optional] Then when you want update and rebuild with new versions only need

cd ~/AMF
git pull

Then try compile the ffmpeg again with --enable-amf

According to:

FFmpeg can use the AMD Advanced Media Framework library for accelerated H.264 and HEVC(only windows) encoding on hardware with Video Coding Engine (VCE).

To enable support you must obtain the AMF framework header files(version 1.4.9+) from https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git.

Create an AMF/ directory in the system include path. Copy the contents of AMF/amf/public/include/ into that directory. Then configure FFmpeg with --enable-amf.

Initialization of amf encoder occurs in this order: 1) trying to initialize through dx11(only windows) 2) trying to initialize through dx9(only windows) 3) trying to initialize through vulkan

To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro package(amdgru-pro contains, but does not install automatically) are required.

This driver can be installed using amdgpu-pro-install script in official amd driver archive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .