How I Make "HD" Time-Lapse Video

Some time in 2008 I found myself buying cilantro and basil seedlings at the farmers' market in San Francisco, and happily planting them in a large box outside my window.

Being the technology person I am, of course I wasn't happy to simply leave the plants to grow by themselves - that wouldn't be nerdy enough; something technology-related needed to be added to this project, if for nothing else to justify it to nerdier peers.

To achieve nerd enlightenment, I felt the need to make a time-lapse video of my plants' progress - ideally, capturing them growing like weeds and thus producing toppings for pasta, naan and other food.

While the plants ultimately did not fare anywhere near as well as hoped thanks to voracious caterpillars, I can safely say I learned some good things on the quest to make HD time-lapse video from still photos.

First Attempt: Hacking Hardware + Software

Pentax OptioS, modified for time-lapse photography

Modifying a Pentax OptioS for remote shutter trigger, and an external power supply. (Yes, it was ugly. Yes, it worked, for a time. Yes, it eventually broke - when my neighbour watered it!)

My first attempt at getting a camera to take a photo at a regular interval was experimental, and ugly: I needed an external power supply, and I wanted a software feature that would allow a photo every N seconds, but this camera from 2003 didn't have this - and I didn't want to buy any special Pentax-branded (and priced) 3.5V power supplies. A Radio Shack visit later found me with some wiring and solder, a solid-state relay and a universal power supply which fit the bill.

I was able to get some half-decent cilantro and basil videos out of this thing (at resolutions up to 1600x1200), but then the camera died when it was accidentally watered along with the rest of the garden by my neighbour. This was not an issue given this was a sacrificial, unused 5-year-old camera I'd been keeping just for this experimental type of project; this simply gave me an excuse to upgrade to something a little more modern.

For the software end of things, I was using an ancient DOS program I'd written in .. Ready for this? .. QuickBasic 4.5 under DOS, compiled to an .EXE, which would basically do low-level outportb calls to 378h (the parallel port), setting one bit high (thus +5V) which would trigger the solid-state relay and thus close the circuit, taking a photo. In a ridiculously-roundabout way, it worked. For nostalgic purposes, you can check out a video of the original parallel port program I wrote back in 1998, which I modified for this experiment.

Making Time-Lapses, The Easier Way

Rather than hacking around with hardware, I highly recommend you go the software route; either via USB control, or "bootable" memory card.

Get a camera supporting automation and external power.

Messing around with wires and solder isn't my forte and my solution was quite unreliable, so I was looking for a moderately-priced camera that either could be controlled using the "remote shutter" feature with software over USB, or something that was compatible with the quite-excellent CHDK (Canon Hack Development Kit), which allows similar camera automation. At first I was looking for USB control, but stumbled upon CHDK and some reading quickly showed that this was the solution I was looking for. CHDK runs on the camera via a memory card you make "bootable" like you would a floppy disk, and it provides extended functionality, menus etc. on top of your camera's standard system. It is a temporary firmware replacement running only while the special card is in use, and does not overwrite your camera's default firmware. CHDK also runs user scripts written in a form of BASIC, which allows for simple camera commands along the lines of "10: take picture; 20: sleep 60; 30: goto 10", and so on.

I ended up getting a Canon SX100IS, which was new at the time and supported CHDK as well as remote shutter and other control over USB. Depending on your needs, you could use a fancier Canon or a different brand that supports USB control. Feature support varies by manufacturer, so I suggest careful research before making a purchase if going the USB route.

Get a tripod, and an external power supply.

Given time lapses can take hours or even days if you're adventurous, you will need a stable surface (or a tripod) and an endless power supply for your camera. Many cameras have ports for external power (typically +3.5 or +5V DC); if you are careful and know what the correct polarity is, you can go cheap and buy a universal power supply which should be able to match the power requirements of your camera rather than buying a name-brand one from the manufacturer. Make sure you don't mis-match the polarity or voltage though, or you may toast your equipment. Don't say I didn't warn you.

Set up your "intervalometer".

Whether built-in to the firmware, via software like CHDK, over USB or a hardware hack, you will need to get something to have the effect of pressing the shutter button once every N seconds for you. I tried some programs that did remote control over USB with the Canon at first, but ended up using CHDK with the "Ultra Intervalometer" script because then everything was run completely on the camera, and the only external requirement was a power source. It also seemed to be more reliable.

The Ultra Intervalometer user script (written in BASIC) allows you to specify the interval (time between photos) in 10ths of a second, seconds and minutes. You can also specify a delay before the first photo is taken, a maximum (or infinite) number of photos to take, and so on.

Installing CHDK on your memory card

CHDK running on a Canon SD1000, by Flickr user shannonpatrick17

CHDK running on a Canon SD1000, by Flickr user shannonpatrick17.

Setting up CHDK can be a little tricky at first, but once learned it's easy to re-do. On Windows, the process is approximately:

  1. Download the version of CHDK appropriate for your camera model and firmware revision (eg. Canon SX100IS Rev. 1.00c)
  2. Format a memory card (max 4GB) using CardTricks on Windows.
  3. Make the memory card "bootable" (using CardTricks.)
  4. Click "CHDK -> card" in CardTricks, and select the appropriate CHDK .zip you downloaded earlier.
  5. Download and place the Ultra Intervalometer .bas script in the appropriate CHDK scripts directory on the memory card.
  6. Done! Now write-protect the memory card with the little plastic slider, and CHDK will run when your camera starts (you can still delete files using the camera's native OS, etc.) If no write protection is present, the card's boot sector will be overwritten and it will return to being a normal memory card when the camera is started up.
  7. Double-check the write-protect switch on the card. No, really; I've had to repeat the above process multiple times because of forgetting, and then having CHDK nuked when booting the camera.
  8. More recent versions of CHDK seem to have RAW mode enabled by default, which means huge files and additional processing time. I consider this to be pretty insane for time-lapse purposes given the number of photos involved, so I recommend turning it off.

For a guide with general instructions including those for Linux and OS X, see CHDK: Installing to SD Memory Card. Whether using CardTricks or not, check the FAQ/guide if it doesn't work the first time (it probably won't, it didn't for me.) Read over the instructions again, and then re-try the steps; verify your camera model and firmware (and that it's supported), and try downloading a different build if you still encounter problems.

CHDK has many features including RAW on cameras that don't normally have it, extended options for photos and video shooting and so on. Refer to the CHDK wiki for documentation and examples, some more sparse than others.

Set up your scene.

Place your camera on your surface (or tripod), connect the power supply and adjust your camera settings for the scene. Generally full manual mode is the best, though you may want to use aperture priority (aV) if you are trying to maintain a more consistent exposure from light to dark.

If you are using CHDK, you can load the intervalometer script and configure its parameters (one frame per 60 seconds, for example), then bring up the Ultra Intervalometer script so it's running and hit the shutter button to start the script. If using USB/remote capture, the process is the same but automated via computer software.

Be patient.

Unless you're shooting something that moves "relatively" quickly, it's best to let a time-lapse go for several hours in order to capture enough motion to be interesting. Plants are generally in the 8-hour-plus category; landscapes and scenery can be interesting even with an hour's worth of time, if shot with lower intervals (ie., more frames.)

Making Your Time-Lapse Movie From Still Images

After your lesson(s) looking at camera models, trying USB, learning CHDK, formatting memory cards, playing with intervalometer scripts and other frustrations, you (hopefully) finally have a memory card with hundreds, or even thousands of still images in sequence. Now, to assemble them into a movie.

QuickTime Pro is your friend.

Despite that it's less-cool from the hacker's point of view (and costs $20-something), I use QuickTime Pro to make movies from still images because it's very simple and allows for quick edits and resizing before exporting a final movie. The process is easy: Within QuickTime, choose "open image sequence..." from the file menu, point it at the first image in your directory of images, choose 30 fps for the framerate, and within seconds you'll have a very high-resoution movie to export after editing. I typically export at 1024x768 or 1280x1024 for 4:3 aspect ratio, or 720p for 16:9 content, manually resizing the video playback window to the desired resolution before exporting. (Note that unless you have a "moon computer" you probably won't be able to play back this movie in real-time, given your "uncompressed" movie could easily have a 100+ MB/sec data rate.) There is probably free software that can assemble a movie from individual frames like QuickTime Pro, but I didn't really look into it.

Export, and enjoy.

Exporting time-lapse video shouldn't be any different than regular video, except that you may have a constant amount of high motion if you are shooting landscape scenery with clouds, light-to-dark transitions or other elements with lots of detail that are constantly moving. In this case, you may want to bump up the bitrate and fiddle with keyframes. My knowledge with video compression and efficiency ends about here, so I'll leave it at that.

Related links