很简单的一个代码,但首先安装python环境。
然后安装,cv2,
pip install opencv-python
国内源
pip install -i https://mirrors.aliyun.com/pypi/simple/ opencv-python
然后,就可以运行,
import cv2
url = "rtsp://admin:tjn12345@192.168.0.64/Streaming/Channels/0"
cap = cv2.VideoCapture(url)
ret, frame = cap.read()
while ret:
ret, frame = cap.read()
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
cap.release()