Assemble images to webm timelapse video

The first thing you want to make a timelapse video is a time ordered list of images. Most cameras and camera-apps for smartphones will output a list like this:


Since we want 1920×1080 images and since avconv requires an ordered list with sequential numbers, we’ll use a small script to go over the files and crop and rename them:


mkdir 1920 2>/dev/null


for IMG in *.jpg ; do
        NEW=$(printf "FRAME_%05d.jpg" $count)
        convert -crop 1920x1080+0+0 -gravity center $IMG 1920/$NEW

You may want to change the convert -crop settings to get better results and/or resize/resample the image before cropping.

The next step will assemble the images into a webm video:

CPUS=$(( $(grep bogo /proc/cpuinfo |wc -l) - 1 ))
avconv -i 1920/FRAME_%05d.jpg -threads $CPUS -s 1920x1080 -preset libvpx-1080p -b 4800k -pass 1 -an -f webm -y "timelapse.webm"
avconv -i 1920/FRAME_%05d.jpg -threads $CPUS -preset libvpx-1080p -b 4800k -pass 2 -an -f webm -y "timelapse.webm"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

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