title: How to view video stream in OpenCV2 python
body: <p>I'm starting to play with Opencv. I am using the python bindings for opencv2 on Linux. I wrote a quick test program but it seems to hang indefinitely.</p>
  
  <pre><code>import cv2
  
  weblink = "http://continuous-video-stream-here"
  cv2.namedWindow("video")
  
  vid = cv2.VideoCapture(weblink)
  key = -1
  
  while (key &lt; 0):
      success, img = vid.read()
      cv2.imshow("video", img)
  </code></pre>
  
  <p>But it hangs on this output:</p>
  
  <pre><code>(video:14388): GStreamer-CRITICAL **: gst_caps_unref: assertion `caps != NULL' failed
  </code></pre>
  
  <p>I have also tried reading from urllib2:</p>
  
  <pre><code>vid = cv2.VideoCapture(urllib2.urlopen(weblink).read())
  </code></pre>
  
  <p>But that didn't work either.</p>
  
  <p>I am using Opencv 2.4.2, ffmpeg-0.11.2</p>
  
  <p><em>EDIT</em>: The video feed uses realplayer to display the video over http in the browser. </p>