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 :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