Skip to content

Spout plugin for Unity (for Unity 2022 or later)

License

Notifications You must be signed in to change notification settings

UltraCombos/KlakSpout

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KlakSpout

KlakSpout is a Unity plugin that allows Unity to send/receive video streams using the Spout system.

Note

This fork is a temporary solution for a problem with Unity 2022 and later where Spout is not accepted. This fork will be removed as soon as the original repository is fixed.

Installation URL for UPM

https://github.com/witalosk/KlakSpout.git?path=Packages/jp.keijiro.klak.spout

System requirements

  • Unity 2020.3 or later
  • Windows system with DirectX 11/12 support

Currently, KlakSpout only supports Direct3D 11 and 12. You can't use other graphics APIs like OpenGL or Vulkan.

Spout Sender component

Sender

You can send a video stream using the Spout Sender component. There are three capture methods available:

  • Game View: Captures the content of the Game View.
  • Camera: Captures a specified camera.
  • Texture: Captures a 2D texture or a Render Texture.

Note that the Camera capture method is only available on URP and HDRP -- You can't use it on the built-in render pipeline.

The KeepAlpha property controls if it keeps or clears the content of the alpha channel. Note that you have to enable alpha output when using HDRP. Also note that you have to use the Texture capture method to enable alpha output on URP.

Spout Receiver component

Receiver

You can receive a video stream using the Spout Receiver component. It stores received frames to the Target Texture. It also overrides a material property specified in the Target Renderer.

You also can refer to the received texture via the SpoutReceiver.receivedTexture property.

Scripting interface

You can enumerate available Spout senders using the SpoutManager class. Please check the SourceSelector example for further usage.

You can dynamically create a Spout sender/receiver, but you must give the SpoutResources asset (which holds references to the package assets) after instantiation. Please see the benchmark examples for detailed steps.

Frequently asked questions

What's the difference between NDI and Spout?

  • NDI: Video-over-IP codec/protocol
  • Spout: Interprocess GPU memory sharing on DirectX

NDI requires CPU/memory/network load, but it's greatly versatile.

Spout doesn't produce any CPU load, but its range of application is limited.

If you're trying to share videos between applications running on a single Windows PC, Spout would be a better solution.

About

Spout plugin for Unity (for Unity 2022 or later)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 62.9%
  • C# 21.8%
  • C 13.3%
  • ShaderLab 1.5%
  • Makefile 0.5%