Time-Lapse with Single-Board Computers and USB webcams

Note: This article is a blurb. Help expand it.



In this tutorial you will be shown how to capture images for time-lapse videos using you single-board computer. This tutorial should apply to most of single-board computers running some flavour of Linux, since most Linux distributions are very similar (hard-core Linux users will gasp at this statement, but may never need to read a tutorial like this).


You will require a single-board computer and a simple USB webcam. Most USB webcams should work, since Linux has general drivers. If your webcam should not work you may have to do additional searching or pick up a different webcam. You can even find some at the dollar store.


I will be using apt-get to install some packages, so make sure that it works on your machine. Also, make sure that you have previously run sudo apt-get update to download a list of the most recent Software and sudo apt-get upgrade to download the most recent versions of the packages that are installed.

Capturing Single Images

  1. Plug in your webcam into one of the USB ports on your system.
  2. You need to check that your webcam was detected in a terminal window.
    1. You can use lsusb to list all the usb devices that are connected.
    2. You can run ls -l /dev/video* to list the cameras connected to your computer.

  3. Next you should install fswebcam by typing sudo apt-get install fswebcam and then confirm by pressing [Y].
  4. You might want to create a folder to store the images in. From a terminal window type mkdir Images to create a folder.
  5. type cd Images to change the current directory to the Images folder you just created.
  6. You can simply run fswebcam image1.jpg and the program will capture an image with some default settings and resolution and save it under image1.jpg.
    • Check that an image has been saved by typing ls to list all the files in the folder. You can view this image by opening it. You must be using a graphical connection though (lxde or direct monitor connection)

  7. You will note that there is an annoying banner as well as that the resolution is small. Take a look at all the options at the manual page.
  8. To determine the types of resolutions that the webcam supports with the help of the previous lsusb command. You will need the device number from your webcam (004 in my case in 01webcam_usb_tut.png). Then run lsusb -s 004 -v | egrep "Width|Height", which will then return the width and heigh combinations for the usb webcam

    • I will be using 1280 x 720.
  9. Run the following command: fswebcam -r 1280x720 --no-banner --no-info -S 5 test1.jpg which will do the following
    • capture an image named test1.jpg
    • with 1280x720 resolution
    • not show the banner and when it was captured
    • will also skip the first 5 images (may be desirable, since some webcams sometimes screw up the first image or so)

Capturing Multiple Images

Coming soon.