Read stream from specific link

感情迁移 提交于 2019-12-03 15:19:55

问题


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/?


回答1:


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!




回答2:


This is worked for me with Mjpeg streamer and OpenCV

cap.open("http://192.168.1.206:8080/?action=stream?dummy=param.mjpg")


来源:https://stackoverflow.com/questions/14204185/read-stream-from-specific-link

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!