sway icon indicating copy to clipboard operation
sway copied to clipboard

Screen drops frames when capturing games

Open VC73 opened this issue 3 years ago • 7 comments

  • Sway Version: 1.8-dev-eaeb173a (Dec 24 2021, branch 'master')

  • Debug Log: https://gist.github.com/VC73/ebc69a2ea01f5fe7d87bd453302ef40c

  • Config: default config with exec systemctl --user import-environment To make xdg-desktop-portal-wlr work

  • Description: Opened some game (in this case War thunder using vulkan), the game plays fine but when I start to capture the screen starts dropping frames while capturing the game.

VC73 avatar Dec 25 '21 00:12 VC73

That doesn't surprise me too much. shm-based capture takes a lot of bandwidth, and is a blocking operation due to the graphics APIs.

emersion avatar Dec 26 '21 14:12 emersion

I see, sadly I guess that not much can be done atm then.

VC73 avatar Dec 28 '21 06:12 VC73

You can try to replace your capture setup with txproto which does support zero-copy dmabuf capture or screencopy with dmabuf.

Setup is not trivial, you need to write lua scripts. There are some examples, though: https://github.com/cyanreg/txproto/tree/master/DOCS/examples

Edit: OBS with the wlrobs plugin should support it as well I think.

progandy avatar Dec 28 '21 12:12 progandy

Just tried the obs pluging using dmabuf and the result is the same even tough the recording itself is smooth

VC73 avatar Jan 02 '22 03:01 VC73

I can confirm this is still happening, recording Steam games with OBS.

edwloef avatar Dec 14 '24 19:12 edwloef

Discord (canary) uses xdg-desktop-portal-wlr for screen capture on Wayland. And I'm getting frames issues only when I start the screen capture. It seems like I'm getting extra frames or something. It stutters. Here:

https://github.com/user-attachments/assets/38af0cb0-b00e-49a0-bdc8-805e5350e7c3

It's even less noticeable when looking at this film because of the framerate of the video.

While without streaming or recording, everything is smooth:

https://github.com/user-attachments/assets/04b218a1-22e5-4dd4-a098-04f88c8174f3

I do have something similar when I capture with OBS, but then I get black frames (dropped frames I guess):

https://github.com/user-attachments/assets/2efabd16-131e-4343-bce2-35786f13441b

My OBS settings are:

image

My monitor is set with:

output 'LG Electronics LG ULTRAGEAR 403NTEP2C244' resolution [email protected] adaptive_sync on position 0,0

I also tried with 120.017Hz, 99.946Hz and 59.951Hz. Always getting issues. I have adaptative sync ON.

IMG_20241221_170913

sim590 avatar Dec 21 '24 22:12 sim590

Happening for me as well on RX 7900 XTX, exact same type of stutters as the video the person above me posted

ikcii avatar Jun 14 '25 00:06 ikcii