I’m struggling to figure out how to use ffmpeg
to encode/decode video on the Framework 16 with AMD dGPU (Radeon 7700). I believe ffmpeg
supports hardware enc/dec with VAAPI on 6.1 and Mesa 23, both of which I have installed, but when I try to transcode from H265 to H264, it only runs at maybe 4x speed. I can’t seem to get Vulkan to work at all (which I think now supports this? as of the later versions).
I’m running Arch with 6.8.7 kernel; Framework 16 with the AMD Radeon RX 7700S.
I have mesa 24 and libva 2.21 and the amdgpu drivers also installed.
I’m attempting the following command as a test to see what kind of throughput I can do. The media is located on the internal NVMe drive (so disk read/write shouldn’t really be a concern). I have 64GB of RAM, so that should be plenty (file size is only 10GB). The file is HEVC with HDR in 4K.
ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mkv -c:v h264_vaapi -vf 'format=nv12,hwupload' -f null -
As mentioned, this runs at about 4x (3.8-4), but when I run the equivalent transcode on a Debian 12 Linux machine with an NVIDIA 1050 Ti, it runs at around 8x (7.5-8).
I would have assumed that this newer card would be able to handle a transcode much better than a card 5+ years old.
To top it off, using nvtop
, the graph only seems to indicate about 25% of the dGPU is being used (this let’s me know that I’m at least engaging the dGPU, but it’s definitely not fully being utilized). This really makes me think that maybe I’m decoding on the CPU then encoding on the dGPU, which would be much slower, but I can’t seem to figure out how to do all of the transcode in the dGPU.
I’ve followed the pages on the ffmpeg Wiki, but it seems that I can’t quite get it all working correctly and my knowledge of ffmpeg
is vastly low.
I know this example is suppose to be “all in hardware”:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -c:v h264_vaapi -b:v 2M -maxrate 2M output.mp4
But I get a failure:
No usable encoding profile found.
I think this means I need to setup something in the -vf
flag, but I don’t know what.
At the end of the day, I’m mostly just trying to get the most speed out of transcoding; mostly from HEVC to H.264, sometimes 4K to 1080p, or just 4K to 4K (with a different encoder).
I’m very lost and I can’t seem to find anything online. A lot of it is really old and it seems that a lot of new advancements have been made to the software to enable this type or workflow, but I know so little about this that I’m just looking for guidance.