I need to connect to ip camera using Python. I am trying to do it like this:
import cv2
if __name__ == "__main__":
cv2.namedWindow("original")
cap = cv2.VideoCapture("<URL>")
while True:
flag, img = cap.read()
try:
cv2.imshow("original", img)
except:
cap.release()
raise
ch = cv2.waitKey(5)
if ch == 27:
break
cap.release()
cv2.destroyAllWindows()
I do not have direct access to the camera.
I have IP, port, username, password.
Model is Dahua DH-XVR4116HS-X
.
I can't find the correct url.
I have tried rtsp://<username>:<password>@<ip>:<port>/cam/realmonitor?channel=<channelNo>&subtype=<typeNo>
format but didn't get a result.
Do I need to enable multicasting?