Blue Iris 5 -> Hikvision PTZ using External Script

Joined
Sep 19, 2019
Messages
5
Reaction score
2
Location
Earth
Recently gave up on a Hikvision NVR and purchased a dedicated Windows 11 system to run Blue Iris. Blue Iris wasn't able to control PTZ on my two fancy Hikvision PTZ cameras, so I finally gave up and created a custom External Script in the form of a Windows 'bat' file. To customize the script you only need to enter the HOST address (www.xxx.yyy.zzz) of the camera and the appropriate Blue Iris account (aaa) and password (ppp) in USERPASS. You would then place the script in the appropriate C:\Program Files\Blue Iris 5\Cameras\xxxx folder, named something like 'ptz.bat', and select that file as the External Script in the PTZ/Control tab in Blue Iris. Hopefully this will prove useful to someone, as I was entirely unable to find any decent examples online.

Code:
@echo off
SetLocal EnabledDelayedExpansion

set “ARG=%~1”
set “HOST=www.xxx.yyy.zzz”
set “USERPASS=aaa:ppp”

if %ARG%==RIGHT (
  set “XMLBODY=<PTZData><pan>20</pan></PTZData>”
)
if %ARG%==LEFT (
  set “XMLBODY=<PTZData><pan>-20</pan></PTZData>”
)
if %ARG%==UP (
  set “XMLBODY=<PTZData><tilt>20</tilt></PTZData>”
)
if %ARG%==DOWN (
  set “XMLBODY=<PTZData><tilt>-20</tilt></PTZData>”
)
if %ARG%==ZOOMIN (
  set “XMLBODY=<PTZData><zoom>1</zoom></PTZData>”
)
if %ARG%==ZOOMOUT (
  set “XMLBODY=<PTZData><zoom>-1</zoom></PTZData>”
)
if %ARG%==STOP (
  set “XMLBODY=<PTZData><pan>0</pan><tilt>0</tilt><zoom>0</zoom></PTZData>”
)

curl -h “Content-type: text/xml” -d “!XMLBODY!” -X PUT http://!USERPASS!@!HOST!/PTZCtrl/channels/1/continuous
 
Top