Creating time lapse videos with mencoder

In the last post I wrote about the intervalometer I was using to create time lapse videos but I forgot to share how I’m making these videos from the camera files.

There are lots of tools you can use for mounting a time lapse, like Adobe Premiere or Final Cut, but there is also some more simple yet effective ways to do so, using the open source mencoder utility.

The first you will need is to create a text file with all the filenames for the photos you want to use as frames. On a linux box you can use ls -1tr > frames.txt (warning: the first parameter is a “one” not a “l”). This will create a file frames.txt with all files on the current directory, one per line, ordered by date taken. We will use this file to tell mencoder which files to use to create the video.

Next thing is to execute mencoder to create the video.

$ mencoder -nosound -ovc lavc -lavcopts \
vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 \
-vf scale=1920:1080 -mf type=jpeg:fps=20 \
mf://@frames.txt -o time-lapse.avi

With this command we are asking mencoder to pick all the photos from frames.txt and make a full HD video from them at 20 frames per second, you can adjust the fps or the quality of the video by modifying the fps and vqscale parameters respectively.

Here you can see a demo created as explained above, these are me and a friend doing some clean up in my bedroom after doing some work.


Arduino intervalometer

These days I’ve been on holidays to make some progress on a personal project I have with a friend. We are trying to make a camera dolly to record time lapse videos with our DSLR cameras. The project is powered by an Arduino board, but as my experience with electronics is null, so I decided to make a little test project first as an introduction.

The result is a very simple intervalometer, built with a few components, a potenciometer to adjust the time between shots, an optoisolator to trigger a Canon camera by cable and an IR led to trigger a Nikon camera.
The schematic is the following.

And here is the source code running on the Arduino. I should rewrite it to not make use of the delay function.

#include "NikonRemote.h"

const int potPin = A0;
const int ledPin = 13;
const int irPin = 8;
const int jackPin = 12;

// config values
const int minDelay = 100;
const int blinkLength = 150;
const int canonPulseLength = 40;

NikonRemote camera(irPin);

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(jackPin, OUTPUT);

void loop() { 
  int val = (analogRead(potPin) * 20) - blinkLength;
  if (val < minDelay) {
    val = minDelay;
  Serial.print("Analog read: ");
  Serial.println(val, DEC);


void snap() {
  // blink status led
  digitalWrite(ledPin, HIGH);
  // snap nikon
  // snap canon
  digitalWrite(jackPin, HIGH);
  digitalWrite(jackPin, LOW);
  // end blink
  delay(blinkLength - canonPulseLength);
  digitalWrite(ledPin, LOW);