title: Webcam stream and OpenCV - python
body: <p>I want to get the video stream from my webcam using python and OpenCV, for that task i've implemented this simple code:</p>
  
  <pre><code>import cv
  
  cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
  capture = cv.CaptureFromCAM(0)
  
  def repeat():
    frame = cv.QueryFrame(capture)
    cv.ShowImage("w1", frame)
  
  
  while True:
    repeat()
  </code></pre>
  
  <p>when i try to execute it, i get the following error:</p>
  
  <pre><code>andfoy@ubuntu:~/Python$ python camera.py
  VIDIOC_QUERYMENU: Argumento inválido   
  VIDIOC_QUERYMENU: Argumento inválido
  VIDIOC_QUERYMENU: Argumento inválido
  </code></pre>
  
  <p>I changed the following line as suggested by other posts:</p>
  
  <pre><code>capture = cv.CaptureFromCAM(0)
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>capture = cv.CaptureFromCAM(-1) 
  </code></pre>
  
  <p>but the error persists.</p>