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屋!
查看全文