Does anyone know how to get screen capture working in OBS on Wayland?

https://lemmings.world/post/25780907

Does anyone know how to get screen capture working in OBS on Wayland? - Lemmings.world

It works fine on X, but switching to Wayland grays out the option to select which window.

I struggle with getting this to work myself using sway. Note that you cannot capture a window, only a display.

Unfortunately, for me, on my laptop, this results in me being able to select eDP-1 when configuring the Screen Capture (Pipewire) plugin once, but then pipewire does not do anything after that and nothing is captured. This is not the "black screen" issue on the GitHub wiki for xdg-desktop-portal-wlr. If I try again, pipewire times out.

Theoretically this should work for anyone else.

  • Pipewire — 1.4.2
  • OBS has a separate capture plugin: Screen Capture (Pipewire) — 31.0.3
  • XDG Desktop Portal is running that also runs xdg-desktop-portal-* where * is kde, gtk, wlr, etc... — 1.20.0
    • I am using xdg-desktop-portal-wlr 0.7.1.
  • XDG Desktop Portal * has configuration for screencast.
  • My Sway output is configured to 8-bit depth.

I have the following in /usr/share/xdg-desktop-portal/sway.portals (i think kde.portals is setup fine)

[preferred]default=wlr;kdeorg.freedesktop.impl.portal.Screenshot=wlrorg.freedesktop.impl.portal.ScreenCast=wlrorg.freedesktop.impl.portal.Inhibit=none

To be able to select a display (not a window) in a wlroots wm, I have the following in ~/.config/xdg-desktop-portal-wlr/sway. I am not sure what is needed for KDE or GTK, but there is probably something similar or it just works out-of-the-box.

[screencast]# The output name to use.output_name=eDP-1# max_fps=30# chooser_type=nonechooser_type=dmenuchooser_cmd=fuzzel --prompt='Choose the output to share' --dmenu

I am also limiting output bit depth to 8 in sway due to limitations with screencast at greater bit depths.