To use your GPU rather than your CPU to convert videos under AMD architecture, you need to use va-api, video acceleration API.
Results:
51 seconds using CPU 100fps 21mb file-size
34 seconds using GPU 130fps 42mb file-size
Requirements:
# VA-API for Radeon HD 2000 and newer require libva-mesa-driver # VDPAU for Radeon R300 and newer require mesa-vdpau # libva-vdpau-driver # you can just install both # arch manjaro sudo pacman -S libva-mesa-driver mesa-vdpau libva-vdpau-driver # debian ubuntu apt install mesa-va-drivers -y
You may need to reboot in order for the kernel to load with the new updates.
This will install a library a library for
After installing libva vdpau drivers for mesa, you will have a device driver that you can reference in ffmpeg /dev/dri/renderD128
Convert ffmpeg files using your AMD Graphics Card, Laptop Radeon Vega Mobile works too.
Initialize the device
# init device ffmpeg -init_hw_device vaapi=gpu:/dev/dri/renderD128
Now you can convert with the GPU:
IN_VIDEO=video1.mp4 OUT_VIDEO=video2.mp4 ffmpeg -i "$IN_VIDEO" -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format='nv12|vaapi,hwupload' "$OUT_VIDEO"
How to tell if my GPU is being used to convert videos using the gpu?
Run two tests.
# test 1 ffmpeg -i in.mp4 normal.mp4 # test 2 ffmpeg -i in.mp4 -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format='nv12|vaapi,hwupload' accelerated.mp4


The GPU accelerated version using AMD Ryzen 5 3500U with Radeon Vega finished before we could even get a decent CPU reading!
Worked perfect on my laptop. – Amd 4500U
Before speed=1.5
After speed-2.4
I didn’t think a moble APU had the funtion to do this.
Glad to hear it worked! I noticed the quality changed between cards which was interesting too. Speed change was awesome though.