Hi there,
I've got the problem that OBS is producing laggy videos when using the hardware encoder. The software encoder doesn't have those issues. An example video. My settings (recording at WQHD resolution with 60fps):
OBS shows me that my encoder is overloaded and the option for hardware encoding with FFMEPG VAAPI only shows when enabling advanced options.
OpenGL and Mesa driver infos:
The system-wide ffmpeg version I'm using:
GPU (AMD RX 480) utilization during recording:
I'm currently using ArchLinux with kernel 5.10.43-1-lts and the Xfce4 desktop.
I've also tried using the Flathub version of OBS, sadly with the same result.
The things I already looked into while trying to figure out why the hardware encoder is causing these problems:
1. Transcoding a video with ffmpeg (vaapi). This worked fine and it did not cause any of those lags:
2. Getting the console output of OBS during recording (here with the OBS package from my distribution):
2.1: bitrate of 2.5k: https://drive.google.com/file/d/1cFbpYuu5ADK7LyqGLGZdDxOMPK2rHKqC/view?usp=sharing
2.2: bitrate of 50k: https://drive.google.com/file/d/1gRyvf98x0uQav6kIpTysCkfZqDMRdfs1/view?usp=sharing
2.3 Another test with 2.5k bitrate: https://obsproject.com/logs/rgVKdwKMWmPOysLH
3. A test with the flathub version of OBS (bitrate of 2.5k): https://drive.google.com/file/d/1veVSF6VB0qNhHqJqnnb8O_-iYrDOYC_p/view?usp=sharing
4. I also tested whether it makes a difference when capturing my desktop vs a 3d game and it did not make any difference at all.
My system:
I've got the problem that OBS is producing laggy videos when using the hardware encoder. The software encoder doesn't have those issues. An example video. My settings (recording at WQHD resolution with 60fps):
OBS shows me that my encoder is overloaded and the option for hardware encoding with FFMEPG VAAPI only shows when enabling advanced options.
Bash:
$ vainfo
vainfo: VA-API version: 1.11 (libva 2.11.1)
vainfo: Driver version: Mesa Gallium driver 21.1.2 for AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.40.0, 5.10.43-1-lts, LLVM 12.0.0)
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
OpenGL and Mesa driver infos:
Bash:
$ glxinfo | grep OpenGL
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.40.0, 5.10.43-1-lts, LLVM 12.0.0)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.1.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.1.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
The system-wide ffmpeg version I'm using:
Bash:
$ ffmpeg -version
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
GPU (AMD RX 480) utilization during recording:
I'm currently using ArchLinux with kernel 5.10.43-1-lts and the Xfce4 desktop.
I've also tried using the Flathub version of OBS, sadly with the same result.
The things I already looked into while trying to figure out why the hardware encoder is causing these problems:
1. Transcoding a video with ffmpeg (vaapi). This worked fine and it did not cause any of those lags:
Bash:
$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i 01.mkv -c:v h264_vaapi output.mp4
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[matroska,webm @ 0x556f5b19cd00] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x556f5b19cd00] Could not find codec parameters for stream 6 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from '01.mkv':
Metadata:
encoder : libmakemkv v1.16.3 (1.3.10/1.5.2) x86_64-unknown-linux-gnu
creation_time : 2021-04-20T19:04:45.000000Z
Duration: 00:17:41.06, start: 0.000000, bitrate: 24449 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 137.337200
Metadata:
title : Chapter 01
Chapter #0:1: start 137.337200, end 398.231167
Metadata:
title : Chapter 02
Chapter #0:2: start 398.231167, end 619.118500
Metadata:
title : Chapter 03
Chapter #0:3: start 619.118500, end 724.390333
Metadata:
title : Chapter 04
Chapter #0:4: start 724.390333, end 820.653167
Metadata:
title : Chapter 05
Chapter #0:5: start 820.653167, end 1061.060000
Metadata:
title : Chapter 06
Stream #0:0(eng): Video: h264 (High), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
[...]
2. Getting the console output of OBS during recording (here with the OBS package from my distribution):
2.1: bitrate of 2.5k: https://drive.google.com/file/d/1cFbpYuu5ADK7LyqGLGZdDxOMPK2rHKqC/view?usp=sharing
2.2: bitrate of 50k: https://drive.google.com/file/d/1gRyvf98x0uQav6kIpTysCkfZqDMRdfs1/view?usp=sharing
2.3 Another test with 2.5k bitrate: https://obsproject.com/logs/rgVKdwKMWmPOysLH
3. A test with the flathub version of OBS (bitrate of 2.5k): https://drive.google.com/file/d/1veVSF6VB0qNhHqJqnnb8O_-iYrDOYC_p/view?usp=sharing
4. I also tested whether it makes a difference when capturing my desktop vs a 3d game and it did not make any difference at all.
My system:
Bash:
$ inxi -Fz
System:
Kernel: 5.10.43-1-lts x86_64 bits: 64 Desktop: Xfce 4.16.0
Distro: Arch Linux
Machine:
Type: Desktop Mobo: ASRock model: X399 Taichi serial: <filter>
UEFI: American Megatrends v: P3.60 date: 02/19/2019
CPU:
Info: 16-Core (2-Die) model: AMD Ryzen Threadripper 1950X bits: 64
type: MT MCP MCM cache: L2: 8 MiB
Speed: 3521 MHz min/max: 2200/3400 MHz Core speeds (MHz): 1: 3521 2: 3691
3: 1964 4: 2047 5: 1851 6: 3988 7: 1848 8: 1851 9: 3311 10: 3638 11: 2109
12: 1838 13: 1920 14: 1937 15: 2193 16: 1943 17: 1944 18: 3097 19: 3797
20: 2008 21: 2018 22: 2104 23: 3688 24: 1835 25: 2106 26: 2104 27: 2037
28: 1946 29: 2069 30: 2040 31: 3430 32: 3574
Graphics:
Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
driver: amdgpu v: kernel
Display: x11 server: X.Org 1.20.11 driver: loaded: amdgpu
unloaded: modesetting resolution: 2560x1440~144Hz
OpenGL: renderer: AMD Radeon RX 480 Graphics (POLARIS10 DRM 3.40.0
5.10.43-1-lts LLVM 12.0.0)
v: 4.6 Mesa 21.1.2
Audio:
Device-1: Creative Labs Sound Core3D [Sound Blaster Recon3D / Z-Series]
driver: snd_hda_intel
Device-2: AMD Family 17h HD Audio driver: snd_hda_intel
Device-3: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
driver: snd_hda_intel
Device-4: RODE Microphones RODE NT-USB type: USB
driver: hid-generic,snd-usb-audio,usbhid
Sound Server-1: ALSA v: k5.10.43-1-lts running: yes
Sound Server-2: PulseAudio v: 14.2 running: yes
Sound Server-3: PipeWire v: 0.3.30 running: yes
Network:
Device-1: Intel I211 Gigabit Network driver: igb
IF: enp4s0 state: down mac: <filter>
Device-2: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi
IF: wlp5s0 state: down mac: <filter>
Device-3: Intel I211 Gigabit Network driver: igb
IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
IF-ID-1: docker0 state: down mac: <filter>