我有一个RTSP流,我在VLC上测试过,它工作正常。现在我有了这个脚本,它试图分析流中的帧
import cv2
import os
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp"
vcap = cv2.VideoCapture("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", cv2.CAP_FFMPEG)
if vcap.isOpened():
while(1):
ret, frame = vcap.read()
print((ret, frame.size))
cv2.imshow('VIDEO', frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
else:
print('video cap is not opened')
它可以连接到流,但输出只是黑屏。以下是其他帖子建议的opencv构建信息:
Video I/O:
DC1394: NO
FFMPEG: YES
avcodec: YES (58.54.100)
avformat: YES (58.29.100)
avutil: YES (56.31.100)
swscale: YES (5.5.100)
avresample: YES (4.0.0)
GStreamer: NO
AVFoundation: YES
环境是MacOS、python3.6和opencv4.5.1
目前没有回答
相关问题 更多 >
编程相关推荐