Need to take photos ever few minutes for the sake of creating a timelapse. I destroyed everything updating a graphics driver and learned my lesson for not keeping a lab notebooks for my side project. This is my second go around.
I have a logitech C920 HD webcam. After some sluthing on google I found the right utility package to use to control the webcam.
sudo apt-get install v4l-utils
You can find which devices exist by using
v4l2-ctl --list-devices
Once that's installed it's useful to list the controls available to my webcam
v4l2-ctl -d /dev/video0 --list-ctrls
brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128
contrast 0x00980901 (int) : min=0 max=255 step=1 default=128 value=128
saturation 0x00980902 (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gain 0x00980913 (int) : min=0 max=255 step=1 default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2
white_balance_temperature 0x0098091a (int) : min=2000 max=6500 step=1 default=4000 value=4000 flags=inactive
sharpness 0x0098091b (int) : min=0 max=255 step=1 default=128 value=128
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
exposure_absolute 0x009a0902 (int) : min=3 max=2047 step=1 default=250 value=250 flags=inactive
exposure_auto_priority 0x009a0903 (bool) : default=0 value=1
pan_absolute 0x009a0908 (int) : min=-36000 max=36000 step=3600 default=0 value=0
tilt_absolute 0x009a0909 (int) : min=-36000 max=36000 step=3600 default=0 value=0
focus_absolute 0x009a090a (int) : min=0 max=250 step=5 default=0 value=0 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
zoom_absolute 0x009a090d (int) : min=100 max=500 step=1 default=100 value=100
I found that turning off all automatic utilities otherwise you get a weird flicker in the video as the camera constantly autofocuses
v4l2-ctl -d /dev/video0 --set-ctrl=exposure_auto=1
v4l2-ctl -d /dev/video0 --set-ctrl=focus_auto=0
Then I needed a thing to take photos with the camera
ffmpeg seemed to be the best candidate for that. You can take a photo of a single still with this command
ffmpeg -f video4linux2 -s 1920x1080 -i /dev/video0 -vframes 1 test.jpg
So if we combined that with a cron job well, we have a timelapse capability on our hands don't we!
Oh but wait I need to be able to time stamp each file name... How can I do that? Well we can use Bash's ability to interpolate in comination with the built in bash date
utility
$(date "-%Y-%m-%d_%H:%M:%S")-snapshot
And this is a useful tutorial for stitching together the stills http://www.netinstructions.com/creating-automatic-timelapses-with-webcams-on-linux/