1import cv2
2
3#print("Before URL")
4cap = cv2.VideoCapture('rtsp://admin:123456@192.168.1.216/H264?ch=1&subtype=0')
5#print("After URL")
6
7while True:
8
9 #print('About to start the Read command')
10 ret, frame = cap.read()
11 #print('About to show frame of Video.')
12 cv2.imshow("Capturing",frame)
13 #print('Running..')
14
15 if cv2.waitKey(1) & 0xFF == ord('q'):
16 break
17
18cap.release()
19cv2.destroyAllWindows()
1import cv2
2import numpy as np
3
4cap = cv2.VideoCapture(0)
5
6while(True):
7 ret, frame = cap.read()
8 cv2.imshow('frame',frame)
9 if cv2.waitKey(1) & 0xFF == ord('q'):
10 break
11
12cap.release()
13cv2.destroyAllWindows()