Quick & Easy: Hardware Encoding with VAAPI on Radeon under Ubuntu 23.10 feat FFMPEG
Install Package
sudo apt update
sudo apt install libva-dev vainfo ffmpeg mediainfo
sudo vainfo | grep EncSlice
will show what hardware encoders are supported
Improving performance, might end up being slower (but with less cpu usage) depending on hardware
-async_depth 1
-hwaccel vaapi
(decode in hardware, lowers cpu usage)
H.264/AVC Hardware Encoding using VAAPI on Radeon Vega or later
crf 24, audio copyffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 24 -c:a copy avc-crf24.mp4
5Mbps, audio copy
ffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=nv12,hwupload' -c:v h264_vaapi -b:v 5M -c:a copy avc_5M.mp4
H.265/HEVC Hardware Encoding using VAAPI on Radeon Vega or later
crf 24, audio copy
ffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=nv12,hwupload' -c:v hevc_vaapi -qp 24 -c:a copy hevc-crf24.mp4
5mbps, audio copy
ffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M -c:a copy hevc-5mbps.mp4
crf 24, 10-bit, audio copy
ffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=p010,hwupload' -c:v hevc_vaapi -qp 24 -profile:v 2 -c:a copy hevc-main10-crf24.mp4
15mbps, 10-bit, audio copy
ffmpeg -vaapi_device /dev/dri/renderD128 -i n1.mkv -vf 'format=p010,hwupload' -c:v hevc_vaapi -b:v 15M -profile:v 2 -c:a copy hevc-main10-15mbps.mp4
more info
- https://gist.github.com/Brainiarc7/95c9338a737aa36d9bb2931bed379219
ffmpeg -help encoder=h264_vaapi -hide_banner
ffmpeg -help encoder=hevc_vaapi -hide_banner