Creating a timelapse in Linux

Hello,

I’ve written a couple of scripts for making timelapses in Linux. It’s fairly simple stuff;

Create a screenshot every 15th second by running the following script in a terminal;


#!/bin/bash

# Takes a screenshot of my second monitor every 15 seconds
# Only have one monitor? Drop the -crop part ...

mkdir ~/img

while [ 1 ]; do
# Uncomment the line below if you only want timelapse of your second monitor, and both monitors are 1680x1050 big.
# import -window root -crop 1680x1050+1680+0 ~/img/LD21-$(date +%y%m%d-%H%M%S).jpg

import -window root ~/img/LD21-$(date +%y%m%d-%H%M%S).jpg
sleep 15
done

(The script is interrupted by pressing CTRL+C)

Then encoding the images can be done using mencoder, like this;

mencoder mf://*.jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

If you want audio, add ‘-audiofile somefile.mp3’.

Hurray!

Tags: howto, timelapse