dec05eba/gpu-screen-recorder-issues

[BUG] No HDR encoders available on RTX 3080

Closed this issue · 10 comments

Describe the bug
My RTX 3080 under Wayland and Plasma 6 with HDR enabled cannot record with the HDR encoder, as for some reason hevc_hdr isn't on the supported list. If I try to force hevc_hdr as an encoder, the program won't start.

To Reproduce
The GPU Screen Recorder command you ran or if you used the GUI version then describe which options you used.

Desktop (please complete the following information):

  • X11 or Wayland: Wayland
  • Desktop environment/Window Manager: Plasma 6.1.3
  • Distro: endeavourOS
  • GPU: NVIDIA RTX 3080
  • Version (latest flatpak version, aur or source): AUR source gpu-screen-recorder-git

Additional context
log.txt

My HDR monitor is a Samsung Odyssey Neo G7. HDR is enabled on settings. I'm able to record with HDR on OBS under Linux and Windows, and Shadowplay on Windows.

❯ gpu-screen-recorder --info
section=system_info
display_server wayland
section=gpu_info
vendor nvidia
section=video_codecs
h264
hevc
[av1_nvenc @ 0x5fb1234e93c0] No capable devices found
section=capture_options
DP-1 3840x2160
DP-2 1440x2560
portal

My variables:

WINDOW=screen
CONTAINER=mkv
QUALITY=very_high
CODEC=hevc
AUDIO_CODEC=opus
INPUT_DEVICE=alsa_input.usb-3142_Fifine_Microphone-00.mono-fallback
FRAMERATE=165
REPLAYDURATION=120
OUTPUTDIR=/home/vrkknn/Videos/gpu-screen-recorder
MAKEFOLDERS=yes
COLOR_RANGE=full
ADDITIONAL_ARGS=-fm vfr
ExecStart=/bin/pidof -q gpu-screen-recorder && exit 1 || /bin/sh -c 'AUDIO="${AUDIO_DEVICE:-$(pactl get-default-sink).monitor}"; gpu-screen-recorder -v no -w $WINDOW -c $CONTAINER -q $QUALITY -k $CODEC -ac $AUDIO_CODEC -a "$AUDIO" -a "$INPUT_DEVICE" -f $FRAMERATE -r $REPLAYDURATION -o "$OUTPUTDIR" -mf $MAKEFOLDERS -cr $COLOR_RANGE $ADDITIONAL_ARGS

After posting this issue I realised there's no reason to have this as a systemd service, so I decided to convert it to a simple .sh file.

toggle_replay.sh

#!/usr/bin/bash
NAME='gpu-screen-recorder'
PID=$(pidof gpu-screen-recorder)

if [ -n "$PID" ]; then
  killall -SIGINT gpu-screen-recorder
  notify-send -a $NAME -i process-stop 'Replay service stopped.'
else
  WINDOW=screen
  CONTAINER=mkv
  QUALITY=very_high
  CODEC=hevc
  AUDIO_CODEC=opus
  AUDIO="$(pactl get-default-sink).monitor"
  INPUT_DEVICE="$(pactl get-default-source)"
  FRAMERATE=165
  REPLAYDURATION=120
  OUTPUTDIR=/home/vrkknn/Videos/gpu-screen-recorder
  MAKEFOLDERS=yes
  COLOR_RANGE=full
  ADDITIONAL_ARGS=''
 
  notify-send -a $NAME -i QMPlay2 'Replay service started.'
 
  gpu-screen-recorder -v yes -w $WINDOW -c $CONTAINER -q $QUALITY -k $CODEC -ac $AUDIO_CODEC -a "$AUDIO" -a "$INPUT_DEVICE" -f $FRAMERATE -fm vfr -r $REPLAYDURATION -o "$OUTPUTDIR" -mf $MAKEFOLDERS -cr $COLOR_RANGE $ADDITIONAL_ARGS
fi

save_replay.sh

#!/usr/bin/sh
killall -SIGUSR1 gpu-screen-recorder
notify-send -a 'gpu-screen-recorder' -i simplescreenrecorder 'Replay saved!' ' '

--info wont output hdr because the assumption right now is that if your gpu supports hevc/av1 then it also supports hdr (which I think is always the case). You said the program doesn't start but you didn't post the error you get when you run the program with hevc_hdr option.

It seems that I did leave things half done here, sorry for that.
When I change to -k hevc_hdr, I get a segmentation fault:

❯ bash scripts/toggle_replay.sh
[hevc_nvenc @ 0x59cdf26972c0] ignoring invalid SAR: 0/0
gsr info: gsr_kms_client_init: waiting for server to connect
kms server info: connecting to the client
gsr info: gsr_kms_client_init: server connected
gsr info: replacing file-backed unix domain socket with socketpair
kms server info: connected to the client
gsr info: using socketpair
[hevc_nvenc @ 0x59cdf26972c0] ignoring invalid SAR: 0/0
scripts/toggle_replay.sh: line 30: 123785 Segmentation fault      (core dumped) gpu-screen-recorder -v yes -w $WINDOW -c $CONTAINER -q $QUALITY -k $CODEC -ac $AUDIO_CODEC -a "$AUDIO" -a "$INPUT_DEVICE" -f $FRAMERATE -fm vfr -r $REPLAYDURATION -o "$OUTPUTDIR" -mf $MAKEFOLDERS -cr $COLOR_RANGE $ADDITIONAL_ARGS

And a coredump:

           PID: 123309 (gpu-screen-reco)
           UID: 1000 (vrkknn)
           GID: 1000 (vrkknn)
        Signal: 11 (SEGV)
     Timestamp: Tue 2024-07-23 16:50:34 CEST (1min 40s ago)
  Command Line: gpu-screen-recorder -v yes -w screen -c mkv -q very_high -k hevc_hdr -ac opus -a alsa_output.usb-GuangZhou_FiiO_Electronics_Co._Ltd_FiiO_USB_DAC-E10-00.analog-stereo.monitor -a alsa_input.usb-3142_Fifine_Microphone-00.mono-fallback -f 165 -fm vfr -r 120 -o /home/vrkknn/Videos/gpu-screen-recorder -mf yes -cr full
    Executable: /usr/bin/gpu-screen-recorder
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@42c00d0943da4b21b806bbc9440c7366.service
          Unit: user@1000.service
     User Unit: app-org.kde.konsole@42c00d0943da4b21b806bbc9440c7366.service
         Slice: user-1000.slice
     Owner UID: 1000 (vrkknn)
       Boot ID: 4a9bdfa24a9146079177bc8db94f6118
    Machine ID: 88338c0f59be451f9a1d88c4392b1eff
      Hostname: endeavour
       Storage: /var/lib/systemd/coredump/core.gpu-screen-reco.1000.4a9bdfa24a9146079177bc8db94f6118.123309.1721746234000000.zst (present)
  Size on Disk: 3.6M
       Message: Process 123309 (gpu-screen-reco) of user 1000 dumped core.
                
                Stack trace of thread 123309:
                #0  0x00005ea979fb8981 gsr_kms_set_hdr_metadata (gpu-screen-recorder + 0x18981)
                #1  0x00005ea979facb14 gsr_capture_capture (gpu-screen-recorder + 0xcb14)
                #2  0x00007d916a039c88 n/a (libc.so.6 + 0x25c88)
                #3  0x00007d916a039d4c __libc_start_main (libc.so.6 + 0x25d4c)
                #4  0x00005ea979fae775 _start (gpu-screen-recorder + 0xe775)
                
                Stack trace of thread 123313:
                #0  0x00007d916a0a34e9 n/a (libc.so.6 + 0x8f4e9)
                #1  0x00007d916a0a5ed9 pthread_cond_wait (libc.so.6 + 0x91ed9)
                #2  0x00007d9157eba1e8 n/a (libEGL_nvidia.so.0 + 0xba1e8)
                #3  0x00007d9157e8a661 n/a (libEGL_nvidia.so.0 + 0x8a661)
                #4  0x00007d9157ec027e n/a (libEGL_nvidia.so.0 + 0xc027e)
                #5  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #6  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123314:
                #0  0x00007d916a11c39d __poll (libc.so.6 + 0x10839d)
                #1  0x00007d915a771a62 n/a (libnvidia-egl-wayland.so.1 + 0x4a62)
                #2  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #3  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123315:
                #0  0x00007d916a0a34e9 n/a (libc.so.6 + 0x8f4e9)
                #1  0x00007d916a0a5ed9 pthread_cond_wait (libc.so.6 + 0x91ed9)
                #2  0x00007d9157eba1e8 n/a (libEGL_nvidia.so.0 + 0xba1e8)
                #3  0x00007d9157eba365 n/a (libEGL_nvidia.so.0 + 0xba365)
                #4  0x00007d9157e9f278 n/a (libEGL_nvidia.so.0 + 0x9f278)
                #5  0x00007d9157ea06d3 n/a (libEGL_nvidia.so.0 + 0xa06d3)
                #6  0x00007d9157e497a4 n/a (libEGL_nvidia.so.0 + 0x497a4)
                #7  0x00007d915a772f78 n/a (libnvidia-egl-wayland.so.1 + 0x5f78)
                #8  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #9  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123329:
                #0  0x00007d916a0a34e9 n/a (libc.so.6 + 0x8f4e9)
                #1  0x00007d916a0a6242 pthread_cond_timedwait (libc.so.6 + 0x92242)
                #2  0x00007d913448c08a n/a (libnvcuvid.so.1 + 0x8c08a)
                #3  0x00007d913448b296 n/a (libnvcuvid.so.1 + 0x8b296)
                #4  0x00007d9134442406 n/a (libnvcuvid.so.1 + 0x42406)
                #5  0x00007d913448b526 n/a (libnvcuvid.so.1 + 0x8b526)
                #6  0x00007d913448bc8d n/a (libnvcuvid.so.1 + 0x8bc8d)
                #7  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #8  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123335:
                #0  0x00007d916a11c910 ppoll (libc.so.6 + 0x108910)
                #1  0x00007d916bdc84e3 pa_mainloop_poll (libpulse.so.0 + 0x1d4e3)
                #2  0x00005ea979fbef65 _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZ4mainEUlvE_EEEEE6_M_runEv (gpu-screen-recorder + 0x1ef65)
                #3  0x00007d916a2e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84)
                #4  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #5  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123317:
                #0  0x00007d916a11c39d __poll (libc.so.6 + 0x10839d)
                #1  0x00007d914a64164f n/a (libcuda.so.1 + 0x24164f)
                #2  0x00007d914a70f18f n/a (libcuda.so.1 + 0x30f18f)
                #3  0x00007d914a63c233 n/a (libcuda.so.1 + 0x23c233)
                #4  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #5  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123336:
                #0  0x00007d916a11c910 ppoll (libc.so.6 + 0x108910)
                #1  0x00007d916bdc84e3 pa_mainloop_poll (libpulse.so.0 + 0x1d4e3)
                #2  0x00005ea979fbef65 _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZ4mainEUlvE_EEEEE6_M_runEv (gpu-screen-recorder + 0x1ef65)
                #3  0x00007d916a2e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84)
                #4  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #5  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123328:
                #0  0x00007d916a0a34e9 n/a (libc.so.6 + 0x8f4e9)
                #1  0x00007d916a0a6242 pthread_cond_timedwait (libc.so.6 + 0x92242)
                #2  0x00007d914a5a63ca n/a (libcuda.so.1 + 0x1a63ca)
                #3  0x00007d914a63c233 n/a (libcuda.so.1 + 0x23c233)
                #4  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #5  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123326:
                #0  0x00007d916a11c39d __poll (libc.so.6 + 0x10839d)
                #1  0x00007d914a64164f n/a (libcuda.so.1 + 0x24164f)
                #2  0x00007d914a70f18f n/a (libcuda.so.1 + 0x30f18f)
                #3  0x00007d914a63c233 n/a (libcuda.so.1 + 0x23c233)
                #4  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #5  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                
                Stack trace of thread 123330:
                #0  0x00007d916a0a34e9 n/a (libc.so.6 + 0x8f4e9)
                #1  0x00007d916a0a6242 pthread_cond_timedwait (libc.so.6 + 0x92242)
                #2  0x00007d913448c08a n/a (libnvcuvid.so.1 + 0x8c08a)
                #3  0x00007d913448b296 n/a (libnvcuvid.so.1 + 0x8b296)
                #4  0x00007d9134417f6e n/a (libnvcuvid.so.1 + 0x17f6e)
                #5  0x00007d913448b526 n/a (libnvcuvid.so.1 + 0x8b526)
                #6  0x00007d913448bc8d n/a (libnvcuvid.so.1 + 0x8bc8d)
                #7  0x00007d916a0a6ded n/a (libc.so.6 + 0x92ded)
                #8  0x00007d916a12a0dc n/a (libc.so.6 + 0x1160dc)
                ELF object binary architecture: AMD x86-64

core.gpu-screen-reco.1000.4a9bdfa24a9146079177bc8db94f6118.123785.1721746387000000.tar.gz

Thanks. I think its a bug when using replay mode. Can you instead run gpu-screen-recorder -w screen -f 60 -k hevc_hdr -o video.mp4 to see if that works?

That did work without issues, so your suspicion seems correct

❯ gpu-screen-recorder -w screen -f 60 -k hevc_hdr -o video.mp4
[hevc_nvenc @ 0x569b6e4d59c0] ignoring invalid SAR: 0/0
gsr info: gsr_kms_client_init: waiting for server to connect
kms server info: connecting to the client
gsr info: gsr_kms_client_init: server connected
gsr info: replacing file-backed unix domain socket with socketpair
kms server info: connected to the client
gsr info: using socketpair
[hevc_nvenc @ 0x569b6e4d59c0] ignoring invalid SAR: 0/0
update fps: 244, damage fps: 244
update fps: 247, damage fps: 247
update fps: 247, damage fps: 247
update fps: 247, damage fps: 247
update fps: 247, damage fps: 247
^C%  

And HDR is working too

20240723_050300

Also I think there's something going on with the HDR colour data, there's some colour bleeding. I know this should be a second issue, but just letting you know
20240723_050408
(The big window buttons are mpv, the ones on the background with the red bleeding are the video)

video.mp4

I think that is just a limitation of yuv420 color format, since colors are compressed. It might be less noticable if you use ultra quality and -cr full, but it wont fix it completely. The solution would be to record with yuv444 but that is not supported right now (nvidia cards supports this but amd cards don't, and websites dont support it either). Its mostly noticable with white text on a colored background or colored text (especially red). It's much less noticable in games/movies.

Also the crash with replay should be fixed now. Please update to the latest version on aur and test.

Just updated and it's working as expected now, thank you!
And about the colours, I've done testing here and it's really not that noticeable on games and videos. I guess my small fonts on 2160p have exaggerated the issue.

Thanks. I'll eventually add the option to use yuv444 on nvidia only since it's useful for remote desktop usage.