title: OpenCV VideoCapture cannot open URL
body: <p>I am trying to open my cam that streams mjpeg.  I am able to access it from my browser</p>
  
  <pre><code>VideoCapture cap;
  string url = "http://192.168.0.121:8080/?action=stream&amp;x.mjpg";
  cap.open(url);
  if (!cap.isOpened()){
      cout &lt;&lt; "Failed to Open stream" &lt;&lt; endl;
      exit(1);
  }
  </code></pre>
  
  <p>This code works on my ubuntu desktop.  When I cross compile and put it in my raspberry pi clone called nanopi it fails with Failed to Open stream.</p>
  
  <p>I am able to open a USB camera in nanopi but not urls.</p>
  
  <p>I tried doing an strace and I saw this</p>
  
  <pre><code>open("http://192.168.0.121:8080/?action=stream&amp;x.mjpeg", O_RDONLY) = -1 ENOENT (No such file or directory)
  fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(249, 0), ...}) = 0
  ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f6e000
  write(1, "Failed to Open stream\n", 22Failed to Open stream) = 22
  exit_group(1)                           = ?
  +++ exited with 1 +++
  </code></pre>
  
  <blockquote>
    <p>open("<a href="http://192.168.0.121:8080/?action=stream&amp;x.mjpeg" rel="nofollow noreferrer">http://192.168.0.121:8080/?action=stream&amp;x.mjpeg</a>", O_RDONLY) = -1 ENOENT (No such file or directory)</p>
  </blockquote>
  
  <p>Is it seeing it as a file path instead of a URL?</p>
  
  <p>Please let me know what I can do.</p>