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.

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
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: debian
November 27th, 2007 at 6:10 pm
Hi,
I’ve used hasciicam in the past to get images (it can do jpegs as well!), maybe this helps.
Cheers,
Stefan.
November 27th, 2007 at 6:58 pm
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
November 27th, 2007 at 10:04 pm
This blog post might interest you….
http://gburt.blogspot.com/2007/11/one-laptop-per-photographer.html
November 28th, 2007 at 12:02 am
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
February 4th, 2008 at 6:20 pm
Is there a way to have more than one camera with CAMSERV?