Some time ago I started experimenting with timelapse videos. By no means I could consider myself a photographer. But with some simple commands and scripts, I was able to make some surprisingly nice videos.

This video spans from 02:30 till 05:58. So it was basically dark and I used a very slow shutter speed.

Download the original *.mkv-file

Creative Commons License

The commands and scripts

I use a Canon EOS 500D on a tripod, connected to the computer.

Tethered shooting

For thethered shooting, I use gphoto2 with following command:

$ gphoto2 --capture-image-and-download --interval 20 --filename image%5n.%C

You can adjust the interval for your specific needs.

Make it 16:9

The D500 makes images in 4752x3168, but I want my video to be 16:9. So I wrote a little bash-script for cropping my images to the desired format. This script utilizes imagemagick, so make shure you have it installed.

#!/usr/bin/bash

function process {
    echo "Processing $1"
    convert -crop 4752x2673 "$1" "./cropped/$1"
    rm "./cropped/${1%.*}"-1.jpg
    mv "./cropped/${1%.*}"-0.jpg "./cropped/$1"
}

if ! [ -d ./cropped ]; then
    mkdir ./cropped
fi

count=0
PID=()
for file in ./*; do
    if [ "$file" == "./cropped" ]; then
        continue
    fi
    process "$file" &
    PID+=($!)
    let count=count+1
    if (( count % 2 == 0 )); then
        wait "${PID[@]}"
        PID=()
    fi
done

This script creates a directory cropped and puts all the cropped images inside.

You could use mogrify for batch-cropping the images. But it's faster with the script.

As is, the script starts two background processes at a time. But you can change this line:

    if (( count % 2 == 0 )); then

to

    if (( count % 4 == 0 )); then

to make it four for example.

Deflickering

For the deflickering, I'm using this perl-script.

Conversion to video

And finally for the conversion into a video file, I use ffmpeg with following command:

$ ffmpeg -f image2 -i image%5d.jpg -vf scale=-1:1080 -qscale 1 output.mkv

-qscale can be a value from 1-31 (best-worst).

You can change the ending from .mkv to .mp4 or whatever suits you.

A newer video

This video spans from 03:03 till 15:47.

Download the original *.mkv-file

Creative Commons License