ndi-mod: share the norns screen over a network

ndi-mod

a norns mod to share the screen in near-real-time via the NDI streaming video protocol.

image

image

why?

Show us your screens! There are lots of ways to do it, from downward-facing cameras to mirrors to VNC to norns.online. This strategy offers a different set of ease-of-use/efficiency/integration tradeoffs that might be interesting to folks projecting, livestreaming, or recording a norns-based performance alongside other video sources.

Earlier related discussions:

why ndi / why not ndi?

NDI is fast, and includes zeroconf-based discovery of stream sources. Many popular streaming and video art tools support discovering and receiving NDI streams, including OBS Studio*, Resolume, Max/MSP/Jitter*, and Touch Designer.

(* requires a plugin)

In NDI’s standard latency mode, a 30fps stream over a local wi-fi network is about a frame behind the norns screen. So far, in informal testing with a Pi CM3+ factory norns, using this mod appears to increase the CPU load by just 1-2%. When using clients like OBS that support NDI’s optional low-latency mode, the network update can be practically simultaneous with the norns screen update.

One disadvantage of NDI is that it’s not a completely open, unencumbered standard (but it is at least royalty-free.)

Alternatives to NDI include RTMP, HLS, or SRT; those may be better for certain purposes and the general structure of this mod could be adapted to other protocols.

requirements

  • norns 220321
  • wi-fi
  • one or more devices to receive the NDI stream

installing and activating

  1. From the maiden console, enter:
    ;install https://github.com/Dewb/ndi-mod/releases/download/latest/ndi-mod.zip
    
  2. In the norns menu, navigate to to SYSTEM > MODS, scroll to NDI-MOD, and turn enc 3
    clockwise to add a + next to the mod name. Hit button 2 to back out, and select
    SYSTEM > RESTART to relaunch with the mod loaded.

This will add about 3MB of files to ~/dust/code/ndi-mod. To uninstall everything, disable the mod by reversing the above process, then SYSTEM > RESTART again. Then, go to the maiden library, scroll to ndi-mod in the installed section, and click remove.

documentation

how does this work?

At startup the mod hooks screen.update() and hands the buffer from the Cairo surface to the NDI library, which will encode it and broadcast it from a separate thread. Heavily indebted to @ngwese’s norns-event-demo sample app for illustrating how to incorporate C code into a Lua mod.

Thanks very much to @infinitedigits, @radioedit, and @fourhoarder for beta testing. And of course shout out to @infinitedigits for advancing the screen sharing story with the very cool norns.online.

warnings/caveats

  • This came together pretty quickly, it’s been tested thoroughly on a couple different systems but there still may be gremlins.
  • This mod may conflict with other mods that hook screen.update().
  • Scripts that use offscreen cairo surfaces may produce unexpected results. As of version 0.2, this mod behaves with scripts that create offscreen images. You can even share offscreen images as secondary NDI streams!
  • Known issues/future thoughts on GitHub.
54 Likes

NDI? This is insane haha. So cool! Never imagined this would be possible.

3 Likes

I’d be super interested in being able to set this up and run it headless and I know a few others will be too. maybe we just need to run NDI manually from SSH the first time?

2 Likes

Yep, without access to a screen you’d need to ssh in once and modify ~/dust/data/system.mods to enable the mod, but in theory that should work.

EDIT 6/21: this is now compatible with scripts that use offscreen image drawing, thanks to some feedback from @ngwese. You can also share offscreen images as additional NDI streams of arbitrary size:

3 Likes

So cool. VJs and AV performers rejoice!

4 Likes

This is amazing! Norns display feedback loops!!!

3 Likes