从特定链接读取流 [英] Read stream from specific link

查看:116
本文介绍了从特定链接读取流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用OpenCV库从mjpeg读取流.更详细地讲,我需要阅读http://194.126.108.66:8887/.但是当我尝试用

I need to read stream from mjpeg with OpenCV library. In more details, I need to read http://194.126.108.66:8887/. But when I try to do it with

VideoCapture ipCam;
ipCam.open("http://194.126.108.66:8887/")

我收到错误icvOpenAvi_XINE(): Unable to initialize video driver.

我已经通过另一个指向mjpe​​g的链接测试了此代码- http://c-cam .uchicago.edu/mjpg/video.mjpg 它工作正常. 这2个链接之间有什么区别?以及如何阅读http://194.126.108.66:8887/?

I have tested this code with another link to mjpeg - http://c-cam.uchicago.edu/mjpg/video.mjpg It works fine. What is the difference between these 2 links? And how to read http://194.126.108.66:8887/?

推荐答案

OpenCV希望其VideoCapture参数具有文件名扩展名,即使并非总是必需的(例如您的情况).

OpenCV expects a filename extension for its VideoCapture argument, even though one isn't always necessary (like in your case).

您可以通过传入以mjpg扩展名结尾的虚拟参数来欺骗"它:

You can "trick" it by passing in a dummy parameter which ends in the mjpg extension:

ipCam.open("http://194.126.108.66:8887/?dummy=param.mjpg")

这在我的类似OpenCV Python案例中有效,祝您好运!

This worked in my similar OpenCV Python case, so good luck!

这篇关于从特定链接读取流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆