HikVision HWP-N2404IH-DE3 PTZ controls

Recently I came into the possession of a HikVision HWP-N2404IH-DE3 mini PTZ camera. It has POE, RTSP, ONVIF, can pan/tilt/zoom remotely, has optical zoom etc.. Hardware wise the camera is great. Proper build quality, nothing to complain about here. But the IT part looks better on paper than IRL. Worst thing is that I could not use the PTZ controls in the webinterface, because they require some Windows .exe to be installed to get that working. But I have a workaround.

live viewing

So this camera requires a .exe to be installed to use the “LiveView” or PTZ controls on the webinterface. The “LiveView” can be worked around by using ffplay (VLC or even mplayer won’t play this RTSP stream because they use a non-standard RTSP server). I can live without a completely working webinterface, as long as I can view the camera remotely. So I’m settling for ffplay (I’m glad I found something that worked to be honest).

PTZ controls

Not being able to remotely use the PTZ controls, that is a dealbreaker.

First I tried to contact HikVision to check if there is a newer firmware available. They responded quickly and sent me a firmware file via WeTransfer, which felt quite weird. Looking at filename I assumed it was an older firmware. So I asked them for more information and which firmware they actually sent me. They told me to try it out (and did not answer my question). So I asked them how I could revert to the currently installed firmware, in case their provided firmware did not work and indeed turned out to be an older firmware. No response, whatsoever.

Normally that would a reason for me to return the camera immediately, but the camera was a great deal, so I decided to see if I could work around the issue.

Apparently I am not the only one wanting to control PTZ remotely. There are posts at home assistant, zoneminder, openhab and ipcamtalk where people also talk about this and provide excellent information. So I started building, using their provided information. Thank you all!

the scripts

Finally I created several KISS shell scripts to pan, tilt and zoom (you’ll have to replace the username, password and IP of course).

pan_left

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <pan>100</pan>
 <tilt>0</tilt>
 <Momentary>
  <duration>400</duration>
 </Momentary>
</PTZData>'

pan_right

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <pan>-100</pan>
 <tilt>0</tilt>
 <Momentary>
  <duration>400</duration>
 </Momentary>
</PTZData>'

tilt_down

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <pan>0</pan>
 <tilt>100</tilt>
 <Momentary>
  <duration>300</duration>
 </Momentary>
</PTZData>'

tilt_up

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <pan></pan>
 <tilt>-100</tilt>
 <Momentary>
  <duration>300</duration>
 </Momentary>
</PTZData>'

zoom_in

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <zoom>100</zoom>
 <Momentary>
  <duration>750</duration>
 </Momentary>
</PTZData>'

zoom_out

#!/bin/bash
curl --insecure --request PUT --header 'Content-Type: application/xml' 'https://username:password@192.168.1.64/ISAPI/PTZCtrl/channels/1/Momentary' --data-raw '<PTZData>
 <zoom>-100</zoom>
 <Momentary>
  <duration>750</duration>
 </Momentary>
</PTZData>'