1

I wonder if it's possible to get access of the H264-encoded mainstream of my Hikvision IP-cam DS-2CD2032-I over SimpleCV.

The H264-stream I got in the browser is

rtsp://192.168.1.199:554/ISAPI/streaming/channels/101?auth=YWRtaW46MTIzNDU=

SimpleCV is a python wrapper for OpenCV (a computer-vision package).

empedokles
  • 4,023

1 Answers1

1

SimpleCV has an Image class which you can use to process image files (instead of telling it to grab an image from hardware) so your actual problem is extracting an image from the current stream.

There are a number of ways of doing this but I would probably keep this out of band (in Ubuntu, not Python) and just constantly update the same image file all the time (and loop that in Python/SimpleCV).

First you need the streaming address. There's a list of Hikvision ones here but it's going to look something like: rtsp://IPADDRESS:554/h264

We can then run avconv (from the libav-tools package, or ffmpeg from any reputable PPA you can find) to capture and keep capturing once a second (based on this):

avconv -i rtsp://IPADDRESS:554/h264 -f image2 -r 1 -updatefirst 1 /path/to/img.jpg

That pulls us back around to the SimpleCV. To vastly simplify their example:

import time
from SimpleCV import *

while True:
        img = Image('/path/to/img.jpg')
        img.show()
        time.sleep(1) #wait for 1 second

Alternatively, the camera specs claims it provides FTP access (amongst other things). Anything that will get you an image file is a viable option here.

Oli
  • 299,380