VAAPI H.264 encoding is slow on Polaris vs. HEVC and Windows AMF
When I do
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format vaapi -i 1440p_h.264_60fps.mkv -c:v h264_vaapi -global_quality 15 -c:a copy -map 0 output.mkv
encoding speed of this 1440p 60fps H.264 video is quite low with ~0.63x (it should not be limited by VAAPI decoding performance in any way):
frame= 262 fps= 37 q=-0.0 Lsize= 1781kB time=00:00:04.51 bitrate=3233.0kbits/s speed=0.63x
As a result, obs-studio can't capture with 1440p 60fps without extremely stuttery result. Only 30fps work fluidly (or 1080p). I tried if any quality setting affected encoding speed, but it didn't. I once tested a Navi card and it could do much faster H.264 VAAPI encoding.
With -c:v hevc_vaapi
however, encoding speed is well >1x on Polaris. Though obs-studio doesn't offer VAAPI HEVC (and doesn't want to).
On Windows, obs-studio can capture ~fluid 1440p 60fps H.264 via AMF, and so does ReLive.
So, I'd suspect some (driver) parameter might not be configured optimally for H.264 VAAPI encoding on Polaris. It'd be nice if it was fast enough by default to achieve 1440p 60fps capture in obs-studio.
System information
inxi -GSC -xx
System:
Host: linux Kernel: 5.8.10-17-tkg-cfs x86_64 bits: 64 compiler: N/A
Desktop: KDE Plasma 5.19.5 tk: Qt 5.15.1 wm: kwin_x11 dm: startx
Distro: Arch Linux
CPU:
Info: Quad Core model: Intel Core i7-6700K bits: 64 type: MT MCP arch: Skylake-S
rev: 3 L2 cache: 8192 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 63999
Speed: 2900 MHz min/max: N/A Core speeds (MHz): 1: 2900 2: 3655 3: 3375 4: 2808
5: 2586 6: 3405 7: 2986 8: 3467
Graphics:
Device-1: Intel HD Graphics 530 vendor: ASRock driver: i915 v: kernel
bus ID: 00:02.0 chip ID: 8086:1912
Device-2: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
vendor: Micro-Star MSI driver: amdgpu v: kernel bus ID: 01:00.0 chip ID: 1002:67df
Display: server: X.org 1.20.9 compositor: kwin_x11 driver: amdgpu
resolution: <xdpyinfo missing>
OpenGL: renderer: AMD Radeon RX 480 Graphics (POLARIS10 DRM 3.38.0
5.8.10-17-tkg-cfs LLVM 10.0.1)
v: 4.6 Mesa 20.3.0-devel (git-95ee0ba41f) direct render: Yes