dec05eba / gpu-screen-recorder-issues

GPU Screen Recorder issue tracker
11 stars 0 forks source link

[BUG] Framerate mode "constant" results in stuttering video export on Ubuntu #15

Closed Sturmlocke86 closed 3 months ago

Sturmlocke86 commented 3 months ago

Describe the bug Not sure if this is a bug or not, seeking help here. Video framerate is stuttering and unstable in certain games when using "constant" framerate for recording. I require constant framerate for video editing post recording. Some games run just fine, others are stuttering at 1 fps. Tested with both Steam + Proton as Flatpak and Snap on Ubuntu 23.10 and 22.04.

Example stuttering video: Alien Isolation, Everquest 2

Example fluid 60 fps video: Turok 2 PC remaster, Aliens vs Predator 1, Crazy Taxi

To Reproduce

See attached screenshot: I tried lowering the video quality settings to medium, changing the codec from H265 to H264, and dropping the resolution of the game to lower levels. I usually record at 4k60 resolution, but lower resolutions have the same issue. Lowering the graphics in-game to the lowest setting doesn't help the issue either.

Expected behavior I expect the video to run at buttery smooth 60 fps.

Screenshots See screenshots and video examples attached to this report.

Desktop (please complete the following information):

Additional context

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 21:42:45.851: Failed to load module "canberra-gtk-module" Gtk-Message: 21:42:45.852: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388707 Warning: opus and flac audio codecs are temporary disabled, using aac audio codec instead [hevc_nvenc @ 0x603820a9c280] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x603820a9c280] ignoring invalid SAR: 0/0 update fps: 239 update fps: 77 update fps: 27 update fps: 17 update fps: 13 update fps: 10 update fps: 10 update fps: 9 update fps: 7 update fps: 6 update fps: 5 update fps: 4 update fps: 4 update fps: 5 update fps: 4 update fps: 4 update fps: 3 update fps: 3 update fps: 3 update fps: 3 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 1 update fps: 2 update fps: 2 update fps: 2 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1 Notification: title: GPU Screen Recorder, body: The recording was saved to /home/sturmlocke/Videos/GPU Screen Rec/Video_2024-04-26_21-44-12.mp4

I have been recording on openSUSE Leap 15.5 with another PC that is identical to this one hardware-wise, and have not experienced these issues on openSUSE (recording with the exact same settings with constant framerate mode produces 60 fps smooth videos on Suse). On Ubuntu, recording anything outside of Steam and Proton runs just fine. I have tried recording standalone Flatpak and Snap games, such as Xonotic, and the video is super smooth at 60 fps. Worth mentioning: I've noticed that the Nvidia video engine is often at 90-100% load for the videos recorded where it's stuttering badly. In other words, 90-100% load during recording. No fps-drops in gameplay, only the video stutters post recording.

Tested with MPV player, VLC and Gnome Video player. Importing the video into Shotcut or Kdenlive video editior shows the same stuttering picture.

Feel free to ask for more infos, will gladly provide more feedback.

https://github.com/dec05eba/gpu-screen-recorder-issues/assets/86625411/020ad589-432e-469e-96cf-5d14d6747d69

Bildschirmfoto vom 2024-04-26 22-07-33

Sturmlocke86 commented 3 months ago

Reuploading the video because it's not showing the video in the bug report above (only the audio can be heard). Here is the video in .zip.

Video_2024-04-26_22-42-38-constantfps.zip

dec05eba commented 3 months ago

I usually record at 4k60 resolution

Is that for the game resolution or screen resolution? are you recording at 4k60fps on the opensuse system too? the game resolution doesn't matter, only the system resolution does. If you record with variable framerate mode what does it output in the terminal? (the update fps message), when recording the game that causes that video lag

dec05eba commented 3 months ago

other than that, you can try if updating your nvidia driver to the same version as the one used in opensuse (or just the latest version that ubuntu allows in the driver menu) to see if that fixes it (remember to run flatpak update after that and reboot as well, as flatpak driver version also needs to match the system nvidia driver version). Also when did you record on opensuse? are you using the same gpu screen recorder version on both? if there has been a gpu screen recorder update since then then you can try install an older version of gpu screen recorder (I can find the version if you tell me a date).

Sturmlocke86 commented 3 months ago

I usually record at 4k60 resolution

Is that for the game resolution or screen resolution? are you recording at 4k60fps on the opensuse system too? the game resolution doesn't matter, only the system resolution does. If you record with variable framerate mode what does it output in the terminal? (the update fps message), when recording the game that causes that video lag

It's both the game and screen resolution. It's a 4k60 Samsung monitor and I have all games set to the native 4k60 reso of the monitor. Yes, it's the same reso for openSUSE too. Will try to record Alien Isolation with variable framerate right now and will post the terminal results for you. Be right back!

Sturmlocke86 commented 3 months ago

other than that, you can try if updating your nvidia driver to the same version as the one used in opensuse (or just the latest version that ubuntu allows in the driver menu) to see if that fixes it (remember to run flatpak update after that and reboot as well, as flatpak driver version also needs to match the system nvidia driver version). Also when did you record on opensuse? if there has been a gpu screen recorder update since then then you can try install an older version of gpu screen recorder (I can find the version if you tell me a date).

Yeah, I was thinking about doing that, but Ubuntu doesn't offer any of the new drivers via its driver tool due to some outstanding bugs in 23.10 and 24.04: https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/2062967

Right now V535 is the newest driver that Ubuntu offers in 24.04 lts via its driver tool.

I would have to add the community PPA for newer drivers, but I am very hesitant of doing so because I have experienced serious issues with stability by using anything other than the "tested" and "recommended" Ubuntu driver. Last time I used an "untested" driver, system updates nuked the Ubuntu system, rendering it unbootable (recovery was necessary). This is actually a point where openSUSE does it much more stable and reliable tbh.

Good question, iirc the last video that I recorded on openSUSE was approx 3-4 weeks ago, see here for performance: https://youtu.be/nXboAhXmZlE?si=lfijWpEjM3geBn2E

Pretty sure that was on the openSUSE machine. But to be 100% certain, we could go back as far as two months, because that's when I recorded this video here: https://youtu.be/df-xd067L_Y?si=Qf7vgibLJbKERsVq&t=92

In both cases, I recorded at 4k60 game and screen resolution, which you can see because the quality of the videos is really good (make sure to select 4k reso in the Youtube player). I haven't tested DCUO on Ubuntu 24.04 yet, but I will give it a whirl right now together with Alien Isolation. Brb.

dec05eba commented 3 months ago

the video description in those videos say that you recorded with obs studio. Is that just incorrect information or was it recorded with obs studio?

Sturmlocke86 commented 3 months ago

the video description in those videos say that you recorded with obs studio. Is that just incorrect information or was it recorded with obs studio?

It's incorrect information because I copy and paste some of the descriptions from previous videos to save time. Totally forgot to add gpu screen record, but I did at it at the end of the 1h long dcuo video during the credit screen roll at the very end (software used for the video). Thx for pointing that out! Will correct that soon. I was using obs for the longest time, but had to switch because of audio hiccups with it. Also, obs struggles to do 4k60 with the simple preset settings, and then I found your app, which was doing really well at 4k60 as you can see in the videos on yt.

Here's the output from Alien Isolation with variable framerate mode:

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 23:48:34.392: Failed to load module "canberra-gtk-module" Gtk-Message: 23:48:34.393: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388623 Warning: opus and flac audio codecs are temporary disabled, using aac audio codec instead [hevc_nvenc @ 0x5e067fe39fc0] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x5e067fe39fc0] ignoring invalid SAR: 0/0 update fps: 138 update fps: 57 update fps: 57 update fps: 57 update fps: 59 update fps: 56 update fps: 56 update fps: 56 update fps: 53 update fps: 50 update fps: 52 update fps: 176 update fps: 51 update fps: 49 update fps: 52 update fps: 54 update fps: 53 update fps: 54 update fps: 53 update fps: 52 update fps: 54 update fps: 57 update fps: 58 update fps: 57 update fps: 154 update fps: 113 update fps: 56 update fps: 54 update fps: 53 update fps: 52 update fps: 53 update fps: 54 update fps: 55 update fps: 55 update fps: 54 update fps: 53 update fps: 51 update fps: 51 update fps: 54 update fps: 111 update fps: 246 update fps: 207 update fps: 54 update fps: 57 update fps: 46 update fps: 43 update fps: 46 update fps: 42 update fps: 35 update fps: 34 update fps: 42 update fps: 44 update fps: 46 update fps: 44 update fps: 42 update fps: 47 update fps: 47 update fps: 45 update fps: 41 update fps: 39 update fps: 46 update fps: 39 update fps: 44 update fps: 48 update fps: 43 update fps: 43 update fps: 45 update fps: 44 update fps: 51 update fps: 45 update fps: 47 update fps: 48 update fps: 47 update fps: 46 update fps: 42 update fps: 45 update fps: 47 update fps: 57 update fps: 48 update fps: 44 update fps: 42 update fps: 47 update fps: 47 update fps: 44 update fps: 42 update fps: 47 update fps: 46 update fps: 47 update fps: 45 update fps: 43 update fps: 43 update fps: 48 update fps: 50 update fps: 48 update fps: 49 update fps: 41 update fps: 47 update fps: 44 update fps: 46 update fps: 44 update fps: 39 update fps: 42 update fps: 45 update fps: 40 update fps: 40 update fps: 42 update fps: 44 update fps: 44 update fps: 42 update fps: 42 update fps: 39 update fps: 44 update fps: 47 update fps: 42 Notification: title: GPU Screen Recorder, body: The recording was saved to /home/sturmlocke/Videos/GPU Screen Rec/Video_2024-04-26_23-49-04.mp4

This is running around for one or two minutes. Fps is all over the place. In-game though it's buttery smooth 60fps. Dcuo is next. Will try constant fps and see what happens. brb

dec05eba commented 3 months ago

no need to try constant fps, it will be bad. That update fps means that either you gpu simply cant encode video fast enough or opengl fps in gpu screen recorder gets limited for whatever reason. If it works in opensuse but not ubuntu then it might really be an issue in the nvidia driver that might get fixed by an update.

dec05eba commented 3 months ago

One thing you can try doing is record the monitor instead of window, and only have one monitor connected. If that doesn't change anything you can try downgrading gpu screen recorder by running: flatpak update --commit=f352ca2bdc926b74e0a1bf3ecaf4909bef38adc1e1914f5732dc1ed430527b8c com.dec05eba.gpu_screen_recorder (2 month old version) to see if it changes anything? run with variable framerate mode with this version as well and post the terminal output. If this doesn't change anything then you can try installing gpu screen recorder from source. There is a small difference if you use the non-flatpak version.

Sturmlocke86 commented 3 months ago

Ok, can't login to dcuo right now. Not sure why, will check later. Will try downgrading gpu screen rec right now. brb

dec05eba commented 3 months ago

Ok, can't login to dcuo right now. Not sure why, will check later. Will try downgrading gpu screen rec right now. brb

testing with alien isolation only should be fine, that variable framerate terminal output from alien isolation tells me everything I need to know. But can you try recording your monitor first (instead of window) before you downgrade? and only have one monitor connected

Sturmlocke86 commented 3 months ago

One thing you can try doing is record the monitor instead of window, and only have one monitor connected. If that doesn't change anything you can try downgrading gpu screen recorder by running: flatpak update --commit=f352ca2bdc926b74e0a1bf3ecaf4909bef38adc1e1914f5732dc1ed430527b8c com.dec05eba.gpu_screen_recorder (2 month old version) to see if it changes anything? run with variable framerate mode with this version as well and post the terminal output. If this doesn't change anything then you can try installing gpu screen recorder from source. There is a small difference if you use the non-flatpak version.

This worked! Downgrading to that version actually worked. Recording at very high settings + constant framerate mode at 4k60 reso = buttery smooth again. I'll record a short clip and show it to you right now. I recorded my window like I always do, worked like a charm this time.

dec05eba commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Sturmlocke86 commented 3 months ago

One thing you can try doing is record the monitor instead of window, and only have one monitor connected. If that doesn't change anything you can try downgrading gpu screen recorder by running: flatpak update --commit=f352ca2bdc926b74e0a1bf3ecaf4909bef38adc1e1914f5732dc1ed430527b8c com.dec05eba.gpu_screen_recorder (2 month old version) to see if it changes anything? run with variable framerate mode with this version as well and post the terminal output. If this doesn't change anything then you can try installing gpu screen recorder from source. There is a small difference if you use the non-flatpak version.

This worked! Downgrading to that version actually worked. Recording at very high settings + constant framerate mode at 4k60 reso = buttery smooth again. I'll record a short clip and show it to you right now. I recorded my window like I always do, worked like a charm this time.

Quoting myself here. This is the video when using this comment of yours. Works great! See attached zip.

Video_2024-04-27_00-32-34-constant.zip

Sturmlocke86 commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Sure, will test and report in a few minutes. brb

ps: do I have to reboot the computer after switching versions?

dec05eba commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Sure, will test and report in a few minutes. brb

ps: do I have to reboot the computer after switching versions?

no

Sturmlocke86 commented 3 months ago

But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Want me to test recording the monitor with the current version before using the new commit or after I switch to the new version that you posted?

dec05eba commented 3 months ago

But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Want me to test recording the monitor with the current version before using the new commit or after I switch to the new version that you posted?

update to that version and record with variable framerate and record window like you do now and post the terminal output. If it shows 50~ fps instead of 247~ something then try with recording your monitor instead

dec05eba commented 3 months ago

but also I wanted to see the terminal output when you captured in that working version, when recording with variable framerate. It's important even if it's working. Also you dont have to record for minutes, you can just alt-tab the game, change gpu screen recorder version, alt tab back to game and record ~10 seconds

Sturmlocke86 commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Ok, tested this commit here and the issue is back. Constant framerate mode is stuttering and even though variable framerate mode is a bit more stable now, fps is still very low compared to the in-game fps. Variable mode: in-game 60fps and the recorded video is worse. Logs:

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 00:48:01.032: Failed to load module "canberra-gtk-module" Gtk-Message: 00:48:01.033: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388671 [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 update fps: 72 update fps: 43 update fps: 44 update fps: 42 update fps: 43 update fps: 43 update fps: 42 update fps: 42 update fps: 43 update fps: 43 update fps: 44 update fps: 44 update fps: 43 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 45 update fps: 43 update fps: 42 update fps: 41 update fps: 42 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 48 update fps: 43 update fps: 41 update fps: 42 update fps: 42 update fps: 45 update fps: 44 update fps: 42 update fps: 45 update fps: 44 update fps: 41 update fps: 45 update fps: 45 update fps: 45 update fps: 43 update fps: 39 update fps: 48 update fps: 44 update fps: 46 update fps: 50 update fps: 54

It's not maintaining 60fps and you can tell it's not that smooth by watching the video. I also noticed how performance of the game degraded to what feels like 20 fps after hitting record and stop a couple of times. I had to quit the game and relaunch it for the performance to go back to normal to 60fps as it was before.

Sturmlocke86 commented 3 months ago

but also I wanted to see the terminal output when you captured in that working version, when recording with variable framerate. It's important even if it's working. Also you dont have to record for minutes, you can just alt-tab the game, change gpu screen recorder version, alt tab back to game and record ~10 seconds

Ok, I can switch back to the working version and provide the logs for that. Brb

dec05eba commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Ok, tested this commit here and the issue is back. Constant framerate mode is stuttering and even though variable framerate mode is a bit more stable now, fps is still very low compared to the in-game fps. Variable mode: in-game 60fps and the recorded video is worse. Logs:

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 00:48:01.032: Failed to load module "canberra-gtk-module" Gtk-Message: 00:48:01.033: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388671 [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 update fps: 72 update fps: 43 update fps: 44 update fps: 42 update fps: 43 update fps: 43 update fps: 42 update fps: 42 update fps: 43 update fps: 43 update fps: 44 update fps: 44 update fps: 43 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 45 update fps: 43 update fps: 42 update fps: 41 update fps: 42 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 48 update fps: 43 update fps: 41 update fps: 42 update fps: 42 update fps: 45 update fps: 44 update fps: 42 update fps: 45 update fps: 44 update fps: 41 update fps: 45 update fps: 45 update fps: 45 update fps: 43 update fps: 39 update fps: 48 update fps: 44 update fps: 46 update fps: 50 update fps: 54

It's not maintaining 60fps and you can tell it's not that smooth by watching the video. I also noticed how performance of the game degraded to what feels like 20 fps after hitting record and stop a couple of times. I had to quit the game and relaunch it for the performance to go back to normal to 60fps as it was before.

is that log when recording monitor?

Sturmlocke86 commented 3 months ago

hmm damn ok, can you try flatpak update --commit=95dfff4968bfd3059a362b01155e2c6034c313515ec15c7e3b66e324f8d8e8ce com.dec05eba.gpu_screen_recorder and record and see if that messes it up? that will give me the exact commit that made it worse. But also that makes it worse can you try recording your monitor instead of a single window to see if it also has performance issue? that will also help with debug

Ok, tested this commit here and the issue is back. Constant framerate mode is stuttering and even though variable framerate mode is a bit more stable now, fps is still very low compared to the in-game fps. Variable mode: in-game 60fps and the recorded video is worse. Logs: flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 00:48:01.032: Failed to load module "canberra-gtk-module" Gtk-Message: 00:48:01.033: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388671 [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x63b8779f9180] ignoring invalid SAR: 0/0 update fps: 72 update fps: 43 update fps: 44 update fps: 42 update fps: 43 update fps: 43 update fps: 42 update fps: 42 update fps: 43 update fps: 43 update fps: 44 update fps: 44 update fps: 43 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 45 update fps: 43 update fps: 42 update fps: 41 update fps: 42 update fps: 44 update fps: 44 update fps: 44 update fps: 45 update fps: 42 update fps: 44 update fps: 45 update fps: 42 update fps: 43 update fps: 48 update fps: 43 update fps: 41 update fps: 42 update fps: 42 update fps: 45 update fps: 44 update fps: 42 update fps: 45 update fps: 44 update fps: 41 update fps: 45 update fps: 45 update fps: 45 update fps: 43 update fps: 39 update fps: 48 update fps: 44 update fps: 46 update fps: 50 update fps: 54 It's not maintaining 60fps and you can tell it's not that smooth by watching the video. I also noticed how performance of the game degraded to what feels like 20 fps after hitting record and stop a couple of times. I had to quit the game and relaunch it for the performance to go back to normal to 60fps as it was before.

is that log when recording monitor?

No, that's the log when recording the window. I can retry with the monitor if you want? Just recorded the variable framerate log for the working version. Will post in a second. brb

Sturmlocke86 commented 3 months ago

This is the log for the working version with variable framerate and window selection in gpu screen rec:

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 01:02:24.002: Failed to load module "canberra-gtk-module" Gtk-Message: 01:02:24.003: Failed to load module "canberra-gtk-module" window name: Alien: Isolation, window id: 8388703 [hevc_nvenc @ 0x5b9edc98f6c0] ignoring invalid SAR: 0/0 Info: using hevc encoder because a codec was not specified [hevc_nvenc @ 0x5b9edc98f6c0] ignoring invalid SAR: 0/0 update fps: 244 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 246 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247 update fps: 247

The recorded video is buttery smooth with both variable and constant framerate mode with the working version of gpu screen rec. I can also tell that the file size it creates is actually bigger now.

dec05eba commented 3 months ago

Ok thanks, finally can you try recording variable framerate mode with this version: flatpak update --commit=09931552deea1e3d5087944b83a9a62fcd45e497b8d1ae8bf2a39651b997ca34 com.dec05eba.gpu_screen_recorder ? and post terminal output.

Sturmlocke86 commented 3 months ago

Ok thanks, finally can you try recording variable framerate mode with this version: flatpak update --commit=09931552deea1e3d5087944b83a9a62fcd45e497b8d1ae8bf2a39651b997ca34 com.dec05eba.gpu_screen_recorder ? and post terminal output.

Ok, brb

Sturmlocke86 commented 3 months ago

Ok thanks, finally can you try recording variable framerate mode with this version: flatpak update --commit=09931552deea1e3d5087944b83a9a62fcd45e497b8d1ae8bf2a39651b997ca34 com.dec05eba.gpu_screen_recorder ? and post terminal output.

Ok, the variable logs for this version:

flatpak run com.dec05eba.gpu_screen_recorder Gtk-Message: 01:13:10.380: Failed to load module "canberra-gtk-module" Gtk-Message: 01:13:10.381: Failed to load module "canberra-gtk-module" /home/sturmlocke Warning: Invalid config option: main.color_range limited Warning: Invalid config option: main.show_notifications true Warning: Invalid config option: record.pause_recording_hotkey 65509 0 window name: Alien: Isolation, window id: 8388711 [hevc_nvenc @ 0x5d01240a3480] ignoring invalid SAR: 0/0 Info: using h265 encoder because a codec was not specified [hevc_nvenc @ 0x5d01240a3480] ignoring invalid SAR: 0/0 update fps: 120 update fps: 46 update fps: 47 update fps: 45 update fps: 44 update fps: 47 update fps: 44 update fps: 48 update fps: 44 update fps: 43 update fps: 44 update fps: 47 update fps: 44 update fps: 53 update fps: 55 update fps: 56 update fps: 47 update fps: 47 update fps: 45 update fps: 42 update fps: 43 update fps: 41 update fps: 48 update fps: 48 update fps: 46 update fps: 48

The constant logs for this version:

[hevc_nvenc @ 0x61ac64f2d480] ignoring invalid SAR: 0/0 Info: using h265 encoder because a codec was not specified [hevc_nvenc @ 0x61ac64f2d480] ignoring invalid SAR: 0/0 update fps: 51 update fps: 5 update fps: 3 update fps: 3 update fps: 2 update fps: 2 update fps: 2 update fps: 2 update fps: 1 update fps: 1 update fps: 1 update fps: 1 update fps: 1

Both variable and constant video modes are not smooth in this version and video playback when recording in constant mode is back to stuttering like crazy.

dec05eba commented 3 months ago

ok thanks God, im pretty certain i know what the issue is then. Your gpu doesn't support p5 preset or the driver version you have is bugged. I'll change it to p4 (the same as in that working version). I'll post a command you can run to test that version after some time here. Thanks for testing!

Sturmlocke86 commented 3 months ago

ok thanks God, im pretty certain i know what the issue is then. Your gpu doesn't support p5 preset or the driver version you have is bugged. I'll change it to p4 (the same as in that working version). I'll post a command you can run to test that version after some time here. Thanks for testing!

Awesome! Thank you for helping out so quickly. I was troubleshooting this the past entire week and pulling my hair out (I'm bald btw). Glad that we found the issue. Question, can setting Powermizer to prefer maximum performance in nvidia-settings lock the p-state that you mentioned? I have Powermizer set to prefer maximum performance and I let it do that automatically after every reboot by adding this script to the startup launch applications: nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1

IIRC I did test recording in "automated" Powermizer mode after I freshly installed Ubuntu 22.04, so setting Powermizer mode might not be relevant here.

Sturmlocke86 commented 3 months ago

Btw, do you want me to wait for the new version or is it going to take a bit longer? I can wait for another 30 minutes if you want, will have to go to bed after that (almost 2am over here right now).

dec05eba commented 3 months ago

ok thanks God, im pretty certain i know what the issue is then. Your gpu doesn't support p5 preset or the driver version you have is bugged. I'll change it to p4 (the same as in that working version). I'll post a command you can run to test that version after some time here. Thanks for testing!

Awesome! Thank you for helping out so quickly. I was troubleshooting this the past entire week and pulling my hair out (I'm bald btw). Glad that we found the issue. Question, can setting Powermizer to prefer maximum performance in nvidia-settings lock the p-state that you mentioned? I have Powermizer set to prefer maximum performance and I let it do that automatically after every reboot by adding this script to the startup launch applications: nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1

IIRC I did test recording in "automated" Powermizer mode after I freshly installed Ubuntu 22.04, so setting Powermizer mode might not be relevant here.

the p-state gets locked no matter what you do (except if you manually overclock your gpu) so no

dec05eba commented 3 months ago

Btw, do you want me to wait for the new version or is it going to take a bit longer? I can wait for another 30 minutes if you want, will have to go to bed after that (almost 2am over here right now).

the flatpak bot is building gpu screen recorder right now, it should hopefully only take a few minutes if the bot isn't being slow (it's also almost 2am here :))

Sturmlocke86 commented 3 months ago

Btw, do you want me to wait for the new version or is it going to take a bit longer? I can wait for another 30 minutes if you want, will have to go to bed after that (almost 2am over here right now).

the flatpak bot is building gpu screen recorder right now, it should hopefully only take a few minutes if the bot isn't being slow (it's also almost 2am here :))

Ok, sweet! Will wait then. If it works, will you be replacing the current stable version on Flathub with that new version then?

dec05eba commented 3 months ago

Btw, do you want me to wait for the new version or is it going to take a bit longer? I can wait for another 30 minutes if you want, will have to go to bed after that (almost 2am over here right now).

the flatpak bot is building gpu screen recorder right now, it should hopefully only take a few minutes if the bot isn't being slow (it's also almost 2am here :))

Ok, sweet! Will wait then. If it works, will you be replacing the current stable version on Flathub with that new version then?

yes :)

dec05eba commented 3 months ago

Asdf the bot is being slow, can you try building it yourself instead? run:

git clone https://github.com/dec05eba/com.dec05eba.gpu_screen_recorder.git
cd com.dec05eba.gpu_screen_recorder
flatpak uninstall com.dec05eba.gpu_screen_recorder
flatpak-builder build-dir com.dec05eba.gpu_screen_recorder.yml --force-clean
flatpak build-export export build-dir
flatpak build-bundle export gsr.flatpak com.dec05eba.gpu_screen_recorder
flatpak install --system gsr.flatpak

in the uninstall step choose to uninstall all versions of gpu screen recorder you have installed (if you have multiple installed (user & system)).

After that try recording with variable framerate mode and post terminal output.

Sturmlocke86 commented 3 months ago

Asdf the bot is being slow, can you try building it yourself instead? run:

git clone https://github.com/dec05eba/com.dec05eba.gpu_screen_recorder.git
cd com.dec05eba.gpu_screen_recorder
flatpak uninstall com.dec05eba.gpu_screen_recorder
flatpak-builder build-dir com.dec05eba.gpu_screen_recorder.yml --force-clean
flatpak build-export export build-dir
flatpak build-bundle export gsr.flatpak com.dec05eba.gpu_screen_recorder
flatpak install --system gsr.flatpak

in the uninstall step choose to uninstall all versions of gpu screen recorder you have installed (if you have multiple installed (user & system)).

After that try recording with variable framerate mode and post terminal output.

I can wait for the bot, no worries. My son just woke up, will bring him back to bed and brb after a few minutes. Let me know when the bot is done doing its thing and I'll give it a go.

dec05eba commented 3 months ago

Ok it finally built.. can you try:

flatpak uninstall com.dec05eba.gpu_screen_recorder
flatpak install --user https://dl.flathub.org/build-repo/100068/com.dec05eba.gpu_screen_recorder.flatpakref
Sturmlocke86 commented 3 months ago

Ok it finally built.. can you try:

flatpak uninstall com.dec05eba.gpu_screen_recorder
flatpak install --user https://dl.flathub.org/build-repo/100068/com.dec05eba.gpu_screen_recorder.flatpakref

Yes, will try, have my toddler in my arms right now. Brb

Sturmlocke86 commented 3 months ago

Ok, did a quick and dirty test and it works fine now. I was only able to test with Alien, but will try EQ2 and maybe even DCUO later when my toddler falls asleep. Brb in a couple of minutes

dec05eba commented 3 months ago

Thanks for testing. I'll push that change to flathub now then. You can go to sleep now lol. It should work fine in those other games but you can try that after you sleep first. Re-open this if it doesn't work in those games.

Sturmlocke86 commented 3 months ago

On mobile right now. Thanks a bunch for all the help! Your response time is incredible. Will test the final Flatpak in a couple of minutes. Btw, feel free to add me on Steam. You'll find my nick on my yt page 👍🏻🥂

dec05eba commented 3 months ago

It will take a few hours before flathub publishes it :p

Sturmlocke86 commented 3 months ago

It will take a few hours before flathub publishes it :p

Thanks, I like how fast you work! Alrighty, I downloaded the new Flatpak and tested it with a few games: Turok 1,2,3, Alien Isolation, Everquest 2, Crazy Taxi, Need For Speed Most Wanted, Tomb Raider Underworld and a couple of other titles. I recorded each game around ten times for a couple of minutes. So far everything is looking good and nearly all games are super smooth now. The only game that I have seen get slowdowns now (1fps video) is Everquest 2. In EQ2 it happens after recording for about 50-70 minutes in very specific locations. It doesn't happen everywhere, only in certain locations / zones within EQ2 and thus far only after a while. This might just be a driver/proton issue though, or maybe the game itself since it switched to DirectX11 recently, but I will try to reproduce or trigger it and check the terminal logs for info. Will report back later tonight.

dec05eba commented 3 months ago

The thing is, it's not really a bug and it's not really related to the game itself. Your gpu is on the border of being able to handle 4k60fps recording and the things that can slow it down is complexity of the scene and the motion. That increase the work your gpu video encoding unit has to do. So even recording videos can cause it to happen. If the video encoding drops below the target fps of 60 fps it has to repeat encode the frames for constant framerate video (which is why variable framerate video is recommended). Since it encodes multiple times per frame the video encoding performance goes down even more and more until its at 1 fps. The only thing I can do is to try change it so it doesn't get stuck at 1 fps at least. There is a reason why nvidia shadowplay, xbox gamebar, etc use variable framerate video.

But when update fps goes down to 1 fps you can check nvtop to see system vram usage. Maybe there is a leak in gpu screen recorder and you see this issue when vram is almost full?

Sturmlocke86 commented 3 months ago

Alrighty, I'm back. I have been testing a couple of games on and off with constant and variable framerate mode in gpu screen recorder. Yeah, what you said could actually be the case, sounds reasonable tbh. What bothers me about this though is that I have been recording a lot of 4k60 video content in the last couple of months, ever since switching to gpu screen rec, and I was not experiencing these single digit 1-fps frame drops at all, even when the game dipped below 60 fps in-game during some scenes. I went back and re-recorded some of the scenes that I had already done in EQ2 at 4k60 some time ago, for comparisons sake ofc, and now the exported video sometimes drop to 1-fps during the same scenes. It's the same spot, same scene, just with reproducible stuttery video now in constant video mode.

What's interesting here is that I can't seem to reproduce the same effect in other games. I have tried with around ten different games, some of which push the hardware even more than EQ2 (Alien Isolation, Cyberpunk, Terminator Resistance etc.), and the video export remains fluid even when the fps-rate dips below 60 in these games. For example, I tried Terminator: Resistance via Steam and Proton 8 and set everything to 4k60 reso + "epic" graphics preset in-game, and that gives me an fps-rate of approx 20-30fps without using its built-in AMD FSR feature (with FSR = rock solid 60fps btw). I recorded the game without FSR and the exported video was just fine. Sure, you can see that the game is not running at 60 fps, but it's identical to what I see on screen. So the game running at these settings = 20-30 fps and the video export doesn't drop to 1 fps. It pretty much looks the same as what I'm seeing live in-game. All of this in constant video mode.

This leads me to believe that it must be something else going on here. In EQ2 there are a few places where the fps-rate can drop below 60 fps when using 4k reso with all the bells and whistles enabled in-game, mostly when there is a ton of stuff happening on screen, and as soon as that happens the recorded video stutters at 1 fps again. All of this when using constant video mode in gpu screen recorder. I retested with variable framerate mode and was not able to reproduce the issue. So it would seem that it's strictly limited to constant video mode for this game.

I managed to catch it on video a couple of times if you want to take a look at it?

Since I was recording this just fine via constant video mode with the old version of screen rec from 2-3 months ago, I decided to retest with that version, but the same thing happens again in EQ2, and only in EQ2 thus far. So maybe it's something else? The only other thing that is different for this rig is:

Other than that, nothing else is different. So I might use a second hard drive with a fresh Ubuntu install and upgrade those Nvidia drivers and then I might retest without Snap and Flatpak Steam by using a natively installed version of vanilla Wine. Using variable framerate mode would be nice ofc, if I could. The only reason why I haven't been able to use it is because variable mode causes issues when importing video clips into the likes of Shotcut and Kdenlive etc. In their forums they recommend to use constant video mode for editing and exporting, or to alternatively convert a variable video to constant h264 for more stability etc. Problem with this is that if you don't convert from variable to constant, it can result in number of issues during and post video edit. Converting it to constant within Shotcut / Kdenlive has its own problems too though, because then you have to recheck the entire video for potential video and audio glitches that can happen after the conversion. On top of that, converting takes more time and reduces the video quality. All of this means editing the video takes a ton more time and gets far more complicated. Here are a few examples of this topic:

So that's why I prefer to just use constant video mode. Ideally I could completely avoid it. Hm, I just realised that you mentioned that you can change it so it doesn't get stuck at 1 fps. How does that work and what would it do instead then? Good point btw, I'll check how high vram usage gets when it drops down to 1 fps.

I shall return!

Sturmlocke86 commented 2 months ago

Ok, took a while, a ton of stuff going on irl right now, but I was able to test a bit more. I haven't been able to test on a native Steam install, so I'm still using Snap Steam + Ubuntu 24.04 and Nvidia 535 under X11 right now. I tested a bunch of additional games, even Cyberpunk at higher details + 4k reso, and even though games like Cyberpunk push gpu and video engine utilization to around 95-98%, the video created remains very smooth post recording. Same goes for all other games in my Steam list - with the exception of Everquest 2. Even Alien Isolation doesn't go over 70% video engine utilization at maximum graphic details and 4k reso.

So I continued testing EQ2 and realized that GPU shadows makes the game go from 30-50% gpu and video engine utilization when shadows are disabled all the way up to 95-100% for both gpu and video engine utilization when shadows are enabled. As soon as this happens the video recording turns into a 1-fps show during certain gameplay scenes when the in-game framerate dips below 30fps. Disabling gpu shadows makes the fps-rate immediately go up to 60fps again. So disabling gpu shadows seemingly fixes the stuttering video post recording. Video RAM is not a problem as far as I can tell, because nvidia-settings reports around 40% utilization and it doesn't change that much even after half an hour of gameplay and recording.

So now this has me wondering if it has anything to do with the new DirectX11 client that EQ2 switched to a few weeks ago, because recording with the old DirectX9 client wasn't causing any of this. I am not able to reproduce it in any other game thus far. The good news is that the update you pushed fixed the framerate for all other games in the list, recording remains to be super fluid now, so whatever is going on with EQ2 seems to be limited to that game.

dec05eba commented 2 months ago

Ok thanks for testing, that's weird..

Sturmlocke86 commented 2 months ago

Ok thanks for testing, that's weird..

Sure thing, trying to help narrow it down.

I tested with Steam Flatpak on Ubuntu half of the day and it's doing the very same thing that the Snap was doing (shadows on = 1fps, shadows off = 60fps video). Since downgrading the Proton version didn't help, I'll try to test outside of Steam and Proton and if that doesn't help then I'll try to test with more recent Nvidia drivers. If all else fails then it's most likely some issue with the game itself. I'll report back asap.

Sturmlocke86 commented 2 months ago

Alrighty, I'm back.

First of all: I tried installing the newest Nvidia drivers on Ubuntu 24.04 by adding this ppa since Ubuntu currently only offers up to V535 (tested): https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa?ref=itsfoss.com

Sadly, even after adding the ppa, Ubuntu only offered V545 for my gpu, and installing that went very wrong. I mentioned it in a previous post so this happening comes as no surprise. During the install of that driver I got an error message and after a reboot the system wouldn't boot into X11 anymore - only Wayland without 3D acceleration. So basically I was left with a borked Nvidia driver install and Gnome didn't have any animations whatsoever and 3D acceleration was gone. Trying to fix it took a while and resulted in a black screen with a white blinking cursor during boot, and that's where I gave up. Ubuntu buglist recommends sticking to the tested V535 until they fix outstanding issues with newer drivers.

So then I installed openSUSE 15.5 Leap on this machine, because that's what I was successfully using with gpu screen rec for the some time, previously without any issues as mentioned further above. Same settings as before: constant fps-rate, window recording, tried both h265/264. Typing from 15.5 Leap right now after installing the newest Nvidia V550.78 drivers and after giving EQ2 a try again. Verdict: It's doing 1fps video on Suse too now as long as the in-game shadows are enabled. I used Steam Flatpak for this test. So both openSUSE and Ubuntu are suffering from the same issue in EQ2.

This is how it was running a few months ago via the Steam Flatpak and with gpu screen rec at 4k60 reso and all in-game settings maxed out (including the shadows): https://www.youtube.com/watch?v=nXboAhXmZlE&t=4207s

Any ideas how we could further troubleshoot this? The game is free btw, would you be willing to give it a go on your end?

dec05eba commented 2 months ago

I'll give it a try when I have time. I will have to switch out my amd gpu with my older nvidia gpu first.