I have had a webcam operating for several months. It takes photos every 30 minutes and sends them to this site. I also store the original photos on my local desktop. I now have serveral thousand images so it seems like a natural next step would be to make them into a movie.

Here is my first attempt. It shows daily life on the farm from February to April 2016.

This is how I made the movie:

Pre-requisites

The following steps assume:

  • that you have a set of images that are named so they can be sorted in chronological order. If you use ISO 8601 date format then you’ve got no problems;

  • you have imagemagick installed on a linux operating system.

I used the instructions on this page (but fixed a small error or two).

Method

  1. Copy (rather than move) the files to a temporary directory. Do this because the filenames and filesizes will be changed. The code below assumes you have done this already.

  2. Rename the files into ascending numerical order.

  3. Resize the photos to avoid creating the world’s biggest video file.

  4. (optional) Add transitional frames to soften the changes in scene from frame to frame. I tried to do this but when I used more than a few frames, the process took up too much memory and the OS killed it. It produced nice effects for my shorter test run, so I’ll try to work out how to fix this.

  5. Stitch the frames together and name the output file.

Here is the code to carry out these steps:

# This assumes that you are using a terminal and your
# present working directory contains just the images
# you want to make into the movie.
#
# Create a working directory
mkdir working

# copy the image files, sort them and rename them in the format '0001.jpg' and so on.
find -name "*.jpg" | sort | gawk 'BEGIN{a=1}{printf "cp %s working/%04d.jpg\n", $0, a++}' | bash

# This step destoys the original files.
# Alter the image dimensions (in pixels) to suit your needs.
mogrify -resize 800X600 working/*.jpg

# This didn't work for me (see above)
convert working/*.jpg -delay 10 -morph 10 working/%05d-morph.jpg

# Make the movie
#  -r frame rate = 25 per second
#  -i the names of the input files In my case it was 'working/%04d.jpg'
#  -qscale quality level (1=best -- 32 = worst)
#    Lower quality = smaller movie file size
#  farmfilm.mp4 is the name of the output file.
ffmpeg -r 25  -i working/%05d-morph.jpg -qscale 8 farmfilm.mp4

If the movie works, copy the .mp4 file to a permanent local and delete your temporary directory. Make sure you haven’t accidentally moved your originals instead of copying them (See step 1).

In the movie, the red dot that is visble in the darker frames is caused by the camera’s indicator LED reflecting from the glass window. I have since turned this option off.

Did you see the bird fly past?