Thanks to visit codestin.com
Credit goes to github.com

Skip to content

keijiro/KlakSpout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KlakSpout

gif gif

KlakSpout is a Unity plugin that lets Unity send and receive video streams through the Spout system.

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.

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.

Spout Sender Component

Sender

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.

Spout Receiver Component

Receiver

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.

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