vwout / obs-visca-control

OBS plugin to control Visca-over-IP based cameras
https://obsproject.com/forum/resources/control-visca-over-ip-based-cameras.1173/
GNU General Public License v3.0
35 stars 6 forks source link
luajit obs ptz ptz-control visca visca-over-ip

obs-visca-control

A plugin for OBS to control Visca-over-IP based cameras.

GPLv3 License GitHub release (latest by date) Linting and Tests

This plugin adds a source to a scene in OBS. With this source, a camera can be controlled. Its main purpose is to automatically switch a camera to a certain preset when the scene is activated. This activation can be as soon as the scene is active in preview, in program, or both.

Besides recalling a pre-made preset, this plugin supports a few more control operations:

This plugin requires the camera to support Visca over IP via UDP. It follows the specification as designed by Sony and also supports the PTZOptics variant of Visca. This plugin is confirmed to work with at Avonic, Canon, BZB Gear, Everet, GlowStream, JVC, PTZOptics and Zowietek cameras. Others may work as well.

Also visit https://obsproject.com/forum/resources/control-visca-over-ip-based-cameras.1173/ for more information.

Installation

The plugin is a script plugin and utilizes the Lua scripting capabilities of OBS. The script works on all recent versions of OBS, but version 28 or higher is recommended.

To use the plugin, add the file obs-visca-control.lua as a script, see below for a detailed instruction. The other .lua files in this repository are also required, but should not be added as scripts in OBS.

The files needed for usage if this plugin are:

Place the files on your computer, e.g. in data\obs-plugins\frontend-tools\scripts\ under your OBS installation folder. In OBS choose Scripts in the Tools menu and click the "+" symbol. Navigate to the location where obs-visca-control.lua is stored and confirm with 'Open'. The plugin settings will show on the right as described in the below.

Configuration

Before the plugin can be used in a scene, it requires configuration in the Script dialog. Plugin configuration

Start by enumerating the number of cameras that you want to control. For each camera a set of configuration properties will be shown.

Camera settings

Important: Reload the script after changing the address, port of mode configuration!

Switch between cameras using the drop-down. Reload the plugin to update the names of the cameras in the camera drop-down list.

The preset list contains one preset per line and contains the name for the preset and the number of the preset stored in the camera. The preset follows a specific syntax to link a preset number to a name. The following forms are supported:

The separator can be :, = or -. Valid examples are 0: Home, 5 = Pastor or Stage - 6. The number of presets that are supported may vary from camera to camera. This script supports up to preset number 254.

Note: Most cameras refer to the first preset as 1, other use 0. The presentation on the interface of the camera might not be clear on this topic, so keep this in mind while testing presets. JVC camera models are known to demonstrate this behavior.

Backup

Plugin backup and debug The bottom part of the plugin configuration settings section provides the ability to back up (export) the plugin settings to a 'json' file, restore (import) settings from a backup file. This backup only contains the plugin configuration settings, thus the camera and preset configuration. The scene settings are stored with each scene.

Troubleshooting

In case of interaction problems between this plugin and a camera, it might be of use to enable Enable verbose (debug) logging. The possible settings are None (no logging), Info (internal status information) and Debug (detailed data including raw Visca protocol messages). This will provide detailed information about the plugin functionality in the Script Log. Activate verbose logging using the setting Debug and attach the log when reaching out for help via the OBS forum or when creating an issue.

Usage

In a scene

To control a camera, add a Visca Camera Control source to a scene. Source configuration

In the source settings, select the camera and the action that should be executed.

Camera actions configured for a scene are executed as configured when the scene is activated or deactivated on preview or on program.

Tip: To temporarily suppress execution of scene actions, configure the hotkey Suppress actions on scenes. As long as the hotkey is pressed, actions are not executed. To permanently disable execution, without removing the configuration, change the visibility of the Visca Camera Control source in the scene to hidden.

Custom Command action execution overview

Load scene on preview Transition to program Transition back to preview Unload scene on preview2
Action Active: Always
On preview exclusive: No
Send start command Send start command Send stop command Send stop command
Action Active: Always
On preview exclusive: Yes1
- Send start command Send stop command -
Action Active: Preview
On preview exclusive: No
Send start command - - Send stop command
Action Active: Preview
On preview exclusive: Yes1
- - - -
Action Active: Program
On preview exclusive: N/A
- Send start command Send stop command -

Notes:

Hotkeys

The plugin adds a number of hotkeys to the global OBS settings. All hotkeys apply to a specific camera, except for Suppress actions on scenes (see the previous paragraph). Presets 0-9 recall, Color Gain (Saturation) increase/decrease, Brightness increase/decrease, Pan/Tilt actions up/down/left/right and Zoom in/out can be activated via hotkey next to (in addition) to a scene action. These hotkeys are independent of scene actions and can be applied at any moment. Focus commands can only be called via a hotkey. The pan/tilt and zoom/focus hotkey commands use the speed that is configured per camera in the configuration. This (default) speed can be changed dynamically using a hotkey.

To use any of these actions, configure a hotkey in the global OBS settings. Hotkey configuration

Pressing the configured key combination will perform an immediate zoom, pan or tilt step at the camera. The amount of effective zoom, pan, tilt or focus change may vary from camera to camera. When any of the focus commands is used, the camera will be switched to manual focus (except for the command to switch to automatic mode). The actions will obviously only be executed when the camera actually supports zooming, panning or tilting.

Credits

This plugin uses luajitsocket, a library that implements socket support for LuaJIT, since the Lua socket library is not available in OBS.