robmikh / displayrecorder

A utility to record displays.
MIT License
15 stars 7 forks source link

Low framerate #6

Closed nergnezor closed 2 years ago

nergnezor commented 2 years ago

I'm stuck at around 15 fps (capturing 4k@60 Hz) even though I'm using Nvidia hw encoding. My CPU is pretty much idling. I assume it's the encoder keeping the frames for too long and missing new frames. Are you getting decent framerates?

robmikh commented 2 years ago

I haven't had any framerate issues. Could you share some details about your system? Are you running a multi-GPU system like a laptop?

robmikh commented 2 years ago

Oh, also are you sure your screen is actually updating at 60Hz? Windows.Graphics.Capture may not push new frames if the compositor decided not to draw (e.g. no changes on screen).

nergnezor commented 2 years ago

Yes. When I remove the encoding I can see that I get frames at 60hz. Yes, it's a multi-GPU laptop. Both the CPU and Intel GPU are almost idling while the Nvidia GPU is encoding at 50%. It's a 2015 laptop though, so maybe it's just outdated. I just got really good performance doing the same but using c++/winrt previously with help from MS (ScreenCaptureforHWND) & Nvidia examples.

robmikh commented 2 years ago

The issue is likely that the monitor you're recording is on a different GPU than the one you're using to capture or encode. That will incur a performance penalty. Unfortunately, displayrecorder isn't really tuned to handle this scenario and I've mainly tested it with single GPU systems.

You can try forcing a different GPU by using the Graphics settings page in the Settings app to see if that makes a difference. I got there by searching "GPU" in the search box inside the Settings app, and it took me to the "Graphics settings" page. From there you can click "Browse", select displayrecorder, and then pick a different GPU. image image

Let me know what you find.

nergnezor commented 2 years ago

Sorry for the late reply. I had actually tried this before as setting it to high performance was needed to use NVIDIA H.264 Encoder MFT at all and not panic during encoder setup.

Btw, I've switched from video encoding to image encoding on my project and I've used your screenshot-rs as a template (instead of displayrecorder) and it works great