Time-lapse-video-with-your-webcam mini HOWTO

I bought me a cheapo webcam the other day and the first thing (meh… actually the second. The first thing I had to do was obviously getting this little piece of plastic working…) I wanted to do was making a time-lapse video of me working on my diploma thesis or something. With a little help from google and the friendly folks at debian-user-german I finally got it working.

snapshot.jpg

What you need: camserv, wget and mencoder.

Assuming you have your webcam working with v4l, camserv will provide snapshots of your cam via http://localhost:9192, so the following script will make a snapshot every second until you kill it:


#!/bin/sh

while [ 1 ]; do
    wget http://localhost:9192 -O `date +%s`.jpg -q
    sleep 1s
done

Let it run for several hours and then create the movie with the following script:


#!/bin/sh

mencoder "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell=yes:v4mv=yes

Hint: coding, juggling and even sleeping at your desk looks cool in time-lapse - eating or singing your favorite songs while listening to them does not :P

I recorded myself for ca 12 hours and the resulting video was like 130 megs large. The result looks pretty funny, but since there was a lot of the not-so-cool-looking eating and singing stuff in there, I’m afraid I can’t even show it to my closest friends ;)

Hint for users having problems getting proper images from camserv: I had to change max_frames value to 1 in the [socket] section of /etc/camserv/camserv.cfg to get proper single images via wget.

I find the camserv solution to get the images from the webcam rather suboptimal, has anyone a smarter solution?

NP: Gianna Nannini - Bello e impossibile

Tags:

5 Responses to “Time-lapse-video-with-your-webcam mini HOWTO”

  1. Stefa Potyra Says:

    Hi,

    I’ve used hasciicam in the past to get images (it can do jpegs as well!), maybe this helps.

    Cheers,
    Stefan.

  2. Jim Little Says:

    Since you have a V4L device you should check out motion, a nice little full featured utility that is well suited to time lapse, especially if you don’t want repeated pictures of the same static background (although it supports traditional timed snapshots as well.)

    http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide

    hth,

    Jim

  3. fatal Says:

    This blog post might interest you….
    http://gburt.blogspot.com/2007/11/one-laptop-per-photographer.html

  4. Michael Maclean Says:

    I’ve been playing with something similar, though I was trying to use GStreamer to pull the data off the camera. I gave up on that though, as it wasn’t very stable, and the picture on the webcam sucked. However, I found sequence mode on my N95, which worked quite well:
    http://www.youtube.com/watch?v=SWinBnZjqGA

  5. mackrackit Says:

    Is there a way to have more than one camera with CAMSERV?

Leave a Reply