https://github.com/keijiro/klakspout
Spout plugin for Unity
https://github.com/keijiro/klakspout
plugin spout unity unity3d
Last synced: 7 months ago
JSON representation
Spout plugin for Unity
- Host: GitHub
- URL: https://github.com/keijiro/klakspout
- Owner: keijiro
- License: unlicense
- Created: 2017-04-10T10:50:50.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-12-16T22:09:15.000Z (over 2 years ago)
- Last Synced: 2025-05-15T14:18:48.661Z (about 1 year ago)
- Topics: plugin, spout, unity, unity3d
- Language: C++
- Homepage:
- Size: 3.3 MB
- Stars: 711
- Watchers: 32
- Forks: 108
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KlakSpout


**KlakSpout** is a Unity plugin that lets Unity send and receive video streams
through the [Spout] system.
[Spout]: http://spout.zeal.co/
## System Requirements
- Unity 2022.3 or later
- Windows system with Direct3D 11/12 support
KlakSpout currently supports only Direct3D 11 and 12; other graphics APIs such
as OpenGL or Vulkan aren't available.
## Pixel Format Compatibility
KlakSpout currently supports receiving the following pixel formats:
- R8G8B8A8 UNorm (sRGB/linear)
- B8G8R8A8 UNorm (sRGB/linear)
- R16G16B16A16 Half Float
- R32G32B32A32 Float
Most applications use R8G8B8A8 or B8G8R8A8, so you can receive frames without
extra steps. When using [TouchDesigner], choose the appropriate pixel format in
the Spout Out TOP.
[TouchDesigner]: https://derivative.ca/
For now, KlakSpout only supports sending the R8G8B8A8 UNorm format.
## How to Install
Install the KlakSpout package (`jp.keijiro.klak.spout`) from the "Keijiro"
scoped registry in Package Manager. Follow [these instructions] to add the
registry to your project.
[these instructions]:
https://gist.github.com/keijiro/f8c7e8ff29bfe63d86b888901b82644c
## Spout Sender Component

Use the **Spout Sender** component to send a video stream. It provides three
capture methods:
- **Game View**: Captures the content of the Game View.
- **Camera**: Captures a specified camera.
- **Texture**: Captures a 2D texture or a Render Texture.
The Camera capture method is available only on URP and HDRP—you can't use it on
the built-in render pipeline.
The **KeepAlpha** property controls whether the alpha channel is preserved or
cleared. Enable [alpha output] when using HDRP. On URP, select the Texture
capture method to output alpha.
[alpha output]:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@12.0/manual/Alpha-Output.html
## Spout Receiver Component

Use the **Spout Receiver** component to receive a video stream. It stores
incoming frames in the Target Texture and overrides the material property set
in the Target Renderer.
You can also access the received texture via the
`SpoutReceiver.receivedTexture` property.
## Scripting Interface
Enumerate available Spout senders with the `SpoutManager` class; see the
[SourceSelector example] for details.
[SourceSelector example]:
https://github.com/keijiro/KlakSpout/blob/main/Assets/Scripts/SourceSelector.cs
You can create Spout senders or receivers at runtime, but you must assign the
`SpoutResources` asset (which holds references to package assets) after
instantiation.
## 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 consumes CPU, memory, and network bandwidth but is highly versatile.
Spout adds virtually no CPU load, though its applications are more limited.
If you need to share video between applications on a single Windows PC, Spout
is usually the better option.
## Related Repositories
- [Unity-OBS-AlphaWorkflowSample](https://github.com/keijiro/Unity-OBS-AlphaWorkflowSample)
- [KlakSpoutTestSuite](https://github.com/keijiro/KlakSpoutTestSuite)