从特定链接读取流(Read stream from specific link)

编程入门 行业动态 更新时间:2024-10-28 14:33:48
从特定链接读取流(Read stream from specific link)

我需要使用OpenCV库从mjpeg读取流。 更多细节,我需要阅读http://194.126.108.66:8887/ 。 但是当我尝试用它时

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

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

我已经使用另一个链接mjpeg测试了这段代码 - http://c-cam.uchicago.edu/mjpg/video.mjpg它运行正常。 这两个链接有什么区别? 以及如何阅读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/")

I get the error icvOpenAvi_XINE(): Unable to initialize video driver.

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参数的文件扩展名,即使并非总是需要(如你的情况)。

您可以通过传入以mjpg扩展名结尾的伪参数来“欺骗”它:

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

这适用于我类似的OpenCV Python案例,祝你好运!

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

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")

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

更多推荐

本文发布于:2023-07-31 06:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1341864.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:链接   Read   stream   specific   link

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!