Using a DSLR

Assuming camera is supported with gphoto2:

#!/bin/bash
while (true); do
        gphoto2 --capture-image-and-download &
        sleep 60
done

or perhaps only --capture-image to take a photo and save to internal media (but not transfer to PC).

Using a Webcam

If you've a Webcam that supports Linux UVC, you can use ffmpeg w/ the device directly. E.g.:

MJPEG

# qmin indicates best frame quality (1 is best)
# qmax indicates worst frame quality
ffmpeg -f video4linux2 -s 1600x900 -r 5 -i /dev/video0 -vcodec mjpeg -qmin 2 -qmax 5 `time-stamp`.avi

XviD

ffmpeg -f video4linux2 -s 1600x900 -r 5 -i /dev/video0 -vcodec mpeg4 -qmin 2 -qmax 5 `time-stamp`.avi

Lossless H.264

# `locate ffpreset` to see x264 presets
# http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/#comment-14952
* order of bitrate: ultrafast, fast, medium, slow, slower, max
ffmpeg -f video4linux2 -s 1600x900 -r 5 -i /dev/video0 -vcodec libx264 -vpre lossless_fast -threads 0 `time-stamp`.avi


CategoryCheatSheet