Timelapse photography

As I mentioned at the end of my last post I have been playing around with gphoto2 to create some time lapse videos of the assembly of one of my Christmas gifts.

I have played with making time lapse video before, when I set up my MMS CCTV system with motion I enabled a feature that creates a video from a sample image every 30 seconds. Motion uses the web cam (or other Video4Linux src) and all the web cams I had access to up at my folks are pretty low resolution so this wasn’t what I was looking for.

I did have my Canon 350D and the little point and shoot Canon A520 that lives on the end of my work bag so I thought I’d see what I could do with them. The 350D is 8 Megapixel and the A520 is 4 Megapixel so both will take a frame way bigger than 720p that I can crop down.

I had a bit of a look round and found an app called gphoto2 that claimed to be able to drive both cameras via the USB port to take images at a set interval. I plugged the 350D in and tried to get it to work but I kept getting the following error*:

*** Error ***
Sorry, your camera does not support generic capture
ERROR: Could not capture.
*** Error (-6: 'Unsupported operation') ***

So I swapped over to the A520 and things seamed to work fine. So I set it up on the tripod and fired off the following command:

[hardillb@bagend ~]$ gphoto2 --capture-image -I 120

This triggers the camera every 2 mins which I thought should be enough time to see some progress in each frame.

Apart from having to swap the batteries twice it all went rather well, I soon started to ignore the little beep from the camera as it took each shot. At the end I copied all the images off the SD card for processing. Each image started out at 2272×1704 so they would have been big enough to use in 1080p video but I decided to shrink them down to 720p.

The following little ImageMagik script resizes the images down and adds 2 black bars down the sides to pad it out to a full 16:9 720p frame size.

for x in `ls *.JPG`
   convert $x -resize 1280x720 -bordercolor black -border 160x0 resized/$x

The first bit -resize 1280×720 resized the original image down to 720 pixels high and the second bit -bordercolor black -border 160×0 adds on the 2 x 160 pixel wide black bars to pad the image up to the required 1280 pixels wide before writing a copy out to the resized directory.

And this mencoder line to stitch them together as a video with 2 frame per second so each second of video is equivalent to about 4 minutes of real time.

mencoder "mf://*.JPG" -mf fps=2 -o day1.avi -ovc lavc -lavcopts \

Here is a sample of the output

YouTube Preview Image

*I have since found this gphoto bug report that mentioned changing the camera’s USB mode from PTP mode to normal mode. After finding this setting on the camera I managed to get the 350D to work with gphoto2 as well.

Christmas Project

I’ve always been a fan of Lego*, Technic especially. As a kid I was lucky enough to get hold of a few different sets to build, some of them can still be found in my old room at home.

On Christmas morning I was lucky enough to unwrap one of these.

The kits have been getting more and more complex over the years this one comes with 4 volumes of assembly instructions

And enough parts to set up a shop.

So come Boxing day I set about putting it all together.

4 Hours on Day 1 and I managed to get through the first 2 sets of instructions
YouTube Preview Image

Day 2 finishing off
YouTube Preview Image

It was great fun putting it all together and seeing how the tech has moved on. The gear box in the middle of this model that makes it all work is amazing, with just one motor it drives the stabilizers and the crane jib arm.

The videos were made using gphoto2 hooked up to my old Canon Powershot A520 (I couldn’t get it to work with my 350D) to take a picture every 2mins. The images were then resized down to 720p and black bars added before being stitched together with mencoder. I’ll try and remember to do a post about the details later

* Yes that’s right Lego, not ‘Legos’ my American friends, it’s a trade mark and the singular is a Lego Brick. While we’re on the subject it’s Maths, not Math….