How can I change webcam properties that OpenCV doesn't support but v4l2 API does?
<p>I'm using <strong>OpenCV 3.1</strong> and <strong>Python 2.7</strong> to capture video frames from my webcam, <strong>Logitech C270</strong>. I'm also using <strong>video4linux2(v4l2)</strong> to set the properties of my camera but this led to a few problems. My OS is <strong>Ubuntu 15.04</strong>.</p>

<p>The specific property I'm trying to change is <strong>absolute_exposure</strong>.</p>

<p>I'm able to change it manually using <strong>v4l2</strong> API via terminal, with the command <code>v4l2-ctl --set-ctrl exposure_absolute=40</code>, and it works nice but I need to write a script for this task.</p>

<p>Using OpenCV's <code>set(cv2.CAP_PROP_EXPOSURE, 20)</code> leads to "VIDEOIO ERROR: V4L: Property Exposure(15) not supported by device". I'm sure the webcam supports the change of this property since it's possible to do so using v4l2, then I assume the problem is with OpenCV's wrapper.</p>

<p>I also tried to use <strong>subprocess</strong> lib to send a terminal command and change the property using <strong>v4l2</strong>. The command is <code>subprocess.call('v4l2-ctl --device=/dev/video0 --set-ctrl exposure_absolute=20', shell=True)</code>.</p>

<p>The result is that exposure_absolute changes but it isn't applied to my current video capture. Image 1 shows the result after setting the property via script. Image 2 shows the result after setting the same property via terminal, with the same video capture active.</p>

<p><a href="http://i.stack.imgur.com/G94J6.png" rel="nofollow">Setting exposure_absolute via script</a> (image 1)</p>

<p><a href="http://i.stack.imgur.com/W0uMY.png" rel="nofollow">Setting exposure_absolute via terminal</a> (image 2)</p>

<p>Image 2 was taken right after image 1, the highlighted line is the same of image 1.</p>

<p>Am I doing something wrong on the subprocess call? Or how can I make the change of this property using a script?</p>

<p>Also, why <code>cv2.VideoCapture(id)</code> resets the camera properties, it's no use changing them before running the script, and is it possible to stop that?</p>

<p><strong>__________________________________________________</strong></p>

<p><strong>Edit:</strong> I maybe found a workaround for this problem. The subprocess call is indeed right, I just had to use <code>cv2.read()</code> once before changing the properties, apparently the first <code>cv2.read()</code> is where the camera properties are reset. I still don't know how to stop it from automatically resetting webcam's properties though.</p>