Grab a webcam and create a time-lapse video

If you have a webcam, you can grab daily a shot and then create a 30-seconds time-lapse video with all the pictures.

Graph the shots

For example, let's assume your webcam url is http://webcam.url.here/cam.jpg. To download a photo every day at noon, edit your crontab with

crontab -e

and add a line like

0 12 * * *       wget http://webcam.url.here/cam.jpg -O /home/user/savedir/`date '+\%Y\%m\%d'`.jpg &> /dev/null

Save and check crontab with

crontab -l

Now list your directory after a few days: you should see a number of files (one per day) named 20140521.jpg, 20140522.jpg, etc.

If you want hourly shots, you can modify the command to

0 * * * *       wget http://webcam.url.here/cam.jpg -O /home/user/savedir/`date '+\%Y\%m\%d\%H'`.jpg &> /dev/null

Cron and crontab are powerful tools. Please refer to [1] for more details and tricks.

Create the video (one year after)

With mencoder you can easily combine multiple screenshots into an encoded or raw video file. Since we have 365 pictures (1 year), putting 12 frames per second (fps) will result in a video of about 30 seconds (360 / 30 ~= 12).

mencoder "mf://*.jpg" -mf fps=12:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=7000 -oac copy -o timelapse.avi

Now enjoy your time-lapse video and share it with your friends.

[1] http://www.pantz.org/software/cron/croninfo.html

notes/webcame-timelapse.txt · Last modified: 2014/09/16 10:54 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki