Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal. You can also buy games using our partner links for GOG and Humble Store.
We do often include affiliate links to earn us some pennies. See more here.

One of the issues cropping up in the migration from Xorg to Wayland is the desire to capture part or all of your screen for recording and/or streaming to others - in many cases, applications designed for Xorg simply capture a black screen, with few workarounds.

However, for games and applications that can run with the Vulkan API, there's a new plugin from David Rosca (nowrep) for OBS Studio called obs-vkcapture (OBS Plugin Forum | GitHub) that aims to work around the issue and get your gameplay ingested directly, bypassing the built-in Xorg 'Window Capture'.

Bonus - it should even work under Xorg, provided you have a new build of OBS with EGL support and pass it the environment variable:OBS_USE_EGL=1

Similarly, you'll need to run your game (or other Vulkan application), one at a time (e.g. in your Steam launch options), with:OBS_VKCAPTURE=1

Now, this is a very new development (nowrep's initial commits here are barely 4 days old as of writing), but in my initial testing last night, I managed to play a 4 hour session of 7 Days to Die (using the experimental Vulkan backend), while streaming and recording it just fine.  That said, I did compile and install it by hand myself, on a git master build of OBS, and it is of course still under active development, so the usual caveat holds here: Your Mileage May Vary.

Still, they're looking at potentially adding OpenGL support in the future, so this is definitely one to watch.

Article taken from GamingOnLinux.com.
25 Likes
About the author -
author picture
I'm a multi-platform gamer who's tinkered with Linux and FreeBSD for over 20 years, excited about the recent uptake of native (or nearly-native) gaming on open platforms, and what that means for the future of gaming and the democratization of technology as a whole.
See more from me
The comments on this article are closed.
13 comments
Page: 1/2»
  Go to:

Brisse Mar 26, 2021
Cool! Ultimately we need PipeWire-support though. Personally I have always been able to capture xwayland surfaces but for some reason the frame-rate in the captured footage is terrible. When I switch to GNOME on x.org I can capture smooth 60fps footage.
BielFPs Mar 26, 2021
Quoting: BrissePersonally I have always been able to capture xwayland surfaces but for some reason the frame-rate in the captured footage is terrible.
It's because games today mostly run through xwayland, so it's compatible with Xcomposite.

I agree with pipewire support (already works for audio) and I think they should also make it compatible to xdg-desktop-portal in the official application.
Samsai Mar 26, 2021
I've been running the xdg-desktop-portal plugin for OBS for this purpose and on GNOME it's been working quite well. The biggest gripe I have with it is that if you want to do screen capture and switch an application to fullscreen, compositor unredirection will kick in and the screen capture stops updating. Window capture works though, and you can disable unredirection with an extension.

More options is better though and at least on compositors like Sway you cannot use the xdg-desktop-portal window capture yet, so if nothing else, this can help in that use case.
Kithop Mar 26, 2021
It's funny - I *just* switched over to trying to daily drive Wayland this week, and I found this capture plugin pretty much the next day. I heard of PipeWire and xdg-desktop-portal after and am going to look into those as well, personally, but I liked that this almost gives us parity with the 'Game Capture' plugin for OBS on Windows.
BielFPs Mar 26, 2021
Quoting: SamsaiMore options is better though and at least on compositors like Sway you cannot use the xdg-desktop-portal window capture yet

I thought xdg-desktop-portal was already compatible with wlroots, is sway using another compositor?
Samsai Mar 26, 2021
Quoting: BielFPs
Quoting: SamsaiMore options is better though and at least on compositors like Sway you cannot use the xdg-desktop-portal window capture yet

I thought xdg-desktop-portal was already compatible with wlroots, is sway using another compositor?
Oh, Sway supports the xdg-desktop-portal just fine with xdg-desktop-portal-wlr. But they don't have a window picker, so if you want to do window capture you need to find the window ID and it's a bit of a pain and thus I wouldn't consider it usable. Fullscreen capture works just fine though.
Shmerl Mar 26, 2021
Isn't Pipewire made for this? What's the status of that in OBS?


Last edited by Shmerl on 26 March 2021 at 3:23 pm UTC
Brisse Mar 26, 2021
Quoting: ShmerlIsn't Pipewire made for this? What's the status of that in OBS?

You can follow OBS Pipewire progress here
https://github.com/obsproject/obs-studio/pull/4287
Shmerl Mar 26, 2021
Quoting: BrisseYou can follow OBS Pipewire progress here

I didn't get that part:

QuoteThe new capture is only loaded when running on EGL, since it depends on EGL to call gs_texture_create_from_dmabuf().

Isn't EGL OpenGL specific? I thought Vulkan is using WSI for example.
Kithop Mar 26, 2021
Quoting: ShmerlIsn't EGL OpenGL specific? I thought Vulkan is using WSI for example.
According to Wikipedia:
  • The Wayland display server protocol uses EGL.[8] It is implemented in a way that Wayland clients will draw directly to the framebuffer using EGL.

So I think that's why EGL comes into play, here.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.