title: Setting Frame Rate on Logitech C210 webcam in C++ on Raspberry pi using v4l2
body: <p>I've got some webcams connected to my raspberry pi and am capturing images using OpenCV. However, even thought the cameras aren't moving, the images look kind of shaky. When I only run one camera this doesn't seem to happen so I'm thinking that it is a USB bandwidth issue thing. To reduce the bandwidth I'm starting out by trying to reduce the frame rate. Logitech C210 should be able to support frame rates of 5,10,15,20,25, and 30 fps.</p>
  
  <p>So I've been looking through the documentation on v4l2 since it appears that OpenCV uses this library anyway (although not very well). I've been using <code>v4l2_ioctl()</code> without problem to set camera controls. For some reason I have not been able to set the frame rate in a similar manner. Here is what I am doing following along the documentation <a href="http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html#parm-flags" rel="nofollow">here</a>:.</p>
  
  <pre><code>int descriptor = v4l2_open("/dev/video0", O_RDWR);
  v4l2_captureparm s;
  s.capability = V4L2_CAP_TIMEPERFRAME;
  s.timeperframe.numerator = 1;
  s.timeperframe.denominator = 5;
  if( v4l2_ioctl(descriptor, VIDIOC_S_PARM, &amp;s) !=0 ) 
  {
       cout&lt;&lt; "Failed to set frame rate "&lt;&lt;endl;
  }
  </code></pre>
  
  <p>I have no problems compiling, but I do get the couted error message indicating that the value has not successfully been set. </p>
  
  <p>Does anyone have an idea what I am doing wrong?</p>
  
  <p>Thanks in advance!</p>