Skip to main content

NDI streaming

Products: Video Capture SDK .Net

The SDK's integration of Network Device Interface (NDI) streaming technology revolutionizes video production and broadcasting. NDI, a leading standard in live production, enables high-quality, low-latency video streaming over standard Ethernet networks. It simplifies the process of sharing and managing multiple video streams among different devices and platforms. Utilizing NDI in the SDK allows for seamless transmission of live, high-definition video and audio from servers to clients, making it ideal for live broadcasting, video conferencing, and multi-camera setups. The flexibility and efficiency of NDI streaming reduce the need for complex hardware setups, offering a cost-effective solution for professional-grade live video production.

Additional requirements

To stream using the NDI protocol, you must install the NDI SDK or NDI Tools.

Cross-platform NDI output (X-engines: VideoCaptureCoreX, VideoEditCoreX, Media Blocks)

The NDIOutput class provides functionality for NDI (Network Device Interface) output in the VisioForge SDKs. NDI is a high-performance standard for video-over-IP, allowing for the transmission of broadcast-quality video and audio over standard network infrastructure. This class serves as a configuration wrapper for NDI output settings and processing.

Class Definition

public class NDIOutput : IVideoEditXBaseOutput, IVideoCaptureXBaseOutput, IOutputVideoProcessor, IOutputAudioProcessor

Implements

  • IVideoEditXBaseOutput - Interface for video editing output functionality
  • IVideoCaptureXBaseOutput - Interface for video capture output functionality
  • IOutputVideoProcessor - Interface for video processing output
  • IOutputAudioProcessor - Interface for audio processing output

Properties

CustomVideoProcessor

public MediaBlock CustomVideoProcessor { get; set; }

Allows setting a custom video processing block for additional video manipulation before output. This property enables developers to inject custom video processing logic into the NDI output pipeline.

CustomAudioProcessor

public MediaBlock CustomAudioProcessor { get; set; }

Allows setting a custom audio processing block for additional audio manipulation before output. This property enables developers to inject custom audio processing logic into the NDI output pipeline.

Sink

public NDISinkSettings Sink { get; set; }

Contains the configuration settings for the NDI output sink. This includes essential parameters like the stream name and processing options.

Constructors

NDIOutput(string name)

public NDIOutput(string name)

Creates a new NDI output instance with the specified stream name.

Parameters:

  • name: The name that will identify this NDI stream on the network.

NDIOutput(NDISinkSettings settings)

public NDIOutput(NDISinkSettings settings)

Creates a new NDI output instance with pre-configured sink settings.

Parameters:

  • settings: A pre-configured NDISinkSettings object containing all necessary NDI configuration.

Methods

GetFilename()

public string GetFilename()

Returns the name of the NDI stream. This method is primarily used for compatibility with the file-based output interfaces.

Returns: The configured NDI stream name.

SetFilename(string filename)

public void SetFilename(string filename)

Sets the name of the NDI stream. This method is primarily used for compatibility with the file-based output interfaces.

Parameters:

  • filename: The new name for the NDI stream.

GetVideoEncoders()

public Tuple<string, Type>[] GetVideoEncoders()

Returns an empty array of video encoders as NDI handles encoding internally.

Returns: An empty array of tuples containing encoder names and types.

GetAudioEncoders()

public Tuple<string, Type>[] GetAudioEncoders()

Returns an empty array of audio encoders as NDI handles encoding internally.

Returns: An empty array of tuples containing encoder names and types.

Usage Example

Media Blocks SDK sample:

// Create an NDI output with a specific stream name
var ndiSink = new NDISinkBlock("NDI Streamer");

// Connect the video source to the NDI output. We use the CreateNewInput method to create a new video input for the NDI output.
pipeline.Connect(videoSource.Output, ndiSink.CreateNewInput(MediaBlockPadMediaType.Video));

// Connect the audio source to the NDI output. We use the CreateNewInput method to create a new audio input for the NDI output.
pipeline.Connect(audioSource.Output, ndiSink.CreateNewInput(MediaBlockPadMediaType.Audio));

Video Capture SDK sample:

// Create an NDI output with a specific stream name
var ndiOutput = new NDIOutput("MyStream");

// Set the output
core.Outputs_Add(ndiOutput); // core is the VideoCaptureCoreX instance
  • NDISinkSettings: Contains the detailed configuration for the NDI output sink
  • NDISinkBlock: The actual implementation of the NDI output functionality (referenced in NDISinkSettings)

Windows-only NDI output (VideoCaptureCore and VideoEditCore engines)

Sample code

Set the Network_Streaming_Enabled property to true to enable network streaming.

VideoCapture1.Network_Streaming_Enabled = true;

Enable audio streaming.

VideoCapture1.Network_Streaming_Audio_Enabled = true;

Set NDI as the streaming format.

VideoCapture1.Network_Streaming_Format = NetworkStreamingFormat.NDI;

Create NDI output and set the name.

var name = "VisioForge NDI Streamer";
var ndiOutput = new NDIOutput(name);

Set the output.

VideoCapture1.Network_Streaming_Output = ndiOutput;

Get the NDI protocol URL.

Debug.WriteLine($"ndi://{System.Net.Dns.GetHostName()}/{name}");

Visit our GitHub page to get more code samples.