Five years later I have arrived at the point where I can make the time lapse movies I had been envisioning. Not all of that time (thankfully!) was spent working on this project. But it has not been as simple as it should have been. This page describes what I've been able to accomplish, and how I did it.
But I have to warn you first that I'm a Linux user, so to some of you everything here will have the look of doing it the hard way. Of course, I maintain that's the only way to learn anything; and I'm sure that you can do most of this stuff with other systems...
Unfortunately, time lapse is not the G1's forte. The G1 supports a proprietary USB protocol as well as a subset of PTP, but the nub of the problem is this: when remotely tripping the shutter via USB, you have no control over the parameters of the shot. Every shot is taken in Auto mode, and for a while I thought I would not even be able to override the flash!
But thanks to the fact that I was using gPhoto2, I was able to delve into the source code and get at least part of my job done. Besides turning off the flash, I had one other problem to overcome: the G1 only supports USB 1.0 and in many cases, time is of the essence. It was too limiting to have to perform a remote capture, download the captured image to the PC and then delete the image (so that I didn't have to buy huge Compact Flash cards). My solution was to modify canon.c in libgphoto2 2.1.6 to
These modifications are available as canon.c.diff. With them in place, I wrote a shell script (tlapse.g1) to control the time lapse process. The script expects two parameters: the number of images and the number of seconds between each image. In addition to using gphoto2 to take each image and sleeping the correct amount of time between each image, the script also:
The laptop battery considerations require a Linux kernel with the following options turned on:
And of course you need a system with /proc and /sys support which has been correctly configured for your hardware (I used 2.6.12.3).
With this script I have been able to get about 5 hours out of my Dell Inspiron 1100 laptop (the 94 WHr battery), which coincidentally is about what I get from my G1 battery with the LCD closed. Of course, I can really only do this with outdoor subjects, since the flash dramatically decreases the G1 battery lifetime. But what can I do with my time lapse images? Enter the Gimp!
gimp -i -b '(crop-size-sharp-curve "*.jpg" \
x-offset y-offset width height \
new-width new-height \
x-at-y0 x-at-y255)' '(gimp-quit 0)'
will crop all of the images with parameters x-offset, y-offset, width and height; scale all the images
to new-width and new-height; sharpen them with a parameter of 36, and adjust the level curve as in the
following example:
where x-at-y0 is the x coordinate at the left side of the slanted line (28 in this example) and x-at-y255 is the x coordinate at the right side of the slanted line (204 in this example). This is a simple-minded but effective way to maximize contrast and saturation without losing data.
The aspect ratios width/height and new-width/new-height should be the same. If you intend to eventually view your time lapse movie on a PC, typical values for new-width and new-height would be 640 and 480. If you intend to eventually burn the movie onto a DVD to watch on a regular television set, the values should be 704 and 480.
The Gimp script produces a new set of images with the prefix "ed." appended to the original file names, saving the original images in case you want to re-edit them.
So now we have a set of clean images; how do we make an mpeg movie?
dd if=/dev/zero bs=48000 count=$sec |
sox -t raw -r 48000 -u -b -c1 - -t wav -s -w -c2 -
to
but make sure the sound track is the correct length:sox soundtrack.wav -
(number of images * number of frames per image / 29.97) secondsThe mpeg output should be suitable for burning onto a DVD.
The script requires not only the MJPEGtools package and sox, but mplayer and a patched version of yuvscaler (which is part of MJPEGtools) as well. The patches are available from http://parallel.vub.ac.be/~johan/MpegStills/; I made a new mjpegtools source directory, applied the patches to yuvscaler, did a make and then copied the yuvscaler binary into my home binary directory as ssyuvscaler ("ss" for slide show). My script uses that binary to make multiple frames from each image.
The R1 is a wonderful camera. The electronic view finder and the zoom and manual focus rings make me feel like I'm using an SLR again after all these years away from my old Nikon FM. I love the zebra exposure display and the fact that auto-focus is available at the touch of a button even in manual focus mode. The 10 megapixel 3:2 aspect ratio sensor allows me to crop usable images of subjects which are too far away for the 120 mm zoom, and provides me with a more usable aspect ratio with no discernible purple fringing.
But it doesn't support time lapse! Sony only supports a minimal subset of PTP's capabilities, which don't include time lapse. After a little research, I found a web site which described how to hack into the Sony RM-VD1 remote control. Armed with an idea and a little courage, I entered the world of hardware design. Sort of...
The orange wire is common; the yellow wire controls "partial depression" of the release (which activates auto-focus and exposure setting) and the green wire controls shutter release. But the tabs on the switches which connect them to the circuit board are tiny, and it takes far more manual dexterity than I have to solder the wires without destroying the switch! Luckily, my old friend Gene Terrell came to my rescue and did the job for me. If you try it on your own, be very careful not to short the wire to the switch case, and clean up any solder threads that may fall onto the board.
But that isn't the end of the story. After some extensive testing, I found that I had about a 33% miss rate; the computer would do it's job but the shutter wouldn't release. I clearly had an intermittent short on one of the connections. Problem was, in trying to figure out which wire was shorting, the yellow wire broke off! Not wanting to bother Gene again, I made the valiant attempt and failed. So I went to plan B: remove the switch altogether, which gives you far more room in which to work. I learned the hard way that removing the switch is easy; you just pry up with a small knife blade; but don't do it until you remove all the solder from the switch tabs! It is possible (the voice of experience is speaking here) to tear the tabs off the board. In that event you have to scrape enough of the surface off to expose a run to solder to. I had to do that to connect the orange wire to the right side of C3:
Luckily, the tab for the green wire remained in place, and it turns out that for manual focus you don't need the yellow wire at all. And in time lapse you should always manual focus... Finally, I coated the connections with rubber cement to guard against future shorting.
On the USBmod3:
In addition, on the 4679:
The USBmod3 uses an FTDI FT232BM USB UART and so your Linux kernel will require support for the ftdi_sio module (USB_SERIAL_FTDI_SIO=m), which in turn requires USB Serial Converter support (USB_SERIAL=m) and "Prompt for development and/or incomplete code/drivers" (EXPERIMENTAL=y).
Because the transmit data is logically high voltage at idle, you must plug the box into the USB port of an operating PC before turning the camera on. Otherwise, the normally closed switch will be closed and the camera will take a picture as soon as the VD1 is plugged into the camera!
After a series of very successful tests, I soldered a 32 pin (machine pin) DIP socket (for the USBmod3) and a 16 pin socket (for the 4679) onto a 4.9" x 2.6" snap prototyping board, along with the capacitors, and completed the final circuit by soldering jumper wires as appropriate. I mounted everything in a plastic box, using grommets to secure the USB and VD1 cables in the holes I drilled for them:
I then modified the Canon time lapse script to
The new script is tlapse.r1. It obviously does nothing with the image files, as they are now stored on the camera until the time lapse series is finished. Then you can download them to your PC for processing using gphoto2 -R -P.
So how does it work? Like a charm!
©2006, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.
Please send comments or suggestions to the author.