How to Make a Timelapse

Timelapses are videos where many successive pictures of a subject are put together, ordered by date.

The first one I remember seeing was that guy who took pictures of the front of his home, every day, for a couple of years. There is another very cool one of a guy who travels around china, always taking pictures of his face. Those videos of crossings in large towns, where you see everybody moving very fast, are also a sort of time lapse.

Besides having a very cool effect, time-lapses can show in a pleasant and interesting way how something was made. One example are the games of Ludum Dare (a challenge to make a game from scratch in 48 hours), that are often followed by a time lapse of how the game was made.

I wanted to add a timelapse video of my own entry to LD, and at first I thought it would be a very complicated affair. Turns out it was really simple.

First thing you need to do is to set up your system to take regular pictures of your desktop. You can do this with a single command using xwd, imagemagick and date:

xwd -root | convert xwd:- -resize 800x800 `date +%d%H%M%S.png`

This will create a screenshot of whatever is on your screen, and name it “dayhourminutesecond.png”. The 800×800 part resizes the screenshot so that the largest size will be 800 pixels (you don’t want full-sized screenshots, unless you don’t care about running out of disk space).

Now you need to set up your system to run the above line every minute. I tried to get CRON to do that, but it * * * * * wouldn’t work for some reason, so I wrote a shell script and left it running in the background:

#/bin/bash
while true; do
i=`date +%d%H%M%S.png`
xwd -root | convert xwd:- -resize 800x800 $i
sleep 1m
done

No magic here.

After you are done with your screenshots, you need to put them together in a video. You do that using mencoder. I took this line from the Cenolan blog (originally for web cam time lapsing):

% ls -1tr > files.txt
% mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o test.avi -mf type=png:fps=10 mf://@files.txt

Note the bolded part. You need to change these lines if you save your pictures as something other than pngs, and if you want a different speed to your timelapse. I find that anything under 10 fps gets a bit too slow. The script runs surprisingly fast for 3.000 pictures.

Now go make some time lapses! Here is mine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.