dec05eba / gpu-screen-recorder-issues

GPU Screen Recorder issue tracker
20 stars 0 forks source link

[BUG] Nvidia 2060 Mobile black screen on wayland #43

Closed mercifulboss closed 3 months ago

mercifulboss commented 3 months ago

Describe the bug When I click "record" on wayland, I get a black screen but sound is recorded. Even using CLI with the -w command doesn't work. I have to put prime-run into Environmental Variables, otherwise the gui doesn't open. In addition, I tried every single video codec available, the outcome does not change - the output is still a black screen. Running the program with sudo prime-run only causes it to crash.

To Reproduce Screenshot_20240814_171942

Desktop (please complete the following information):

Additional context Add any other context about the problem here, such as terminal output of running GPU Screen Recorder and if the issue isn't related to audio then please run sudo drm_info > log.txt and attach that log.txt file in this bug report. drm_info can be installed from your package manager or from https://gitlab.freedesktop.org/emersion/drm_info.

log.txt

Attach a video that shows the issue (if applicable), in raw form as output by GPU Screen Recorder or a losslessly cut version of it (you can use https://flathub.org/apps/org.gnome.gitlab.YaLTeR.VideoTrimmer for example to do this).

https://github.com/user-attachments/assets/980d5c3a-908e-4e79-8f9a-6874904e0f98

Which game did you run while recording (if any) and does the issue also happen if you only record your desktop?

Haven't tried game, only desktop. Wanted to use it primairly for the purpose of doing high quality desktop recordings.

Edit:

I tried running it with starcraft 2 on default settings, and it only records sound but not video

https://github.com/user-attachments/assets/0304bba3-974d-47ac-8094-cc25fb4de04d

Does the issue also happen if you use obs studio instead with equivalent settings (video encoding settings and audio codec settings. Nvenc on nvidia and vaapi on amd/intel and same video/audio codec)?

No. OBS studio with pipewire works fine to screen record

If you have an issue with audio make sure you are not using pulseaudio/pipewire audio processing software such as EasyEffects.

Audio records fine. Video does not

If you are setting any amd/intel/nvidia/mesa/vaapi/pulseaudio/pipewire environment variables then please list those.

prime-run

dec05eba commented 3 months ago

I have confirmed that the first issue is a bug. It happens when your laptops monitor is disabled. It should work if you enable it, then you can also capture your other monitor with desktop portal option. I'll fix this issue. Desktop portal capture doesn't seem to work when using prime-run (obs also ends up copying the data to cpu in that case instead so it seems like its more of a pipewire limitation). So that option will have to be disabled when using prime run. But recording your monitor with prime-run (non desktop portal option) should have worked. Can you run this and copy the terminal output here?: prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4

mercifulboss commented 3 months ago

prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4

Info: using h264 encoder because a codec was not specified [h264_nvenc @ 0x627bd183d2c0] 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 [h264_nvenc @ 0x627bd183d2c0] ignoring invalid SAR: 0/0 update fps: 245, damage fps: 245 update fps: 246, damage fps: 246 update fps: 246, damage fps: 246 update fps: 246, damage fps: 246 update fps: 247, damage fps: 247 update fps: 246, damage fps: 246

Edit:

https://github.com/user-attachments/assets/70a60011-cab8-4b8b-8349-c5d15dff531a

dec05eba commented 3 months ago

can you upload that raw video.mp4 file here?

mercifulboss commented 3 months ago

can you upload that raw video.mp4 file here?

https://github.com/user-attachments/assets/b2b87212-0849-4ef2-9cdd-4e8148a2e2f1

I have my laptop in clamshell mode - the laptop is closed, on a stand and an external monitor and keyboard attached. This is why I didn't know that the monitor output doesn't work (however, in the video I posted earlier it shows that when selecting screen the thumbnail has a visible screen).

I know I am not supposed to use prime-run, but the program doesn't open if I don't. It seems like its not detecting the iGPU on my processor (Intel CometLake-H GT2 [UHD Graphics] )

dec05eba commented 3 months ago

Can you try this:

git clone https://repo.dec05eba.com/gpu-screen-recorder
cd gpu-screen-recorder
git checkout e4832f3d643abf8adf1f5872614b020c833afd0b
sudo ./install.sh

and try prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4 again? (after that you can revert back to the latest version by installing gpu screen recorder from aur again).

mercifulboss commented 3 months ago

prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4 [hevc_nvenc @ 0x5aa295cefac0] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified 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 @ 0x5aa295cefac0] ignoring invalid SAR: 0/0 update fps: 246 update fps: 246 update fps: 247 update fps: 246 update fps: 246 update fps: 247 update fps: 247 update fps: 247 update fps: 247

There is no video output. I deleted the previous file and no new video.mp4 file shows up in the $HOME directory

git clone https://repo.dec05eba.com/gpu-screen-recorder cd gpu-screen-recorder git checkout e4832f3d643abf8adf1f5872614b020c833afd0b sudo ./install.sh

Edit: did it again, it worked. I got no output for video.mp4

image

dec05eba commented 3 months ago

Ok thanks. Can you try this in that directory:

git checkout master
git pull
sudo ./install.sh

and try recording again? i added some debug outputs.

mercifulboss commented 3 months ago

Ok thanks. Can you try this in that directory:

git checkout master
git pull
sudo ./install.sh

and try recording again? i added some debug outputs.

I put each command in line by line, it did some installing and then put the command prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4

image

No video.mp4 file was generated.

dec05eba commented 3 months ago

im pretty sure there is a video.mp4 file in that directory, but its likely black anyways

mercifulboss commented 3 months ago

im pretty sure there is a video.mp4 file in that directory, but its likely black anyways

I ran the command again. I am checking the /home/ directory but don't see anything? perhaps its the wrong directory?

dec05eba commented 3 months ago

the video is in the directory you run the gpu-screen-recorder command in (gpu-screen-recorder)

mercifulboss commented 3 months ago

the video is in the directory you run the gpu-screen-recorder command in (gpu-screen-recorder)

Ah apologies. Silly of me. I found it.

https://github.com/user-attachments/assets/62f3f169-0f3c-43e4-a09b-b2c2d81b2e4a

dec05eba commented 3 months ago

ok i added more debug log. Can you try git pull again and record again?

mercifulboss commented 3 months ago

ok i added more debug log. Can you try git pull again and record again?

image

Deleted the old video.mp4 video. Here is the new one:

https://github.com/user-attachments/assets/1f72651b-6497-4aa3-947b-48c9771e5587

dec05eba commented 3 months ago

Can you install the latest version of gpu screen recorder from aur and try these commands, and look at the video file after each command: gpu-screen-recorder -w portal -f 60 -o video.mp4 prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4

mercifulboss commented 3 months ago

gpu-screen-recorder -w portal -f 60 -o video.mp4

image

The option to choose which screen to use showed up. So I clicked full screen. Here is the resultant video:

https://github.com/user-attachments/assets/9a0f1b7d-271a-4319-8979-1f1ebb2c6d53

prime-run gpu-screen-recorder -w screen -f 60 -o video.mp4

I opened this in another directory so as not to confuse the video.mp4 files

image

Here is the video file:

https://github.com/user-attachments/assets/ef8b8abc-a20c-436c-a24b-62929df95828

Edit: I have tested launching the program without prime-run in environment variables. It seems to work but gives worse quality video as it says "running on intel". The prime-run command gives superior video quality.

Compare:

Intel:

https://github.com/user-attachments/assets/8e63bf90-7f64-417c-b749-ebb0e7544c86

Nvidia with prime-run:

https://github.com/user-attachments/assets/e75bcb05-66ed-466d-afb1-9eb7500c42e5

To my eye there is a difference. Maybe that's just me.

Also one request: would it be possible to have GPU-Screen-Recorder work like spectacle where it will launch and start recording with a hotkey? I have bound the hotkey Meta+C to get it to start recording, but that only works if the program is open. However, if the program is not open recording does not work. That would be very quick and convenient. After all the shortcut for GPU-Screen-Recorder was integrated into the KDE keyboard shortcuts page, but it would be nice if it also had one to launch and start recording. I was planning on making a video about linux apps for youtube and including this program.

dec05eba commented 3 months ago

Im working on re-designing the UI so it works like shadowplay where you have the option to start it on system startup and can press a hotkey at any time to start recording, etc. Unfortunately wayland makes it painful/impossible, but at least it should work on kde plasma wayland. Before that is done you have some options other options:

If you want the hotkey for replay then you can start the systemd service included in the aur package, with systemctl enable --now --user gpu-screen-recorder. There is more info about that here: https://git.dec05eba.com/gpu-screen-recorder/about/. Then in kde shortcut settings in kde system settings you can bind a key to run this command: https://git.dec05eba.com/gpu-screen-recorder/tree/scripts/save-replay.sh.

If you want to start regular recording with a hotkey then you can go to KDE shortcuts setting in the system settings menu and choose which command to run when a hotkey is pressed. With that you can bind a key to run this script with prime-run: https://git.dec05eba.com/gpu-screen-recorder/tree/scripts/start-recording.sh and bind another key to run this script: https://git.dec05eba.com/gpu-screen-recorder/tree/scripts/save-recording.sh to save the recording.

But anyways, the issues reported here are fixed now right? as for the quality, yes nvidia has superior encoder quality. If you want better quality on intel (or even on nvidia) you can switch to another video codec in the settings. h264 is the default which is actually kinda the worst, but it works best. If your intel/nvidia gpu supports hevc then choose that instead, or av1 which is even better. vp8/vp9 might even be better than h264. Or just choose ultra quality in the settings.

mercifulboss commented 3 months ago

Im working on re-designing the UI so it works like shadowplay where you have the option to start it on system startup and can press a hotkey at any time to start recording, etc. Unfortunately wayland makes it painful/impossible, but at least it should work on kde plasma wayland. Before that is done you have some options other options:

If you want the hotkey for replay then you can start the systemd service included in the aur package, with systemctl enable --now --user gpu-screen-recorder. There is more info about that here: https://git.dec05eba.com/gpu-screen-recorder/about/.

If you want to start regular recording with a hotkey then you can go to KDE shortcuts setting in the system settings menu and choose which command to run when a hotkey is pressed. With that you can bind a key to run this script with prime-run: https://git.dec05eba.com/gpu-screen-recorder/tree/scripts/start-recording.sh and bind another key to run this script: https://git.dec05eba.com/gpu-screen-recorder/tree/scripts/save-recording.sh to save the recording.

But anyways, the issues reported here are fixed now right? as for the quality, yes nvidia has superior encoder quality. If you want better quality on intel (or even on nvidia) you can switch to another video codec in the settings. h264 is the default which is actually kinda the worst, but it works best. If your intel/nvidia gpu supports hevc then choose that instead, or av1 which is even better. vp8/vp9 might even be better than h264. Or just choose ultra quality in the settings.

Thank you for fixing this so fast. It seems to work. I really appreciate it. Do you have an approximate ETA for the redesign (no rush just curious)?

Also why are hotkeys difficult/impossible on wayland? KDE seems to have implemented them for their DE, so it seems to my unprofessional eye to be possible? Also, check out Espanso, its a text expander that works on Wayland, and they managed to get global hotkeys to work.

dec05eba commented 3 months ago

It will take a while, because im not working actively on it. Its not something you should wait for on your seat. But the x11 version of it will come out much earlier than the wayland version. gpu screen recorder is a command line-first application and that is how its meant to really be used, the ui is just a minor convenience for that. KDE plasma supports global hotkeys on wayland yes, but no other wayland compositor does (hyprlands implementation is buggy and doesn't work in the same way, the kde plasma shortcut is also buggy but at least it works). But its not just shortcuts. For example a fullscreen overlay like nvidia shadowplay is not possible on gnome either. Neither is the shadowplay style notifications. Sway doesn't seem to really support it either. I dunno if kde plasma does. Wayland philosophy doesn't like having transparency and fullscreen windows, because of """security""".