獲取實時數(shù)據(jù)
import cv2
# user: admin
# pwd: 12345
# main: 主碼流
# ip: 192.168.1.64
# Channels: 實時數(shù)據(jù)
# 1: 通道
cap = cv2.VideoCapture("rtsp://admin:12345@192.168.1.64/main/Channels/1")
print (cap.isOpened())
while cap.isOpened():
success,frame = cap.read()
cv2.imshow("frame",frame)
cv2.waitKey(1)
獲取回放
import cv2
# user: admin
# pwd: 12345
# main: 主碼流
# ip: 192.168.1.64
# tracks: 回放
# 1: 通道
# time: 開始時間和結束時間的范圍
time='starttime=20180613t172206z&endtime=20180613t172230z'
cap = cv2.VideoCapture("rtsp://admin:12345@192.168.1.64:554/main/tracks/1?" + time)
print (cap.isOpened())
while cap.isOpened():
ret,frame = cap.read()
cv2.imshow("frame",frame)
cv2.waitKey(1)
|