opencv 获取rtsp流媒体视频的实现方法
获取实时数据
import cv2
# user: admin
# pwd: 12345
# main: 主码流
# ip: 192.168.1.64
# Channels: 实时数据
# 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)
以上是 opencv 获取rtsp流媒体视频的实现方法 的全部内容, 来源链接: utcz.com/z/332573.html