You are not logged in.

#1 2022-08-08 12:53:02

Froloket64
Member
Registered: 2021-11-12
Posts: 25

No screen capture in OBS under Wayland

So, I recently decided to finally switch to Wayland, but stumbled upon a problem. OBS doesn't seem to have any screen recording options when I run it under Wayland (I'm using Hyprland, haven't tried other compositors yet). Also I'm using pipewire (as god intended). I've already read a dozen articles and answers on that topic, including ones recommending to:
- set QT_QPA_PLATFORM to wayland or xcb
- set XDG_CURRENT_DESKTOP and WAYLAND_DISPLAY (with systemctl --user import-environment)
- install qt[56]-wayland
- install gst-plugin-pipewire
- install xdg-dektop-portal and ...-wlr, since Hyprland is wlroots-based
to name a few.

I've seen screenshots where an option like Screen (Pipewire) is present in Sources selection, but I can't see it after all of the above steps done.

pacman -Qs obs-studio

=> 27.2.4-2

pacman -Qs wayland

=> 1.21.0-1

pacman -Qs hyprland-bin

=> 0.8.1beta-1 (aur)

Last edited by Froloket64 (2022-08-08 12:54:31)

Offline

#2 2022-08-08 18:30:57

headkase
Member
Registered: 2011-12-06
Posts: 1,898

Re: No screen capture in OBS under Wayland

I'm on GNOME and I have the following shell script to launch OBS:

#!/bin/bash
export QT_QPA_PLATFORM=wayland
obs

You've said you tried

QT_QPA_PLATFORM=wayland

but how did you set it?  I set it in my script so it doesn't conflict with my global settings of

QT_QPA_PLATORM=xcb

Which is exported in /etc/profile.d/*.conf, if you aren't exporting the variable then that may be the issue.

And the reason I use xcb (which falls back to XWayland) is because many of my QT apps don't work correctly under Wayland for a reason I don't know.

Under GNOME, the above script fixes the same problem for me, launched that way I then have a PipeWire source which is the real screen.

Last edited by headkase (2022-08-08 18:35:23)

Offline

#3 2022-08-09 06:35:56

Froloket64
Member
Registered: 2021-11-12
Posts: 25

Re: No screen capture in OBS under Wayland

oh.

Actually, no. First I thought that not literally exporting, as You said, made a difference (from just passing it in cmdline like QT_QPA_PLATFORM=xcb obs as I was doing), but then turned out now it works even if with my prior method. I'm still not sure what exactly caused it to work now, because, as I said, I was doing the same thing before.
Nonetheless, now I see Screen Capture (XSHM) and my old screen capture setup started recognizing my XWAYLAND0 display. But here's the catch: It only captures the cursor (and black background). Also, if I set the var to wayland, pretty much nothing changes (at least as I see).

Sorry for my eng, btw)

Last edited by Froloket64 (2022-08-09 06:37:32)

Offline

#4 2022-08-09 19:29:26

headkase
Member
Registered: 2011-12-06
Posts: 1,898

Re: No screen capture in OBS under Wayland

We're on different desktop environments which means a different compositor - so what works for me may not work for you.  The line that works for me is "QT_QPA_PLATFORM=wayland" - if you use "xcb" then you're getting an XWayland buffer which shows nothing.  However you do eventually get it working then the platform must be "wayland".  Hopefully that will just be a part of the puzzle and there won't be much else to discover.

But, long story short, the platform has to be wayland or you'll get a XWayland screen which is empty.  And the reason it's empty is because XWayland just does an application screen and not the full desktop.  There is talk about extending XWayland so it does have access to a full desktop but that is in the future if ever.

Since it is now working you can type "export" by itself in a terminal and then you can see exactly what QT_QPA_Platform is set to.  When you know that and you're sure it all works then this thread can be "[Solved]" wink  What I've said in this reply is reference.

Edit: If I understood you, XWayland0 isn't what you want.  When OBS is working right you'll have a Pipewire input.  That is working.  If you don't have that then please continue.

Last edited by headkase (2022-08-09 19:39:33)

Offline

#5 2022-08-10 10:26:16

Froloket64
Member
Registered: 2021-11-12
Posts: 25

Re: No screen capture in OBS under Wayland

So, to recap, I can get XWAYLAND0 with QT_QPA_PLATFORM=xcb, but it only captures the cursor for some reason.
Setting QT_QPA_PLATFORM=wayland does nothing however and no Screen capture (Pipewire) shows up either way.

I'd ultimately want to be able to capture at least the current window.

Offline

#6 2022-11-10 09:40:57

trojan_leafar
Member
Registered: 2022-11-09
Posts: 1

Re: No screen capture in OBS under Wayland

Hey guys. I've been struggling with OBS Studio screen capture for some days but it got solved setting QT_QPA_PLATFORM=xcb on my etc/environment file. Then, when I open OBS up I've to choose Screen Capture (PipeWire) as resource. Another one, called Screen Capture (XSHM) also shows up but it doesn't work well because it captures only my mouse pointer not the full desktop screen.

Last edited by trojan_leafar (2022-11-10 09:43:10)

Offline

Board footer

Powered by FluxBB