How to Create Time-Lapse Movies with a Digital Photo Camera
Key Parameters: Time Compression, Duration, Size
This chapter introduces the most important parameters to keep in mind when talking about time-lapse movies. First of all, concerning the time:
When talking about thousands of images, storage size becomes important. So, when you want to make 1000 images and they should all fit onto a single 512Mb storage card, each image may occupy about half a mega byte maximum. Longer films require even smaller sizes. This may sound unrealistically small for today's cameras but since we're about to make a movie, high resolution is not what we're after. Hence:
It's generally best to take some shots and compute the number of images which fit on the storage medium by dividing the medium size by the image size. Digital cameras commonly also display this value, however sometimes you're out of luck: For example my camera can only display up to three digits and hence stops at 999. Furthermore, the reading is completely bogus if the storage medium contains images of different size.
Fixed vs. Free Exposure
Digital cameras commonly have a trigger button which can be pressed half-way down for for focusing and fixing the exposure and then completely down for actually taking the shot. There are basically two modes of operation when recording a time-lapse movie:
Generally, one should prefer the first method because the second one is prone to produce films with varying image brightness resulting in flickering films. The reason is that the camera will slightly change the exposure from shot to shot, especially when the lighting conditions change slowly as well. However, when taking a movie of a scene which will change its brightness considerably (e.g. a sunset) it may be better to use the second method because otherwise the film will get all black much too early. Further image processing prior to encoding is then recommended to remove the brightness flicker.
Powering: External Power Supply
Fortunately, the camera also has an external power plug requiring 6V. This works nicely, however there are two quirks one has to be aware of concerning this particular camera:
Triggering: Push the Button
Fortunately, my digital camera from Minolta has an external trigger connector using a simple 3-pin cable with both button states (half way down and completely pressed). Using a simple DVM (digital volt meter), it was easy to see that Minolta's external trigger buttons simply connect the pins 1/1+2 pin to the pin 3 when pressing half/full-way down. Furthermore, the camera is internally using 3.3V logic, so the trigger switch can easily be replaced by an electronically controlleld MOSFET.
Below is the circuit schematic of the trigger interface and a photo of its actual implementation. The 3-pin connector is plugged into the camera. Unfortunately, that trigger connector uses a proprietary plug which I was unable to find in standard electro-mechanical component catalogs. So, I built one myself from a 3-pin connector with 2mm spacing, which I removed from an old CD-ROM drive. After having cut away some of the plastic with a knife, it fitted nicely into the camera slot.
The switch S1 controls the operation of the external trigger interface: In the middle position, the external trigger is switched off and the camera operates (nearly) normally. In the lower position, the trigger is pressed half way down and the camera fixes exposure and focus. Repeatedly applying a 5V level at the TRIGGER input will cause the camera to repeatedly take a shot. This TRIGGER input is actually connected to an external interval trigger circuit (see next section). Finally, in the upper position, the external TRIGGER input can be used to take full shots (focus and exposure not fixed).
The firmware of the device has 3 operation modes:
The firmware for the ATMega8 is available here. You also need to program the fuses for external clock by the 16MHz crystal.
Some More Photos
Converting a Sequence of Frames Into a Video
MPlayer (available for Linux and Windows) is a great program for this purpose: It can play a series of JPEG images like a film with very good performance simply using the multi-file (mf) input:
mplayer "mf:///mountpoint/DSC0*.JPG" -loop 0 -fps 25
It can play a 640x480 pixel image series at 20 frames per second on a box from 2001! The -fps option specifies the frame rate and only needs to be specified for values other than 25.
In order to encode an AVI film from the image series, you can use the mencoder program bundeled with MPlayer. Here's an example:
mencoder -mf w=640:h=480:fps=25:type=jpeg -ovc lavc -lavcopts vcodec=mpeg4:vhq -o film.avi mf:///mountpoint/"DSC*.JPG"
This will encode an MPEG4 AVI which can be viewed again using MPlayer:
mplayer film.avi -fps 20
The player will default to the fps value specified upon encoding but using the -fps switch allows to override the setting from the AVI file. MPlayer/mencoder have a lot of additional command line switches; please refer to the official documentation.