Skip to content

A tool to support dynamically switching between NDI PTZ cameras (or other sources) in a live-stream setup

License

Notifications You must be signed in to change notification settings

DanTappan/NDI-Camera-Selector

Repository files navigation

NDI-Camera-Selector

A tool to support dynamically switching between NDI PTZ cameras (or other sources) in a live-stream setup

Introduction

NDI Camera Selector is intended to be used in a live-stream, or other video production, station based on PTZ cameras using the NDI video over IP protocol.

It can be used as part of a setup including my VISCA Game Controller application

It supports the following features:

  • the ability to dynamically select between N NDI video sources (e.g. PTZ cameras) on the LAN, and map them into M slots: CAM1-CAMN. This allows the operator to configure a video switching application (such as OBS or VMix) with a set of video sources or scenes, and dynamically change which cameras appear in each scene
  • the ability to route IP VISCA packets, to control the cameras, to the appropriate IP destination for each slot. This allows the operator to statically configure the targets for an IP VISCA Joystick controller, and have the VISCA packets automatically mapped to the current set of selected cameras.
  • an additional benefit of this is that many VISCA joystick controllers require that targets be configured by IP address; accessing the camera through the VISCA router allows specifying cameras by name
  • to support the case of an NDI camera mounted on a separate Pan/Tilt controller, or when a camera that supports VISCA and HDMI is connected to the network through an HDMI->NDI adaptor, the VISCA target for each camera can be specified separately
  • a graphics based interface with persistent configurable parameters

Use

When run, the application displays the following window

NDI Camera Selector

This has the following sections:

  • Cameras - defines the list of configures camera sources. These will be advertised over NDI as "Host (CAMn)", through an NDI Router. That is, when a program accesses (e.g.) "VideoStation (CAM1)" it will be directed to the camera mapped to the CAM1 slot. There is also a VISCA PTZ controller associated with each camera slot. This defaults to the same address as the NDI source. The VISCA port is currently hardwired to UDP 52381
  • Sources - lists the set of NDI sources which are visible on the local network via NDI discovery. Currently the application does not support the use of an NDI Discovery Server. Click on a source to select it.
  • Viewer - displays a snapshot from the current selected NDI source
  • to map a source to a camera slot
    • select a source
    • type the number of the slot (1-N) in the text box next to the Set Camera button
    • either hit return or click on the Set Camera button
  • to set the address of the VISCA PTZ controller associated with a camera
    • type the name or IP address of the controller into the text box next to the Set PTZ button
    • either hit return or click on the Set PTZ button

The window also includes a menu with the following items

  • Refresh - Clears and refreshes the list of NDI Sources. This is useful in a test environment when sources are being added and removed.
  • Configure - pops up a configuration dialog which allows setting the number of supported camera slots (currently up to 7)
  • Exit - exits the program.

NOTE: in order to prevent accidentally closing the Camera Selector app, which would break the operation of the live-streaming station, closing the app either through the menu, through the window close box, or through the task bar, requires an extra confirmation.

Configuration

The Configure menu item (see above) presents the following dialog

Configure Dialog

  • Camera Count sets the number of camera forwarders (CAM1 - CAMN) which can be set.
  • Enable Bitfocus Companion Interface enables switching the Preview window on VMix/OBS/ATEM when the program detects that the selected camera has changed
  • Bitfocus Companion Address selects the address of the machine running BitFocus Companion, if the Companion Interface is enabled
  • Bitfocus Companion Page selects the button page that will be used for selecting the Preview window. See below
  • Save&Exit saves the current configuration and exits the program, on restart it will use the new parameters
  • Cancel cancels the configuration without making any changes.

BitFocus Companion Interface

As noted above, the program has an optional feature to detect when the camera selected by a VISCA controller has changed, and automatically switch the Preview window of the streaming software/hardware.

This is not enabled by default for several reasons:

  • It assumes that the setup includes BitFocus Companion with a preconfigured button page, such that selecting Button Column N from Row 0 will set the preview window to camera N. There is a sample Companion configuration included in the repository which supports BlackMagic ATEM (page 97), VMix (page 98) and OBS (page 99)
  • It assumes that the setup includes a single VISCA camera controller, and that the controller will only communicate with one camera at a time. This is probably a common configuraton, but it's not universal.
  • If you are using my VISCA-Game-Controller application, the feature is redundant

Installation

A Windows Installer for the latest version is available. Alternatively, clone the repository through Github and go to town.

Python Packages

  • ndi-python
  • numpy
  • pillow
  • psgtray-foss
  • pyinstaller
  • PySimpleGUI-4-foss
  • pystray

Credits

The program uses the following libraries

About

A tool to support dynamically switching between NDI PTZ cameras (or other sources) in a live-stream setup

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published