RTSP 流和 OpenCV (Python) [英] RTSP stream and OpenCV (Python)
本文介绍了RTSP 流和 OpenCV (Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个通过 rtsp 协议和 h264 linux 驱动程序在 Linux 上流式传输的 IP 摄像机.我可以使用以下地址和端口在 VLC 中看到视频:
I have an IP camera streaming on Linux through rtsp protocol and h264 linux driver. I am able to see the video in VLC with the following address and port:
rtsp://192.168.1.2:8080/out.h264
但是,如果我尝试在 Python 2.7.5 (MacOS X 10.9) 中获取用于 OpenCV 处理的相同视频:
However if I try to get the same video for OpenCV processing in Python 2.7.5 (MacOS X 10.9):
import cv
video = cv.CaptureFromFile('rtsp://192.168.1.2:8080/out.h264')
我收到以下错误:
WARNING: Couldn't read movie file rtsp://192.168.1.2:8080/out.h264
这看起来很简单,但我一直坚持下去.谢谢.
It seems something rather simple, but I am stuck on it. Thanks.
推荐答案
这对我有用(使用 opencv 2.4.9):
this works for me (using opencv 2.4.9):
vcap = cv.VideoCapture("rtsp://192.168.1.2:8080/out.h264")
while(1):
ret, frame = vcap.read()
cv.imshow('VIDEO', frame)
cv.waitKey(1)
这篇关于RTSP 流和 OpenCV (Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文