Hikvision company makes good cameras and terrible documentation for their software.
If you've ended up here, chances are you've tried digging through their "isapi.pdf" file and didn't find much help there.
First, I'd suggest you get your camera set up via the web interface. Next, grab a reference template of the settings in XML format. Do it by opening in you browser:
- http://192.168.1.64/ISAPI/Streaming/channels/1 - for streaming options (resolution, fps, bitrate),
- http://192.168.1.64/ISAPI/Image/channels/1 - for image settings (white balance, WDR, lightning, etc). You will be asked for camera's login and pass.
In case you have different models of cameras, probably you need to get this templates from all of them, compare, and find common basis.
To deploy this config to camera simply PUT
this xml text to camera by the same url!
Sample python code:
import requests
from requests.auth import HTTPDigestAuth
username, password = ('admin', 'camera_password')
stream_xml = """
<StreamingChannel version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<id>1</id>
blah blah blah
"""
url = "http://192.168.1.64/ISAPI/Streaming/channels/1"
response = requests.put(url, data=stream_xml, auth=HTTPDigestAuth(username, password))
print(response.text)
assert response.status_code == 200
image_xml = """
<ImageChannel xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
<id>1</id>
<enabled>true</enabled>
<videoInputID>1</videoInputID>
"""
url = "http://192.168.1.64/ISAPI/Image/channels/1"
response = requests.put(url, data=image_xml, auth=HTTPDigestAuth(username, password))
print(response.text)
assert response.status_code == 200
You should get response like:
<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL></requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>
In more complex case, when you need different configs for each camera model, use: http://192.168.1.64/ISAPI/System/deviceInfo
to find out camera model.
Top comments (0)