npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vygr-labs/ndi-node

v1.0.0

Published

Node.js bindings for NDI (Network Device Interface) SDK

Readme

ndi-node

Node.js bindings for NDI (Network Device Interface) SDK.

NDI is a royalty-free software specification developed by NewTek that enables video-compatible products to communicate, deliver, and receive high-quality video over IP networks.

Features

  • NDI Source Discovery - Find NDI sources on your network
  • NDI Sender - Broadcast video and audio as an NDI source
  • NDI Receiver - Receive video and audio from NDI sources
  • PTZ Control - Control PTZ cameras over NDI
  • Tally Support - Send and receive tally information
  • Metadata - Exchange XML metadata with NDI sources
  • TypeScript Support - Full TypeScript type definitions included

Prerequisites

NDI SDK

You need to download and install the NDI SDK from NewTek:

  1. Visit https://ndi.video/download-ndi-sdk/
  2. Download the NDI SDK for your platform
  3. Copy the SDK files to the deps/ndi directory:
deps/ndi/
├── include/
│   └── Processing.NDI.Lib.h
└── lib/
    └── x64/  (Windows)
        ├── Processing.NDI.Lib.x64.lib
        └── Processing.NDI.Lib.x64.dll

Build Tools

  • Windows: Visual Studio Build Tools with C++ workload
  • macOS: Xcode Command Line Tools
  • Linux: GCC/G++ and build-essential

Installation

npm install

This will compile the native addon using node-gyp.

Quick Start

Finding NDI Sources

const ndi = require('ndi-node');

// Initialize NDI
ndi.initialize();

// Find sources (async convenience function)
const sources = await ndi.find(5000);
console.log('Found sources:', sources);

// Or use the Finder class for continuous discovery
const finder = new ndi.Finder();
finder.on('sources', (sources) => {
    console.log('Sources updated:', sources);
});
finder.startPolling(1000);

// Cleanup
finder.destroy();
ndi.destroy();

Sending Video

const ndi = require('ndi-node');

ndi.initialize();

const sender = new ndi.Sender({
    name: 'My NDI Source',
    clockVideo: true
});

// Send a frame
sender.sendVideo({
    xres: 1920,
    yres: 1080,
    fourCC: ndi.FourCC.BGRA,
    frameRateN: 30000,
    frameRateD: 1001,
    data: frameBuffer // Buffer containing BGRA pixel data
});

// Monitor tally
sender.on('tally', (tally) => {
    console.log('On Program:', tally.onProgram);
    console.log('On Preview:', tally.onPreview);
});
sender.startTallyPolling();

// Cleanup
sender.destroy();
ndi.destroy();

Receiving Video

const ndi = require('ndi-node');

ndi.initialize();

const receiver = new ndi.Receiver({
    source: { name: 'SOURCE_NAME (COMPUTER)' },
    colorFormat: ndi.ColorFormat.BGRX_BGRA,
    bandwidth: ndi.Bandwidth.HIGHEST
});

// Event-based capture
receiver.on('video', (frame) => {
    console.log(`Video: ${frame.xres}x${frame.yres}`);
    // frame.data contains the pixel buffer
});

receiver.on('audio', (frame) => {
    console.log(`Audio: ${frame.noSamples} samples`);
});

receiver.startCapture();

// Cleanup
receiver.destroy();
ndi.destroy();

API Reference

Core Functions

ndi.initialize(): boolean

Initialize the NDI library. Must be called before using any other functions.

ndi.destroy(): void

Cleanup the NDI library. Should be called when done using NDI.

ndi.version(): string | null

Get the NDI library version string.

ndi.find(timeout?, options?): Promise<Source[]>

Find NDI sources on the network.

Finder Class

new ndi.Finder(options?)

Options:

  • showLocalSources: boolean - Include local sources (default: true)
  • groups: string - Comma-separated list of groups to search
  • extraIps: string - Extra IPs to search for sources

Methods:

  • getSources(): Source[] - Get currently discovered sources
  • waitForSources(timeout?): boolean - Wait for sources to change
  • startPolling(interval?) - Start polling for sources
  • stopPolling() - Stop polling
  • destroy() - Release resources

Events:

  • 'sources' - Emitted when sources change

Sender Class

new ndi.Sender(options)

Options:

  • name: string - Name of the NDI source (required)
  • groups: string - Comma-separated list of groups
  • clockVideo: boolean - Clock video to frame rate (default: true)
  • clockAudio: boolean - Clock audio to sample rate (default: true)

Methods:

  • sendVideo(frame) - Send a video frame
  • sendVideoAsync(frame) - Send a video frame asynchronously
  • sendAudio(frame) - Send an audio frame
  • sendMetadata(frame) - Send metadata
  • getTally(timeout?): Tally | null - Get tally state
  • setTally(tally) - Set tally state
  • getConnections(timeout?): number - Get number of connections
  • getSourceName(): string | null - Get full source name
  • startTallyPolling(interval?) - Start polling for tally changes
  • stopTallyPolling() - Stop tally polling
  • destroy() - Release resources

Events:

  • 'tally' - Emitted when tally state changes

Receiver Class

new ndi.Receiver(options?)

Options:

  • source: Source - Source to connect to
  • colorFormat: string - Color format (default: 'BGRX_BGRA')
  • bandwidth: string - Bandwidth mode (default: 'highest')
  • allowVideoFields: boolean - Allow video fields (default: true)
  • name: string - Receiver name

Methods:

  • connect(source) - Connect to a source
  • capture(timeout?): CaptureResult - Capture any frame type
  • captureVideo(timeout?): VideoFrame | null - Capture video only
  • captureAudio(timeout?): AudioFrame | null - Capture audio only
  • setTally(tally): boolean - Set tally information
  • sendMetadata(frame) - Send metadata to source
  • startCapture(timeout?) - Start continuous capture
  • stopCapture() - Stop continuous capture
  • destroy() - Release resources

PTZ Methods:

  • ptzIsSupported(): boolean
  • ptzZoom(zoom): boolean
  • ptzPanTilt(pan, tilt): boolean
  • ptzPanTiltSpeed(panSpeed, tiltSpeed): boolean
  • ptzStorePreset(presetNo): boolean
  • ptzRecallPreset(presetNo, speed?): boolean
  • ptzAutoFocus(): boolean
  • ptzFocus(focus): boolean
  • ptzWhiteBalanceAuto(): boolean
  • ptzExposureAuto(): boolean
  • And more...

Events:

  • 'video' - Emitted when video frame is received
  • 'audio' - Emitted when audio frame is received
  • 'metadata' - Emitted when metadata is received
  • 'status_change' - Emitted when connection status changes
  • 'error' - Emitted on receive error

Constants

// Video pixel formats
ndi.FourCC.BGRA
ndi.FourCC.RGBA
ndi.FourCC.UYVY
ndi.FourCC.I420
ndi.FourCC.NV12
// ... and more

// Frame format types
ndi.FrameFormat.PROGRESSIVE
ndi.FrameFormat.INTERLEAVED
ndi.FrameFormat.FIELD_0
ndi.FrameFormat.FIELD_1

// Bandwidth modes
ndi.Bandwidth.HIGHEST
ndi.Bandwidth.LOWEST
ndi.Bandwidth.AUDIO_ONLY
ndi.Bandwidth.METADATA_ONLY

// Color formats
ndi.ColorFormat.BGRX_BGRA
ndi.ColorFormat.UYVY_BGRA
ndi.ColorFormat.RGBX_RGBA
ndi.ColorFormat.FASTEST
ndi.ColorFormat.BEST

// Frame types
ndi.FrameType.VIDEO
ndi.FrameType.AUDIO
ndi.FrameType.METADATA
ndi.FrameType.ERROR
ndi.FrameType.STATUS_CHANGE

Examples

See the examples/ directory for complete examples:

  • finder.js - Discover NDI sources
  • sender.js - Send video test pattern
  • audio-sender.js - Send audio (sine wave)
  • receiver.js - Receive video/audio
  • ptz-control.js - Control PTZ cameras

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Credits

NDI® is a registered trademark of NewTek, Inc.