python opencv教程rtsp server,使用Opencv和python获取RTSP流

I know this could be the 100th question of this kind, but I dug up google and everything, and I could not find anything working.

I need to get an RTSP stream with opencv in python, and I'm out of ideas.

Here's what I tried so far:

Tried to stream with ffserver and ffmpeg but even when I got it working, I could see the stream only in the browser with very high latency, and not working in opencv

Tried to stream directly to udp with ffmpeg but again, no luck

Tried this script, but all I got was corrupted and unusable images.

Any ideas? I'm running on Mac OSX Sierra, I have compiled OpenCV 3.2.0 with ffmpeg support and I'm using Python 2.7.

My cam is a Sricam SP09 and my RTSP url is the following:

rtsp://973704:888888@192.168.1.78:554/onvif1

解决方案

I had the same problem.

You might be able to solve it with some additional codes.

import os

os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp"

vcap = cv2.VideoCapture("rtsp://[IP_CAM_ADDRESS]", cv2.CAP_FFMPEG)

Hope to be helpful to somebody.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值