Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Agash/Spout2.NET

Repository files navigation

Spout2.NET

NuGet build License: MIT

.NET bindings for Spout2, the Windows framework for sharing video frames between applications in real time. Publish frames for other apps to pick up, or receive frames another app is sharing, zero-copy as DirectX 11 shared textures. Works with OBS, Resolume, TouchDesigner, and other tools that speak Spout.

Alpha. Early and working, but largely untested in the wild and rough in places. Try it and file issues; expect breaking changes before 1.0.

Requirements

  • Windows x64 with a DirectX 11 GPU.
  • .NET 10 (or .NET 11).
  • DirectX objects are passed as native pointers; Vortice.Windows is the easy way to create them (ID3D11Device.NativePointer, ID3D11Texture2D.NativePointer).

Install

dotnet add package Spout2.NET

The package bundles the native helper it needs; there is nothing else to install.

Publish

using Spout2.NET;
// device = your ID3D11Device.NativePointer (from Vortice)
using var sender = new SpoutSender("My Output", device);
// texture = an ID3D11Texture2D.NativePointer
sender.Send(texture);

In OBS, add a Spout2 Capture source and choose "My Output".

Receive

using Spout2.NET;
using var receiver = new SpoutReceiver(device);
if (receiver.Receive() && receiver.Texture != 0)
{
 if (receiver.IsUpdated)
 {
 int w = receiver.SenderWidth, h = receiver.SenderHeight; // size changed
 }
 // wrap receiver.Texture as a (non-owning) ID3D11Texture2D and read / copy / encode it
}

List senders with SpoutSenders.

Building from source

git clone --recursive https://github.com/Agash/Spout2.NET
cd Spout2.NET
pwsh native/build-native.ps1
dotnet build Spout2.NET.slnx
dotnet test

The native helper compiles the Spout2 SDK (a git submodule) and a small shim into one self-contained DLL; the managed library is plain net10.0 / net11.0.

License

MIT. See LICENSE. Bundled Spout2 code is BSD 2-Clause; see THIRD-PARTY-NOTICES.md.

About

NativeAOT-friendly .NET bindings for Spout2 on Windows: publish and receive video frames between apps zero-copy via shared DirectX 11 textures (the shared-texture mechanism OBS and creative tools use).

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /