Request: Support for Spout2 OBS Plugin on Linux (or explanation why it's not feasible)
Hi there,
I'd like to request support for the Spout2 OBS plugin on Linux. Currently, it seems to be available only for Windows, and I'd love to see similar functionality for Linux users—especially since more streamers and creators are adopting Linux setups.
If native support isn't possible, could you please elaborate on the technical or licensing challenges preventing Spout2 from working on Linux?
Some additional context:
Linux users often rely on tools like OBS and would greatly benefit from inter-app video sharing similar to what Spout offers on Windows.
Alternatives like NDI exist, but Spout's low-latency GPU sharing is a compelling use case.
Thanks for your time and for maintaining this plugin!
Best regards, SillyNickDev
Hi!
Thanks for the comment. I'm afraid that spout itself is Windows only (specifically DirectX) so the OBS plugin can also only be Windows only. I would consider leaving a similar comment on the spout repo. I can't speak from a point of a lot of knowledge on this as I've only lightly researched this in the past, but my understanding is that it's very difficult to replicate spout on Linux. I'm pretty sure it's impossible with OpenGL on Linux because there is no texture sharing API. I've heard suggestions that it might be possible to get it to work with Vulcan but that there are more cross process protections on Linux that make the texture sharing API that Spout uses more complicated.
Linux has far more advanced, flexible and performant texture sharing than Spout2 already, using DMA-BUF and PipeWire. There is no need for Spout2 on Linux. OpenGL on Linux has had texture sharing for a very long time, it's how OpenGL and all graphics APIs work at all on Wayland systems. The entire modern Linux desktop ecosystem is built around texture sharing.
OBS's native Linux screen/window capture (at least on Wayland) already uses PipeWire, so when you capture a window with OBS on Linux, you are already using a better solution than Spout2.
For apps directly piping video to each other instead of just window capture (for example, so the video output can be clean while the window has UI elements), OBS contributors are already working with the XDG folks to come up with a desktop portal specification to standardize app-to-app video sharing.
I'm personally working on a Wine/Proton Spout2-to-PipeWire bridge, which will allow Windows apps using Spout2 running under Wine/Proton to send video to Linux apps including OBS running natively.
@asahilina That's really great to hear. As it sounds like you're coming from a point of a lot of knowledge about this, it's worth saying that Spout came not out of the need for window capture, but from the live AV world where people want to share multiple graphics textures between AV programs like VVVV etc so that they can be consumed and composited. If you were interested there would definitely be a market in creating a simple SDK for sharing named GPU textures between linux applications in a way that is as simple as Spout that can be done without low-level graphics knowledge
Importing/exporting textures isn't really hard (it's a few lines of code with EGL), but yes, hooking it up to PipeWire is a bit of a chore, especially getting all of the modifier/format negotiation logic correct.
I think once the video sharing portal stuff is done, it would make sense to make a small library that implements the boilerplate to create a video source or sink using the portal and PipeWire, and then gives you the info you need to interop with graphics APIs (probably with GL/Vulkan support built in so it's easier for the obvious cases). Since I need to write at least the sender side of this for the Spout2 to PW bridge, I might look into extracting that code into a library at some point ^^.
(BTW, the Spout2 to PW bridge will also use shared textures avoiding CPU copies. Proton/DXVK on Linux uses the Linux texture sharing mechanisms under the hood to implement Windows/DX texture sharing, so the bridge can just peek into the internals of that and extract the Linux shared texture, and directly use it.)
Why not export the textures via V4L2? That seems to be a more mature (and universal) means of getting random textures on Linux. (After all, some people don't want to deal with Wayland or Pipewire) Even seems to support an alpha channel.
v4l2 with dma-buf is not well supported at all for camera, there's no desktop ecosystem for that. v4l2loopback is also not upstream. And nothing supports v4l2 with alpha (in practice), which is half the reason to use Spout2.
Sure, in theory v4l2 could be used for this, but there's no reason to go through the kernel to emulate a virtual camera device other than for backwards compatibility with software that already talks to cameras, and that software in practice doesn't support the use cases PipeWire does properly, so there's no point.
PipeWire also has nothing to do with Wayland. You can use it with X11.
If you really want to use v4l2 you can use v4l2loopback today, with all its limitations, but it doesn't solve the problems PipeWire solves and is an even less flexible and performant solution than Spout2. Plus, there's this if you really want to use apps with v4l2 capture together with PipeWire video sources.
Think about it this way: There's a reason the pro audio world has used JACK for userspace audio routing between applications for many years, and not ALSA loopback device tricks in the kernel. PipeWire is the same thing, but for video (and audio), and is the "official" successor to JACK.
Have there been any new ideas of how this could be approached? There should be some way to make spout2 usable, no?
@AlphaCraft9658 I'm working on a similar library based on PipeWire DMA-BUF that can be used for native Linux apps, as well as for the Wine Spout2 bridge, and I'll also publish an OBS plugin for the receiving end. It doesn't make sense to support Spout2 itself for native Linux apps since it is a Windows-only technology.
@AlphaCraft9658 I'm working on a similar library based on PipeWire DMA-BUF that can be used for native Linux apps, as well as for the Wine Spout2 bridge, and I'll also publish an OBS plugin for the receiving end. It doesn't make sense to support Spout2 itself for native Linux apps since it is a Windows-only technology.
Oh, so it should be possible to use it for capturing the VRChat Spout2 stream for example?
VRChat under Proton, yes.
Spout2 already works under Proton. You could, in principle, just run VRChat and OBS under the same Proton instance and use Spout2 already. Spout2 only "exists" in the Windows/Proton world, it can't "exist" on native Linux. That's why you need a bridge to a different technology, which is what I'm working on.
VRChat under Proton, yes.
Spout2 already works under Proton. You could, in principle, just run VRChat and OBS under the same Proton instance and use Spout2 already. Spout2 only "exists" in the Windows/Proton world, it can't "exist" on native Linux. That's why you need a bridge to a different technology, which is what I'm working on.
That's actually incredibly cool! :o I wish you good luck on the project and I hope you have some fun too! Do you already have a repo for the wip project?