先将手机下载一个ip摄像头app,打开后会显示ip摄像头http地址还有rstp摄像头url地址,如下图
记住这个地址,打开python
#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
import cv2
url = 'rtsp://admin:password@192.168.1.191:8554/live'
cap = cv2.VideoCapture(url)
while(cap.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
# Display the resulting frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
网友回复