Hey there!
I recently gotten a new camera and wondering if folks have any luck using VAAPI with kdenlive with a AMDGPU gpu. I specifically have a 7900 XTX.
This is my timeline preview encoding profile:
hwaccel=vaapi hwaccel_device=renderD128 hwaccel_output_format=vaapi vcodec=h265_vaapi vb=30000k
This is my rendering profile:
hwaccel=vaapi hwaccel_device=renderD128 hwaccel_output_format=vaapi vaapi_device=/dev/dri/renderD128
I’ve confirmed my dGPU is on card 0. I’m seeing 0% utilization on my dGPU and dropping lots of frames on timeline preview. Rendering is also painfully slow.
I’ve also tried to test transcoding with ffmpeg and that works perfectly and was very fast
ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -i ~/Videos/Raw\ Footage/DJI_20240514133234_0003_D.MP4 -vf 'format=nv12,hwupload' -c:v h264_vaapi -c:a aac -f mp4 /tmp/test.mp
1 Like
Oh I just spent so long getting h265 vaapi set up. Not Kdenlive specific, but:
Correct me if I’m wrong, but it looks like your ffmpeg test was on an h264 encoded file? h265 is still patented, so some distributions can’t enable the h265 hw decoding in Mesa by default.
The Flathub Flatpak should work out-of-the-box anyway. IIRC Fedora includes their own Flatpak repo excluding h265, so double check that if you’re fedora kde. I don’t know if Snap includes the codec.
Native installations (apt or dnf) depend on whether the district had to disable h265 in Mesa. For those, you’ll want the RPMFusion or Universe version of the package.
Thanks for that tip @acyclic I did just check and it does seem like Mesa has support for h265 in NixOS out of box.
vainfo
Trying display: wayland
libva info: VA-API version 1.21.0
libva info: Trying to open /run/opengl-driver/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.21 (libva 2.21.0)
vainfo: Driver version: Mesa Gallium driver 24.0.5 for AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 17.0.6, DRM 3.57, 6.9.1-cachyos)
vainfo: Supported profile and entrypoints
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
As a test I did try to use ffmpeg to convert my camera’s native x265 to x264 to see if it would make a difference and it didn’t sadly.
The h264 test in the command line was the few other tests I was doing
Here’s my ffmpeg cmdline for h265
ffmpeg -vaapi_device /dev/dri/renderD128 -vf format=nv12,hwupload -codec:v hevc_vaapi -profile:v main -rc_mode CQP -global_quality 28 -codec:a copy
1 Like
I can confirm I see good performance here.
[hevc_vaapi @ 0x1b5c6a00] Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
[mp4 @ 0x1b651dc0] track 1: codec frame size is not set
Output #0, mp4, to '/tmp/test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
timecode : 01:02:08;03
encoder : Lavf60.16.100
Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), vaapi(tv, bt709, progressive), 3840x2160, q=2-31, 59.94 fps, 60k tbn (default)
Metadata:
creation_time : 2024-05-25T13:04:33.000000Z
handler_name : VideoHandler
vendor_id : [0][0][0][0]
timecode : 01:02:08;03
encoder : Lavc60.31.102 hevc_vaapi
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2024-05-25T13:04:33.000000Z
handler_name : SoundHandler
vendor_id : [0][0][0][0]
frame= 417 fps= 80 q=-0.0 size= 55808kB time=00:00:06.94 bitrate=65873.5kbits/s speed=1.33x
[q] command received. Exiting.
[out#0/mp4 @ 0x1b651cc0] video:57659kB audio:280kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.017003%
frame= 450 fps= 79 q=-0.0 Lsize= 57949kB time=00:00:07.49 bitrate=63373.4kbits/s speed=1.31x
Although I don’t see the same in Kdenlive. I struggle to get over 25 fps. 