Nav:  [home][misc][timelapse] > [tech]
 
Go:  [index] [tech]

How to Create Time-Lapse Movies with a Digital Photo Camera

This describes how the time-lapse movies were actually made. Check out the intro page first.

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:

  • The time compression factor (TCF) specifies how much faster than in real life the time-lapse movie appears. It depends on two things: The film's frame rate (which is normally 25 frames per second), and the time interval used when taking the photos. One can easily recognize that the TCF is simply the product of the above properties, so e.g. taking a photo every 4 seconds and encoding it into a film with 25 frames per second results in a time compression factor of 100.
  • Similarly, the film duration can be computed by dividing the number of photos by the frame rate. For example, if you take 1000 photos and play them at a frame rate of 25 per second, the total duration of the movie will be just 40 seconds. At a TCF of 100, this corresponds to slightly more than 1 hour.

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:

  • Forget about your 7.5 mega-pixels! Decrease the image size to 800x600 or even 640x480 pixels. If you have enough storage, or the number of images is low enough, you can also use up to 1024x768. It's rarely useful to go beyond that.
  • Decrease image quality. Don't use TIFF or fine but instead revert to JPEG images with standard or normal quality. This is still sufficient for making a movie; you will recognize that individual frames in the final movie commonly still have worse quality (as long as you specify encoding parameters which result in reasonable overall film file sizes).

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:

  • You keep the exposure and the focus fixed across images. This should generally be the preferred method and can be achieved by always keeping the button pressed at least half way down. Of course, this is done electronically, see below.
  • You take a complete shot each image allowing the exposure to be re-computed every time. This can be done by releasing the button completely between images.

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

Camera body with plugs [10kb]
[click to enlarge: 33kb JPG]

Nowadays, digital cameras normally have operation times of several hours using one battery pack. Mine is a bit older, uses 4 mignon-type cells, and draws a current of about 1A (at least 650mA when the display is switched off). So, for time-lapse movies covering several hours, an external power connector is mandatory.

The image on the left shows the camera body mounted on a tripod with the power supply plug connected (left, with capacitor) as well as the self-made trigger plug (right plug, see also next section).

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:

  • Of course I use a stabilized laboratory power supply tuned to 6V. But still, the camera will not even switch on unless you connect a large buffering capacitor (1000uF or more) directly next to the plug.
  • Everything seems to work down to 5V. However, it turns out that below 6V, the camera will trigger a complete shot even when the button is only half-way pressed. This is presumably due to current spikes caused by focusing and can probably be remedied using an even larger capacitor.

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.

Camera trigger interface board [9kb]
[click to enlarge: 23kb JPG]

Minolta camera trigger interface schematic [3kb]

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).

Interval Trigger

Interval timer board [4kb]
[click to enlarge: 57kb JPG]

The actual interval trigger is a small self-designed circuit board applying a 4-digit LED display and an ATMega8 micro controller. Basically, it's my 4-digit measurment device: The TRIGGER pins 1 and 2 are connected to the AUX IO pins 2 and 1, respectively. The pushbutton on the (left bottom in the image) is connected to AUX IO pins 3. The image on the left shows the board displaying image 395 having been taken. The decimal point LED of the last digit flashes shortly every second. (Right cable in image: To trigger interface; bottom cable: current supply.)

The firmware of the device has 3 operation modes:

  1. When switched on, the interval time in seconds is displayed. By pressing the pushbutton, one can choose between a range of predefined times (2,3,4,5,8,10,15,16,20,30,32,60,64 seconds). When the desired time is selected, the button has to be pressed for more than a second to advance into the next mode:
  2. In this mode, the button press time can be selected. The default value is 1.9 seconds and is normally sufficient. My particular camera does not take a shot if the button is not pressed long enough until focusing is completed and hence some longer times can be selected as a fallback. (Times longer than the interval time are not available.) Again pressing the button for more than a second will put the device into the actual recording mode.
  3. In recording mode, an image is triggered at the specified interval. This mode displays the number of images already taken. (Of course, an image will only be recorded if the switch S1 in the trigger interface is not in the middle position.) By pressing the pushbutton for some time one can get back into mode 1.

The firmware for the ATMega8 is available here. You also need to program the fuses for external clock by the 16MHz crystal.

Source: 4DMD-firmware-r1.0.bin   [2kb raw binary]
Version:Rev 1.0   (2007-03-08)
Author:Wolfgang Wieser   (report bugs here)
License:free for non-commercial, non-military use
Requires:(tool to flash an ATMega8)

Some More Photos

Photo of supply and interval trigger on roof [21kb]
[click to enlarge: 213kb JPG]

Photo of camera on the root of the physics department of the LMU [9kb]
[click to enlarge: 124kb JPG]

Interval trigger, interface board and power supply on top of the central "tower" of the LMU building in Munich. Camera on a tripod on the roof of the department of physics of the LMU in Munich.

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.


[home] [site map] [Impressum] [Datenschutz/privacy policy]
Valid HTML 4.01!
Copyright © 2007 by Wolfgang Wieser
Last modified: 2007-11-06 00:52:32