Time lapse photography with a Canon Powershot G2 on Linux

timelapse-test

This is something that’s sort of been bugging me for a while. Not that I really want to do a lot of time lapse photography, per se, but that I want to be able to tell my camera to take a bunch of pictures, say one every 15 seconds for a certain amount of time (which is essentially what time lapse photography is). Out of the box, my ancient PowerShot G2 doesn’t support this. There’s software that can do it for you, but most of it a) costs money and b) runs on Windows. Which is a problem since the only device I have that could potentially use this feature — e.g. something that is mobile — is my laptop, which runs Linux Mint. So, here’s the setup, what I needed was:

  • Remote capture software
  • …that supports automatic, timed images
  • …from an old Canon Powershot
  • …that runs on Linux

Too much to ask? Actually, no.

Google is your friend

The first thing I found — after hitting several photography forums and finding various Windows apps — was Canon Capture. It hits the nail on the head, but indicates that it might not work with older Powershot cameras, including the G3. I figured the chances it would work with my G2 were pretty slim. But it also referenced gPhoto, so I took a look at that.

gPhoto is pretty much everything I could hope for with the small exception that gtkam — which says it’s a “graphical front-end for gphoto” in the documentation doesn’t actually have all the controls available of the commandline interface. It’s really just a memory card browser, which isn’t what I wanted. When I did a apt-cache search gphoto I also found Entangle which is pretty awesome. It lets you remotely capture the camera from your computer — everything you can do on the camera (and then some), you can do inside the app, including take a picture and automatically download it to your computer instead of the camera’s memory card. However, it still falls short of letting you take a bunch of pictures over a period of time, you can trigger the shutter, but you can’t automate that.

Back to gphoto

Finally, I did some more Googling and found this tutorial which uses gphoto’s commandline interface which is really robust. He used a command like this to take a bunch of shots, but acknowledged that your mileage may vary with regard to specific settings and features, whether they are enabled or controllable from gphoto (not all are):

gphoto2 --set-config beep=0 --set-config flashmode=0 --set-config resolution=3 -I 20 -F 3150 --capture-image-and-download --filename "%Y%m%d%H%M%S.jpg"

Well there were a couple things with that that didn’t work. First of all the resolution on the G2 said it wasn’t configurable. And the filename was saving everything as December 31, 1969. But I found that the filename is getting renamed anyway, so I could just drop that and the resolution setting. After some tweaks, this is what I came up with:

gphoto2 --set-config beep=0 --set-config flashmode=0 -I 20 -F 10 --capture-image-and-download

The -I is how many seconds before each snap and the -F is how many pictures to take. This worked great, but I didn’t want to have to enter in a bunch of code and remember all the parameters every time I wanted to do this. So I wrote a bash script.

bashing my head into the keyboard

Bash scripting is not my strong suit. To the uninitiated, bash is the command line language of unix-like operating systems, and a bash script is something that will execute a bunch of stuff on the command line. But you might want to do things like add variables or get user input, so you’d write a script that could do it. I wanted my script to ask how often to shoot and how many shots to take and then start the process. I had to do some research to refresh my memory on how to take user input, but once I did, the script was simple and effective.

The script

#!/bin/bash
echo "How frequent do you want the images (seconds)?"
read seconds

echo "How many images?"
read number

gphoto2 --set-config beep=0 --set-config flashmode=0 -I $seconds -F $number --capture-image-and-download

Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.