title: OpenCV MJPG Streamer not working
body: <p>I am trying to open a video stream with the OpenCV VideoCapture class in OpenCV version 3.1, Windows x64. On my raspberry pi I have mjpg_streamer running, and I can see the output through <a href="http://192.168.1.245:8080/?action=stream" rel="nofollow noreferrer">http://192.168.1.245:8080/?action=stream</a> , however when I try to open the video stream in OpenCV, it fails to open the stream.</p>
  
  <p>This is the code I'm using to debug that apparently worked for someone else who was having connection issues also.</p>
  
  <pre><code>#include &lt;opencv2\core.hpp&gt;
  #include &lt;opencv2\videoio.hpp&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      cv::VideoCapture vcap;
      cv::Mat raw_image;
  
      const string videoStreamAddress = "http://192.168.1.245:8080/?action=stream";
  
      if (!vcap.open(videoStreamAddress))
      {
  
          cout &lt;&lt; "Error opening video stream" &lt;&lt; endl;
          system("pause");
          return -1;
      }
  
      cout &lt;&lt; "Stream opened" &lt;&lt; endl;
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>Online, people are saying that OpenCV must have the video extension in the link. I have tried to use the extension trick that other people are using, like <a href="http://192.168.1.245:8080/?action=stream?dummy=param.mjpg" rel="nofollow noreferrer">http://192.168.1.245:8080/?action=stream?dummy=param.mjpg</a>, <a href="http://192.168.1.245:8080/?action=stream&amp;type=.mjpg" rel="nofollow noreferrer">http://192.168.1.245:8080/?action=stream&amp;type=.mjpg</a>, &amp;channel=0&amp;.mjpg, and &amp;type=.mjpeg but that is not working. Also, I have enabled ffmpeg in cmake and built with it. It seems like at this point it works for other people, and there doesn't seem to be anything else on the topic. What is the solution to this?</p>