3

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

SSteve
  • 10,550
  • 5
  • 46
  • 72
Sergei Gorjunov
  • 1,789
  • 1
  • 14
  • 22
  • possible duplicate of [OpenCV with Network Cameras](http://stackoverflow.com/questions/712998/opencv-with-network-cameras) – Rui Marques Sep 13 '13 at 09:43

2 Answers2

4

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!

errollw
  • 176
  • 2
  • 14
1

This is worked for me with Mjpeg streamer and OpenCV

cap.open("http://192.168.1.206:8080/?action=stream?dummy=param.mjpg")
Haris
  • 13,645
  • 12
  • 90
  • 121