Skip to content

Using from TVideoGrabber

When the Datastead NDI Filters are deployed (see Installation), the TVideoGrabber SDK uses them automatically: NDI becomes one more streaming destination for sending, and one more URL scheme for receiving.

No DirectShow code, no filter interface

In this mode the COM interfaces of the filters described in the Interface reference are not used: everything is set through ordinary TVideoGrabber properties. TVideoGrabber builds the graph, inserts the right filter and passes the settings itself.

Sending a stream to the network

Set the stream name in NDIName, enable the NDI streaming with NetworkStreaming = ns_NDI, then start the preview or the recording:

VideoGrabber.VideoSource = ...
VideoGrabber.NDIName = "MYSTREAM";
VideoGrabber.NetworkStreaming = ns_NDI;
VideoGrabber.NetworkStreamingType = nst_VideoStreaming;   // or nst_AudioVideoStreaming if audio is needed
VideoGrabber.StartPreview();

For example, with a Logitech C930e webcam as video source and its microphone as audio source:

VideoGrabber.VideoSource = vs_VideoCaptureDevice;
VideoGrabber.VideoDevice = VideoGrabber.VideoDeviceIndex ("Logitech Webcam C930e");
VideoGrabber.AudioDevice = VideoGrabber.AudioDeviceIndex ("Microphone (Logitech Webcam C930e)");
VideoGrabber.NDIName = "MYSTREAM";
VideoGrabber.NetworkStreaming = ns_NDI;
VideoGrabber.NetworkStreamingType = nst_AudioVideoStreaming;
VideoGrabber.StartPreview();

The stream is then visible on the network under the name COMPUTERNAME (MYSTREAM), where COMPUTERNAME is the name of the sending machine. See NDI source names.

The field order sent in the NDI metadata is selected by NDIFormatType (nft_progressive by default, see TNDIFormatType).

Receiving a stream from the network

An NDI stream is opened like any other URL source, with the ndi:// scheme:

VideoGrabber.VideoSource = vs_VideoFileOrURL;
VideoGrabber.VideoSource_FileOrURL = "ndi://DESKTOP-5B66SBT (MYSTREAM)";
VideoGrabber.AudioDeviceRendering = true;   // if the audio is needed; disabling it may connect faster
VideoGrabber.StartPreview();
  • replace DESKTOP-5B66SBT by the name of the computer that is streaming, and MYSTREAM by the real stream name,
  • when the sender and the receiver run on the same computer, the computer name can be replaced by localhost:
VideoGrabber.VideoSource_FileOrURL = "ndi://localhost (MYSTREAM)";

The bandwidth requested from the sender is selected by the NDIBandwidthType property (see TNDIBandwidthType): full resolution, low-resolution proxy, audio only or metadata only.

An NDI URL can be used everywhere a URL source is accepted: preview, recording, re-encoding, mixing, and so on.

Also in the TVideoGrabber guide