how to get stream from Hikvision ipcam ?
I have tried with this code. password is mypassword. This is hikvision version DS 2CD1021 I I make this code with opencv 2
import cv2
import numpy as np
capture = cv2.VideoCapture('http://admin:[email protected]:554/videoMain')
size = (int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)),int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)))
fourcc = cv2.cv.CV_FOURCC('M','J','P','G')
video = cv2.VideoWriter('d',fourcc, 1 ,size)
while (True):
ret, img = capture.read()
video.write(img)
cv2.imshow('forehead', img)
if(cv2.waitKey(27)!=-1):
break
capture.release()
cv2.destroyAllWindows()
I have error:
Traceback (most recent call last): File "D:\Zachs\Document\foccus\TA\KODE\source_code\mog tanpa save.py", line 15, in <module> cv2.imshow('forehead', img) error: C:\build\2_4_winpack-bindings-win64-vc14-static\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow
since this is windows, make sure, you have the opencv_ffmpeg_64.dll on the PATH.
(it contains all ipcam / video writing functionality)