12/1/2021

Hikvision Raspberry Pi As Viewer

  1. Hikvision Raspberry Pi As Viewer Software
  2. Hikvision Camera Viewer

Hikvision (web) cam

On the Abergavenny website, there’s a network IP web cam pointed at the Blorenge mountain. This is a fairly simple setup – the camera is an Axis m1014, and is configured that every 15 minutes it’ll upload a jpg to the website.

Re: Use raspberry to view Hikvision DVR Wed Aug 31, 2016 2:47 pm zaoar wrote: hi. But it seems that the version i found was android tv wich is diferent than the android. I manualy installed the iVMS but it failed to start. 🚨 Home Security Intrusion Detection for Raspberry PI or any other linux OS python mqtt raspberry-pi alarm security sensor android-application assistant diy home-assistant voip ifttt str restful-api mqtt-server zigbee pin mqtt-topics mqtt-message hikvision alarmpi ifttt-maker. Portable Hikvision CCTV System with a Raspberry PI 12 June 2019, 10:47 pm. Every year I attend a show with my dad and brother, they operate a stall for a week. Python script for viewing RTSP streams from Hikvision (not only) cameras in grid on Raspberry Pi 3. Our NVR is installed in a separate room in the server rack. We applied the Raspberry Pi 3 with our script to view cameras streams. The script takes RTSP streams.

However, as with most IP cams like this, the view is pretty wide-angle. Great if you want a security device and it needs to take in a much as possible from your office/garage/shop. However, if you want to get close to your subject (in this case the Blorenge), the wide-angle view isn’t very useful.

Enter the Hikvision Bullet cam – varifocal with up to 4x optical zoom, model DS-2CD2642FWD-IZS. Take a look at the Blorenge webcam to see the output from this camera.

Hikvision Raspberry Pi As Viewer Software

Unfortunately, the Hikvision Bullet cam software isn’t anywhere near as straightforward to configure/setup as the Axis cam, and requires a number of workarounds listed below… (if anyone from Hikvision is reading this – please add these features to your software ASAP!)

Requirement #1: Upload to FTP site.
Fail… the Hikvision camera doesn’t appear to support SFTP, which is required by my current hosting provider. Really hard to get any info from the Hikvision software – there is no access to any FTP log files or similar which would have really REALLY helped to identify issues. Only occasional ‘ftp test failed’ messages, which is not very helpful.
Workaround: I’ve set up an FTP relay. The Hikvision camera uploads snapshots to my NAS drive (Synology DS213J – an excellent bit of kit). Then a Raspberry PI cron job kicks in to upload the file using Python and SFTP to my hosting provider. A little tricksy, as you only want to upload the latest file (not all of them) each time.

Requirement #2: Create snapshots using the same filename each time.
If you want to display an image on a website, the HTML needs to refer to a filename, for example /webcam-snapshot.jpg.
Fail… the Hikvision camera lets you select a filename, but then appends a timestamp into the filename. So each file uploaded is different, and therefore can’t be referred to by the HTML.
Workaround: I did consider options such as Apache rewrite rules to map a filename to the latest file-with-timestamp – but rapidly got out of my depth. Another option was to write some PHP to return the latest image in response to a single file request. But as I was already using a Raspberry PI for the FTP process, it was much easier to add to my Python script and do the renaming process there.

Requirement #3: following the nonsense generated by the fail for requirement 2 around naming, I now have a requirement not to fill up my NAS drive with gazillions of snapshot jpgs. So again, PI to the rescue to check for any files in a particular folder older than ‘today’, and delete. And yes, it was a bit scary running any kind of automated ‘delete all’ script on my NAS drive which also houses a ton of important stuff.

Requirement #4: Add a timestamp text overlay to the snapshot.
This is a handy feature so you can see at a glance when the snapshot was taken on the website. Particularly important if the image fails to update for some reason.
Fail… Annoyingly, the Hikvision camera very nearly almost supports this. It allows you to overlay text on the live video stream. And if you play with the settings around the text overlays, then save, then the next snapshot sometimes has the text overlays added. I haven’t quite figured out the bug here (is the text only overlayed if you are also viewing the live feed at the same time?).
Workaround: Raspberry PI to the rescue again. There’s a fantastic plugin called Imagemagick which allows you to add text to an image in just a line or two of code.
A quick bit of config, and using Python to ‘call’ a system process (along with a bit of timestamp configuring… Rasbi-config needs to be set to BST), and the snapshot now has some nicely overlaid text. Better than the Hikvision overlaid text too… the text is nice and crisp and anti-aliased.

Requirement #5: DDNS access to camera
Fail: Well, a partial fail. Not sure what happened here – the Hikvision software does allow you to configure DDNS, and this seemed to work well for about a week, and I was able to remotely access the camera with no issues. Then it stopped working for no good reason that I could tell.
Workaround: luckily the network hub supported its own DDNS configuration, and I was able to use that with the right port forwarding to access the camera remotely.

So, about a month’s elapsed time managed to sort all of the above. Sorry Hikvision, I won’t be buying your cameras again unless you can resolve the issues around the snapshots, and improve items like the text-overlay. It’s back to Axis or Panasonic for me – both of which had no problem with any of the items above. (Or a Raspberry Pi with camera module attached to the eyepiece of some binoculars… a little more appealing now I’ve written my own scripts for handling FTP, file renaming and text overlays).

Which is a shame – the actual Hikvision camera quality is great, and probably works wonderfully for the live video view which is its primary purpose.

April 15, 2017 at 2:10 pmLeave a comment

HikvisionLatest version

Released:

The client for HIKVISION cameras, DVR

Project description

Hikvision raspberry pi as viewer softwareHikvision
[![CircleCI](https://circleci.com/gh/MissiaL/hikvision-client.svg?style=svg)](https://circleci.com/gh/MissiaL/hikvision-client)
# Python Library for Hikvision Cameras
Simple and easy to use library for working with video equipment from Hikvision.
## Install
```bash
pip install hikvisionapi
```
## Examples
There are two formats for receiving a response:
```python
from hikvisionapi import Client
cam = Client('http://192.168.0.2', 'admin', 'admin')
# Dict response (default)
response = cam.System.deviceInfo(method='get')
response {
u'DeviceInfo': {
u'@version': u'2.0',
'...':'...'
}
}
# xml text response
response = cam.System.deviceInfo(method='get', present='text')
response ''<?xml version='1.0' encoding='UTF-8' ?>
<DeviceInfo version='1.0' xmlns='http://www.hikvision.com/ver20/XMLSchema'>
<deviceName>HIKVISION</deviceName>
</DeviceInfo>''
```
Hints:
```python
# to get the channel info
motion_detection_info = cam.System.Video.inputs.channels[1].motionDetection(method='get')
# to send data to device:
xml = cam.System.deviceInfo(method='get', present='text')
cam.System.deviceInfo(method='put', data=xml)
# to get events (motion, etc..)
# Increase timeout if you want to wait for the event to be received
cam = Client('http://192.168.0.2', 'admin', 'Password', timeout=30)
cam.count_events = 2 # The number of events we want to retrieve (default = 1)
response = cam.Event.notification.alertStream(method='get', type='stream')
response [{
u'EventNotificationAlert':{
u'@version': u'2.0',
u'@xmlns': u'http://www.hikvision.com/ver20/XMLSchema',
u'activePostCount': u'0',
u'channelID': u'1',
u'dateTime': u'2018-03-21T15:49:02+08:00',
u'eventDescription': u'videoloss alarm',
u'eventState': u'inactive',
u'eventType': u'videoloss'
}
}]
# Alternative solution to get events
cam = Client('http://192.168.0.2', 'admin', 'Password', timeout=1)
while True:
try:
response = cam.Event.notification.alertStream(method='get', type='stream')
if response:
print response
except Exception:
pass
# to get opaque data type and write to file
response = cam.System.configurationData(method='get', type='opaque_data')
with open('my_file', 'wb') as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
# Get and save picture from camera
response = client.Streaming.channels[102].picture(method='get', type='opaque_data')
with open('screen.jpg', 'wb') as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
```
## How to run the tests
```bash
pipenv install --dev
pipenv run pytest
pipenv run pytest --cov-report html --cov hikvisionapi # to get coverage report in ./htmlcov/
# or you can get into the virtual env with:
pipenv shell
pytest
```

Release historyRelease notifications RSS feed

0.2.1

0.2

0.1.9

0.1.8

0.1.7

0.1.6

Hikvision raspberry pi as viewer

0.1.5

0.1.4

0.1.3

0.1.2

0.1.1

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hikvisionapi, version 0.2.1
Filename, sizeFile typePython versionUpload dateHashes
Filename, size hikvisionapi-0.2.1.tar.gz (5.3 kB) File type Source Python version None Upload dateHashes
Close

Hashes for hikvisionapi-0.2.1.tar.gz

Hikvision Camera Viewer

Hashes for hikvisionapi-0.2.1.tar.gz
AlgorithmHash digest
SHA256778faaad2208e04f06073a0c716a24e147814468f55a92d27b8868a64a04d891
MD51654f64f240535a75a9aa57630465bab
BLAKE2-256b38f16e6533accb83d9b6a52f1dfd5ae8568ca12cb1a3e45d643c87df543e5cb