Safe and ergonomic Rust bindings for the NDI (ndi.video) SDK, enabling high-performance video, audio, and metadata transmission over IP networks.
Unlike other bindings this never exposes any raw pointers and uses correct Rust
types for everything (timeouts are handled as std::time::Duration, not
time_in_ms: u32)
Despite its name this is not affiliated with ndi, ndi-sdk, ndi-sys crates
- Safe wrapper around the NDI SDK
- Currently supports:
- Finder API for discovering NDI sources on the network
- Router API for routing NDI streams
- Sender API for transmitting NDI streams
- Receiver API for receiving NDI streams
- Not supported yet:
- Dynamic loading of NDI SDK
- PTZ Control
- FrameSync
- Receiver advertisement
- Audio frame access
- video frame metadata write
This crate is currently tested against SDK version 6.2.0.3
The raw bindings are generated from the header files in the SDK installation directory, this way generated code will always match the version on the machine it is compiled with and linked against.
This crates build.rs is currently lacking support for platforms other than
Windows x64, because I had no time for it so far. If you are working on another
platform, feel free to add support for it. (It shouldn't be that complicated,
windows support is less than 30 lines of nearly-boilerplate code)
- Make sure to have the NDI SDK installed
- Make sure to have Clang/LLVM installed. see rust-bindgen requirements
- Add
ndi-sdk-systo your cargo dependencies
Check out the examples at https://github.com/deno-plc/rust-ndi-sdk/tree/main/examples
This crate uses a lot of unsafe ffi bindings and therefore a lot of assertions.
You can turn on this feature to ensure debug assertions are in place even for release builds. During development and testing it is highly recommended to turn this on, as it sometimes also outputs more diagnostics.
There are some (unsafe) APIs that are not really necessary, but might in some rare case be useful. Use only if you REALLY know what you do. For example there are APIs that allow to change the resolution of a video frame while it is allocated, which may lead to out-of-bounds memory access by safe code.
This crate provides safe abstractions of the NDI SDK. The public API is designed to be 100% safe to use (except unsafe APIs of course). If you encounter restrictive lifetimes or &mut borrows, do not try to circumvent them, most likely it just represents the safety requirements of the C SDK.
As expected form a C library, safety requirements are not always documented in-depth by the NDI SDK. One common assumption this crate uses it that it is safe to drop arguments that are passed as pointers (and strings inside them) immediately after the call they were passed to has returned (unless defined otherwise by the documentation).
Contributions are welcome! Here's how you can help:
- Add support for other platforms in
build.rs - Report bugs and find missing APIs
- Implement these missing APIs
- Improve documentation and examples
Copyright (C) 2025 Hans Schallmoser
Licensed under GPL-v3.
A lot of the doc comments is adapted from the NDI Docs
Note: The NDI SDK is subject to its own EULA.
This project is not affiliated with NDI® or NewTek/Vizrt