OBS script for executing any CLI command whenever a scene is activated. Useful for:
Tools
=> Scripts
.+
and select the scene_execute_command.lua
file at the location where you extracted it.Loaded scripts
. Click it.Reload Scripts
button, before the script settings will show the settings for this new scene.SCENE_VALUE
and enter the command in the Command
setting.Command
: curl http://192.168.178.61/cgi-bin/lums_configuration.cgi -H "Cookie: userName=admin; passWord=admin;" --data-raw "{\"cmd\":\"campresetrecall\",\"memnum\":\"SCENE_VALUE\"}"
Scene1 value
: 1
Scene2 value
: 2
Command
: curl http://192.168.1.160/command/presetposition.cgi?PresetCall=SCENE_VALUE --digest -u admin:password123
Scene1 value
: 1
Scene2 value
: 2
Command
: onvif-ptz goto-preset --baseUrl=http://192.168.0.123 -u=admin -p=admin --preset=SCENE_VALUE`Scene1 value
: 1
Scene2 value
: 2
If you have very different commands for the different scenes you can use the following approach:
Command
: SCENE_VALUE
Scene1 value
: do-something --arg=1
Scene2 value
: something-entirely-different --cow=horse
curl is a well-known cli-tool for executing any HTTP command. It is available for Linux, Windows and OSX.
Most PTZ cameras come with a web-application. In this web-application you can configure the camera, and often also control the PTZ features of the camera, like setting and loading presets.
Network
tab of the Developer Tools.Command
setting of the script in OBS.SCENE_VALUE
.Script Log
. The script will tell what commands it is executing.Many PTZ cameras have support for the ONVIF protocol. Since this is an old SOAP protocol you can't easily execute these commands with curl.
onvif-ptz-cli is a CLI tool that I created to be able to easily execute ONVIF commands from the command line. Together with the OBS Scene Execute Command you can easily execute ONVIF commands when an OBS scene is activated.
onvif-ptz
. Something like: onvif-ptz goto-preset --baseUrl=http://192.168.0.123 -u=admin -p=admin --preset=1
.Command
setting of the script in OBS, and replace the preset with SCENE_VALUE
. Something like: onvif-ptz goto-preset --baseUrl=http://192.168.0.123 -u=admin -p=admin --preset=SCENE_VALUE
.Script Log
. The script will tell what commands it is executing.