NDILibDotNetAdvanced 2026.11.18.2
dotnet add package NDILibDotNetAdvanced --version 2026.11.18.2
NuGet\Install-Package NDILibDotNetAdvanced -Version 2026.11.18.2
<PackageReference Include="NDILibDotNetAdvanced" Version="2026.11.18.2" />
<PackageVersion Include="NDILibDotNetAdvanced" Version="2026.11.18.2" />
<PackageReference Include="NDILibDotNetAdvanced" />
paket add NDILibDotNetAdvanced --version 2026.11.18.2
#r "nuget: NDILibDotNetAdvanced, 2026.11.18.2"
#:package NDILibDotNetAdvanced@2026.11.18.2
#addin nuget:?package=NDILibDotNetAdvanced&version=2026.11.18.2
#tool nuget:?package=NDILibDotNetAdvanced&version=2026.11.18.2
.NET Wrapper for NDI® Basic and Advanced SDK (C#)
This library provides a wrapper to the NDI libraries for Windows, macOS, and Linux. Both the Basic (Free) and Advanced SDK functions are wrapped.
This package contains a managed wrapper only. It does not include or license the native NDI runtime. Applications must provide a compatible NDI or NDI Advanced runtime and, for Advanced features, their own NDI Advanced license.
Intended audience and abstraction level
This package is a thin managed interop layer over the native NDI SDK. Developers are expected to be familiar with NDI concepts and API conventions, including object lifetimes, frame ownership, pixel and audio formats, timecodes, threading, and the requirement to free frames with the matching NDI function. The official NDI SDK documentation is the authoritative reference for those behaviors.
Only a small number of convenience wrappers are provided. Most functions, structures, enums, pointers, return values, and ownership rules intentionally remain close to the native C API so developers can use both Basic and Advanced SDK features without a high-level abstraction hiding SDK behavior.
Supported Platforms
- Microsoft Windows (x86-64)
- Linux (x86-64 and ARM64)
- macOS (ARM64)
Notes
- This project exposes both safe (e.g. passing structs by
ref) andunsafemethods (e.g. passing structs by pointer) for most SDK entrypoints. - Use a 6.4 native runtime for the 6.4 entry points. The File API loads its own runtime on first use.
NDI 6.4
The wrapper includes the 6.4 video-only bandwidth modes, receive audio and video delays,
SDK timestamps, and all File recorder and player functions in Tractus.Ndi.Sdk64.NDIFile.
Select recv_color_format_e.recv_color_format_best_444 to request native 4:4:4 video.
Inspect each frame's FourCC. NA48 and NB48 use 8-bit planes, and NA4G and NB4G
use 16-bit planes. The NB variants include an alpha plane.
Call NDIWrapper.Initialize(true, exactLibLookupPath, exactFileLibLookupPath) before
the first native call to specify both libraries. Each file recorder records one source.
After stopping a recorder, drain its events through file_closed before destroying the
handle or consuming the completed file. Keep create-structure string pointers alive as
required by the native SDK, and keep allocator or async completion delegates rooted while
the SDK can call them.
Finder snapshots
Use finder.GetCurrentSourceSnapshot() to iterate the current list without allocating.
The view and its NdiSource entries stay valid across later updates. The existing
GetCurrentSourceList() returns a caller-owned array for code that sorts or modifies it.
A change of URL for the same name publishes a new entry. A change in order alone
preserves the previous snapshot and its order. SourceListChanged notifications are
coalesced and dispatched off the finder thread.
Updating existing applications
Rebuild applications and dependent assemblies when upgrading from 2026.10.29.1.
audio_frame_interleaved_32s_tnow has the SDK'sreference_levelfield beforep_data.sender_t.p_addressis a native UTF-8 pointer. Copy its contents while the sender list is valid.recv_request_keyframe,framesync_capture_audioandframesync_capture_audio_v2returnvoid. The v3 interleaved audio converters return the SDK success flag.- Pass frame structs by
refor pass typed frame pointers torecv_capture_v3. The former three-out nintoverload provided insufficient storage for native frame descriptors. recv_color_format_BGRX_BGRA_flippedhas the SDK value 1000. Replace any persisted legacy value 200 for this mode. Rebuilding also updates inlined enum constants.- UTF-8 string inputs accept a trailing NUL. Embedded NULs throw
ArgumentException. The byte count returned byUTF.StringToUtf8excludes the terminator.
Successor to NDILibDotNetCoreBase
NDILibDotNetAdvanced supersedes the deprecated
NDILibDotNetCoreBase
package and repository. All ongoing wrapper development happens in this repository.
This is intentionally not a drop-in replacement. To migrate a project, replace its package reference:
dotnet remove package NDILibDotNetCoreBase
dotnet add package NDILibDotNetAdvanced
Then update code from the old NewTek and NewTek.NDI namespaces to Tractus.Ndi.
The old NewTek.NDIlib low-level entry point is now NDIWrapper, and its structs and
enums are top-level types in Tractus.Ndi. Call NDIWrapper.Initialize once before
using native entry points. The old high-level Sender, Router, Source,
VideoFrame, and AudioFrame compatibility classes are not carried forward; use the
current NDIWrapper APIs and types instead.
Usage
using Tractus.Ndi;
var myName = "Recv Test";
// This signals to the wrapper that we should load the advanced SDK
// DLL/dynlib. Pass in false to have the wrapper try to load the
// basic SDK.
//
// Note that if an API entrypoint only exists in the advanced SDK,
// you'll get an exception if you try to call it when in basic
// SDK mode.
NDIWrapper.Initialize(useAdvancedDynLib: true);
using var sourceNameNdiString = new NDIInteropString("CAMERA (CAM-1)");
using var recvName = new NDIInteropString(myName);
var createSettings = new recv_create_v3_t()
{
allow_video_fields = true,
bandwidth = recv_bandwidth_e.recv_bandwidth_highest,
color_format = recv_color_format_e.recv_color_format_fastest,
source_to_connect_to = new source_t
{
p_ndi_name = sourceNameNdiString
},
p_ndi_recv_name = recvName
};
// TODO: Provide your VID JSON here.
using var vidJson = new NDIInteropString("");
// If using the basic SDK, use recv_create_v3.
var receiver = NDIWrapper.recv_create_v4(ref createSettings, vidJson);
// Unsafe version for demo purposes only. There's a ref version available of the
// capture method.
unsafe
{
while(true)
{
var videoFrame = new video_frame_v2_t();
var audioFrame = new audio_frame_v3_t();
var metaFrame = new metadata_frame_t();
var frameType = NDIWrapper.recv_capture_v3(
captureReceiver,
&videoFrame,
&audioFrame,
&tallyMessage,
1000);
// TODO: Something useful.
// TODO: Free the frames.
}
}
NDIWrapper.recv_destroy(receiver);
NDIInteropString
Many NDI structures and functions accept pointers to null-terminated UTF-8 strings,
while a .NET string lives in managed memory and cannot safely be passed as a stable
native pointer. NDIInteropString bridges that boundary by allocating an unmanaged,
null-terminated UTF-8 copy of a managed string.
It converts implicitly to nint, which allows it to be assigned directly to pointer
fields such as source_t.p_ndi_name. It can also convert to its stored managed
string value. NDIInteropString is primarily a small memory-ownership helper, not a
high-level SDK string abstraction; the unmanaged buffer belongs to the
NDIInteropString instance:
using var sourceName = new NDIInteropString("CAMERA (CAM-1)");
var source = new source_t
{
p_ndi_name = sourceName
};
// Use source only while sourceName remains alive, unless the NDI SDK documentation
// explicitly states that the called function copies the string.
Keep the instance alive for every native call that may read its pointer. Disposing it
frees the unmanaged allocation and sets its pointer to zero; any previously copied
pointer is invalid after that point. The class has no finalizer, so use using or call
Dispose to avoid leaking unmanaged memory. Do not also call Marshal.FreeHGlobal on
its pointer because that would free the same allocation twice.
null and an empty string have different native representations:
using var omitted = new NDIInteropString(null); // Converts to nint.Zero.
using var empty = new NDIInteropString(""); // Points to a single null terminator.
Use null for an optional native string that should be absent, and "" only when the
NDI API expects a present but empty string. For managed-string conversion, the class
normalizes a null constructor argument to ""; the distinction exists in the native
pointer value, not in the stored managed value.
Native library lookup
When exactLibLookupPath is not supplied to NDIWrapper.Initialize, the loader
searches for these filenames. Passing useAdvancedDynLib: true selects the Advanced
column; passing false selects the Basic column.
| Platform | Basic SDK | Advanced SDK |
|---|---|---|
| Windows x86-64 | Processing.NDI.Lib.x64.dll |
Processing.NDI.Lib.Advanced.x64.dll |
| Linux | libndi.so, libndi.so.6 |
libndi_advanced.so, libndi_advanced.so.6, libndi_advanced.so.6.4.0, libNdiAdv.so, libndi_adv.so |
| macOS | libndi.dylib |
libndi_advanced.dylib, libNdiAdv.dylib |
The names are tried in the application base directory, current working directory,
assembly directory, and paths supplied through NDI_RUNTIME_DIR, NDI_RUNTIME_DIR_V6, NDI_FILE_RUNTIME_DIR, NDI_LIBRARY_PATH,
or NDI_SDK_DIR. For each environment path, its lib and bin subdirectories are
also searched. On Windows the SDK root also contributes its Bin/x64 directory. Linux additionally searches /usr/local/lib, /usr/lib, and
/usr/lib/x86_64-linux-gnu. Finally, the loader asks the operating system to resolve
each filename using its normal native-library search rules. Filename casing matters
on case-sensitive filesystems.
When exactLibLookupPath is supplied, only that exact path is tried and the normal
filename search is skipped. The automatic Windows lookup for the main runtime supports x86-64. An exact DLL path can be used on other architectures when a compatible runtime is available.
Verifying the bindings
Run dotnet run -c Release --project tests/AbiLayout to verify the release contract and
64-bit layouts. To regenerate the checked-in contract from an installed SDK, run
python tests/sdk-contract.py <SDK include directory> --output tests/AbiLayout/sdk-6.4.tsv.
The probe uses the platform C++ compiler. On Windows run it in a Visual Studio developer prompt.
Set NDI64_TEST_ADVANCED_LIBRARY and NDI64_TEST_FILE_LIBRARY to exact library paths
to enable native smoke tests. The CI workflow also builds the portable finder fixture and
runs its discovery and allocation checks.
NuGet packages
The managed assembly is platform-neutral, so CI produces one NuGet package. A single Ubuntu x86-64 runner builds the library for all five targets and runs the SDK contract, layout, and native finder tests on Linux x86-64.
- Windows x86-64 (
win-x64) and ARM64 (win-arm64) - macOS Apple Silicon (
osx-arm64) - Linux x86-64 (
linux-x64) and ARM64 (linux-arm64)
Successful runs expose the .nupkg and .snupkg files as a nuget workflow
artifact. The package version is <VersionPrefix>-ci.<run number>, which keeps each
mainline build immutable and uniquely versioned.
To create a stable release, set VersionPrefix in the project file and push a tag
with the same version prefixed by v (for example, v2026.8.5.1). A tag whose version
does not match VersionPrefix fails instead of publishing an incorrectly versioned
package.
Stable releases use NuGet.org Trusted Publishing, so the repository does not store a long-lived API key. Complete this one-time setup before creating the first release:
In this GitHub repository, create an environment named
nuget. Consider limiting it to protectedv*tags and requiring a reviewer.On NuGet.org, sign in as
eliaspuurunen, choose Trusted Publishing from the account menu, and create a GitHub Actions policy with these values:Field Value Policy owner eliaspuurunenRepository owner tractuseventsRepository NdiLibDotNetAdvancedWorkflow file nuget.ymlEnvironment nugetMerge the workflow into
main, then push the matching version tag. The workflow exchanges GitHub's short-lived identity token for a temporary NuGet.org API key and publishes the package and symbols.
Enter only the workflow filename, not .github/workflows/nuget.yml. No GitHub secret
or permanent NuGet API key is required. Mainline builds remain downloadable workflow
artifacts; only version tags publish to NuGet.org.
If NuGet.org initially marks the policy as pending, make the first matching publish within seven days. A successful publish permanently activates the policy; NuGet.org also lets you restart an expired activation window.
Linux and macOS filename lookup works in ARM64 processes. Windows ARM64 callers must supply an exact DLL path for a compatible main runtime.
Legal
NDI® is a registered trademark of Vizrt NDI AB.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.11.18.2 | 110 | 11/18/2026 |
| 2026.10.29.1 | 156 | 10/29/2026 |
| 2026.8.5.1 | 247 | 8/5/2026 |
NDI 6.4 interop, File recorder and player, complete SDK enum values, corrected audio and sender layouts, and allocation-free finder snapshot reads. See the README for source and binary compatibility changes.