11 ms·
If you're running a modern Linux desktop you're probably running Wayland, and screencasts on that have long since been a complete pain in the neck with per-comp
by lvh 7y ago
If you're running a modern Linux desktop you're probably running Wayland, and screencasts on that have long since been a complete pain in the neck with per-compositor "solutions" that mostly don't work quite right. Fortunately someone who works on Gnome wrote the obs-xdg-portal plugin that should fix this, at least for Gnome and hopefully soon for wlroots and KDE once they fully support the underlying portal API. Until then, the easiest way to get screencasting working is just to run in X11.
(Ask me about ffmpeg raw GPU buffer capture one day; running a bunch of codec code as root is always exciting.)
OBS Plugin: https://gitlab.gnome.org/feaneron/obs-xdg-portal/ https://gitlab.gnome.org/feaneron/obs-xdg-portal/
For GTK: https://github.com/flatpak/xdg-desktop-portal-gtk https://github.com/flatpak/xdg-desktop-portal-gtk
For KDE: https://github.com/KDE/xdg-desktop-portal-kde https://github.com/KDE/xdg-desktop-portal-kde
For wlr: https://github.com/emersion/xdg-desktop-portal-wlr https://github.com/emersion/xdg-desktop-portal-wlr
- cycloptic 7y agoThose will cover the capture plugins, but OBS still needs XWayland to run due to a dependency on GLX for rendering. For those interested, there is an open PR here to add native EGL/Wayland support: https://github.com/obsproject/obs-studio/pull/2484 https://github.com/obsproject/obs-studio/pull/2484 For wlroots compositors there is also the wlrobs plugin, which can be used if you don't need pipewire: https://hg.sr.ht/~scoopta/wlrobs https://hg.sr.ht/~scoopta/wlrobs
- Jnr 7y agoThere is an even cooler pull request that adds zero-copy screen capture. https://github.com/obsproject/obs-studio/pull/1758 https://github.com/obsproject/obs-studio/pull/1758 I think this is a better way to go to get the same performance and low latency gaming capture as on Windows with gaming GPUs. The guy who made that PR frequently streams coding sessions on Youtube. I think he made it because he wanted a better way to stream some cool live opengl coding sessions. And even though that code isn't production ready, he has used it for some time now and it seems to work great. If there is some company that slightly cares about Linux desktop and gaming on Linux, I would suggest helping with that pull request and getting it merged. (Anyone from Steam, AMD or Nvidia here?)
- cycloptic 7y agoSome of the EGL portions of that PR are actually included in the one I linked :) At some point my plan is to go through and merge these all together if no one else does it, but streaming has not been a priority for me at the moment.
- lvh 7y agoWhoa, that's awesome! I tried to get the same thing working with ffmpeg, a la: ffmpeg -device /dev/dri/card1 -f kmsgrab -i - -vf 'crop=4096:2160:0:0,hwmap=derive_device=vaapi,scale_vaapi=w=4096:h=2160:format=nv12' -c:v h264_vaapi -qp 24 output.mp4 ... and that process was, um, exciting, but not in a good way if you care about having an MP4 at the end with minimal fuss.
- lvh 7y agoRight, I figured capturing is the big ticket item, and that most people wouldn't care what OBS itself runs on. Is there a reason to care about it running on XWayland other than being able to say you don't need X at all anymore? Would you expect to see major improvements for apps that are already doing all their heavy lifting in GLX on X11?
- cycloptic 7y ago>Is there a reason to care about it running on XWayland other than being able to say you don't need X at all anymore? I personally don't on my setup but the reason to do it is so other plugins can make use of EGL extensions. Native Wayland support just comes along with that trivially. Future development on platform-integration extensions is expected to happen in EGL instead of in GLX. For a current example the other PR that does direct KMS capture needs EGL to work, even with the X11 backend.
- axlee 7y agoDoes Wayland do anything better than Xorg? Every time I see it mentioned, it is about how it does not support this or that core feature of Xorg (e.g multiple displays with custom pixel densities/scaling, screen sharing apps being broken, etc...). What is Wayland's reason for existing?
- RMPR 7y agoNot an expert but it's something along the lines of security, things like keyloggers must not work, or at least have a hard time working for example.
- AsyncAwait 7y agoIt does do a ton of things better. It's just that X11 was basically a giant shared buffer, so things like screenshots etc. were easy. Wayland is a lot more security conscious, but once the compositors are up to parity, these things won't be a problem. At least for me, Wayland is way smoother than X11 ever was as well.
- simias 7y agoSame reason systemd exists, the previous solutions were old and clunky and some people got fed up and decided to update. Plus some good old NIH. People who were dealing just fine with previous solutions then start complaining about breaking things for the sake of breaking things and not being able to do things the way they were used to. In the specific case of Xorg I find the situation strange because I'd gladly have made the switch 15 years ago back when messing with Xorg.conf was a common occurrence for me and it kept getting in the way (although a big portion of the blame was with the proprietary drivers, especially AMD's). Xorg was sometimes a bit of a pig too resource-wise, but that's when I was running a PC with 256MB of RAM. I remember being fairly optimistic when I first heard about Wayland and Mir, the prospect of ditching X11 was enticing. But now? I haven't really had to wrestle with X in a long time. It just works for me. I'm definitely not looking forward to reworking my entire workflow for minor benefits although I suppose I'll have to one day. I also use X forwarding pretty extensively, but I'm probably a small minority these days.
- 7y ago
- ezoe 7y agoWayland won't be a thing until they agree on the common API for the real time capturing of the screen. I've read some Wayland developers said screen capturing is not a priority and I can't understand it. The screen capturing demand is higher than ever now we have ubiquitous live streaming sites everywhere and people earn the money from it. Besides, the easiest way to explain how to use GNU/Linux desktop for the complete beginners is by the videos.
- cycloptic 7y agoThe common API is the desktop portal and pipewire. The major projects (GNOME/KDE/wlroots) all agree on this one. Take a look at the links in the GP comment more info.
- 2ion 7y agoTHe common API is whatever gains traction. Wayland has even less direction than Xorg development (especially in its early days), because it's a spec with lots of holes that others have to implement and fill in, respectively. Even Keith Packard doesn't think Wayland is on a good track anymore.
- rvz 7y agoThe Linux ecosystem needs a standard and unified API or SDK for its desktop endeavour like macOS and Windows does. This is why this whole thread on having the user to find out if an app like OBS is running on KDE, GNOME with X11 or Wayland on Linux is something which risks itself in losing traction with general users. I always recommend people to don't bother trying out the other distros and use Ubuntu instead. The Linux community is eternally stuck with its micro-ecosystem of alternatives of alternatives of the desktop stack which is best described by Howl's moving Castle of components. Also for future Linux app developers, never tell the user to 'compile' something as a way of distributing your app.
- cycloptic 7y ago>The Linux ecosystem needs a standard and unified API or SDK for its desktop endeavour In my opinion, this is incredibly unlikely to happen any time soon. The closest existing thing to that is building web apps targeting Chrome and Chrome OS. If that's not your thing, then I would advise against operating on the assumption that there will ever be a unified SDK. At least for me it's gotten easier to understand and work with the open source world after internalizing that. There are both upsides and downsides to it. Ubuntu is a funny example because they were ready to drop both X and Wayland for a while. They came very close to shipping their own incompatible display server called Mir.
- jjdredd 7y ago> If you're running a modern Linux desktop you're probably running Wayland I missed the point when Wayland took over all the major modern distros. Did supersede Xorg now? I've been using X11 forever and never thought of alternatives.
- sandov 7y agoI think Fedora is the only major distro running Wayland by default. Debian and Ubuntu are still on X11. I think Cannonical shipped 17.10 (or other minor release) with Wayland by default, but subsequent releases reverted to X11.
- raegis 7y agoDebian Buster (which is "stable" now) defaults to Wayland in Gnome, but you can switch to Xorg at the login window, which I had to do this week for screencasting to work as expected.
- hatsunearu 7y agowayland is mega broken on HiDPI. Or at least apps are broken on wayland on HiDPI. Very sad
- Karliss 7y agoI am currently running Gnome in wayland and multiple displays with different fractional scaling settings, it works fine. On the other hand in Xorg I can't set different scaling factor for each monitor (at least gnome doesn't allow it), neither can I use fractional scaling.
- chupasaurus 7y agoThat's GDM's fault, although XRandr doesn't make it any easier to implement.
- hatsunearu 7y agoDoes fractional scaling work with Electron programs like VS Code, Discord, Slack, etc? On Wayland? It is a blurry mess for me...
- shmerl 7y ago> with per-compositor "solutions" Didn't every one agree to use Pipewire for that? Or it's still bikeshedded to death? Somehow for input, everyone settled on libinput and this didn't become a problem.
- lvh 7y agoThat's mostly the case now, but that's a much more recent development than Wayland on the desktop becoming popular. Also, pipedrive gives you the plumbing, but you still need the portal API. My understanding is everyone more or less agrees that's the way forward, but it's still not stable and ubiquitously implemented. Even then, that resolves capture but not control: if you want something closer to ssh -X you need ways to forward input too, and IIRC right now the main answer for that is still compositor specific, e.g. krfb relying on kwin/KDE.
- shmerl 7y agoMay be libinput should also implement remote features?
- Vogtinator 7y agoI've been using screen sharing on Plasma/Wayland for a while now and it works absolutely fine. With krfb remote desktop control is also fully available. The latter uses a KWin specific protocol though IIRC as virtual input isn't part of the portal API.
- pmontra 7y ago> If you're running a modern Linux desktop you're probably running Wayland I'm a single data point but I'm running Ubuntu 19.10 and I'm not running Wayland. I don't remember if I opted out during the installation or if I wasn't given the choice. The top reason to stay on X11 is that no screen sharing application work with Wayland (Meet, Slack, Skype) and I need them a few times per week to work with my customers. This was more or less your point but from a different perspective.
- gibspaulding 7y ago> If you're running a modern Linux desktop you're probably running Wayland I believe the big exception to this is Nvidia. It looks like things might be changing, but until quite recently, the Nvidia proprietary driver was X11 only, so anyone running Nvidia graphics would automatically fall back to X11.
- _emacsomancer_ 7y agoThere's still plenty of things which don't work with Wayland. And even Gnome Shell, which perhaps has the best support for Wayland, doesn't work very well with Wayland on some of my machines (Gnome Shell is extremely slow and jerky at least on my one machine if I try to run it with Wayland).