Setting up webcam exposure under linux

I had some problems with fswebcam to set the automatic exposure. The exact way how to enter certain parameters is not clear from the lacking documentation, but it works fine if you set parameters through another command line tool.

This is the script behind BirdCam:

#!/bin/bash

DATE=$(date +"%Y-%m-%d_%H%M")

v4l2-ctl -c exposure_auto=1
v4l2-ctl -c gamma=5
v4l2-ctl -c brightness=128
v4l2-ctl -c contrast=67
v4l2-ctl -c exposure_auto=2

fswebcam -c fswebcam.cfg /var/tmp/image.jpg
curl -T /var/tmp/image.jpg -u <username>:<password> ftp://<ftp-server address>/<directory>/$DATE.jpg

At least I thought so, but suddenly and without any intervention the exposure settings stopped working again. Everything was fine until 14:50 local time
2016-04-11_1250
but a minute later the camera captured this image and continued to do so…
2016-04-11_1251

Is this a problem of the particular webcam I am using? I don’t know.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.