How to Remote Control Your Camera with Darktable on Linux

20584

We’ve talked about Darktable before, because it is a wonderful advanced RAW photo editor and workflow manager. My current favorite feature is tethered shooting, which is connecting a camera to your computer and controlling it with Darktable. Obviously this is not very convenient for hiking or street photography, but for studio and tripod work it’s the bee’s knees. There are two scenarios where this might be useful to you.

If your camera has Live View, then you can control it from Darktable and preview and adjust images on your Linux PC. This makes Darktable a great tool for staged macro photography, astrophotography, portrait photography, and for getting the best composition and most accurate focus on long telephoto shots. Newer Canon and Nikon dSLRs come with Live View, and other brands are rolling it out as well. You know those glorious wildlife photos that look like the photographer was just a few feet away, and the critters were super-cooperative and held attractive poses? These are often made from stationary positions with a tethered camera and a long lens.

If your camera doesn’t support Live View but is still supported for tethered shooting in Darktable, then you have an easy and cheap way to do time-lapse photography without having to buy an expensive programmable remote control or other spendy gadget. Sure, buying spendy gadgets is fun, but it’s nice to have options.

Supported Cameras

Darktable uses gphoto2 as its backend, so you can consult their Remote controlling cameras guide to see if yours is supported. If your camera is not on the list you can run a few commands to see if works. When you install Darktable it should pull in the ghoto libraries automatically, but it may not install the userland tools, so look for a ghoto or ghoto2 package to get these. Connect your camera to your computer with its USB cable, make sure it is detected but unmounted, and run these commands. This first command outputs a more complete list of supported cameras:

$ env LANG=C gphoto2 --list-cameras

This tells you if ghoto sees your camera:

$ env LANG=C gphoto2 --auto-detect
Model                  Port                                            
----------------------------------
Canon EOS 7D          usb:003,011

Yay, it sees my Canon 7D. Now test which features are supported:

 
$ env LANG=C gphoto2 --port usb: --abilities
Abilities for camera             : Canon EOS 7D                                
Serial port support              : no
USB support                      : yes
Capture choices                  :
                                 : Image
                                 : Preview
Configuration support            : yes
Delete selected files on camera  : yes
Delete all files on camera       : no
File preview (thumbnail) support : yes
File upload support              : yes

‘Capture choices’ shows that both image previews (Live View) and capturing images are supported. (The other available options are audio capture and video capture, though the man page warns that video capture is not yet available.) For comparison, this is the output from an old Canon Rebel 400D:

$ env LANG=C gphoto2 --port usb: --abilities
Abilities for camera             : Canon EOS 400D (PTP mode)                   
Serial port support              : no
USB support                      : yes
Capture choices                  :
                                 : Image
Configuration support            : yes
Delete selected files on camera  : yes
Delete all files on camera       : no
File preview (thumbnail) support : yes
File upload support              : yes

Note the differences: the Rebel does not have Preview support, as it operates only in PTP (Picture Transfer Protocol) mode. PTP is an older protocol for transferring images from digital cameras. So it won’t have the Live View in Darktable, but you can still control exposure, shutter speed, and do time lapse and bracketed photographs. Images are automatically transferred to Darktable for instant review and editing.

Now test taking a picture and downloading it to your PC. This command copies it to your current working directory and deletes it from your camera’s storage card:

$ env LANG=C gphoto2 --port usb: --capture-image-and-download
New file is in location /capt0000.cr2 on the camera                            
Saving file as capt0000.cr2
Deleting file /capt0000.cr2 on the camera
Deleting 'capt0000.cr2' from folder '/'...

And you can test tethered shooting. Run this command and then press the shutter button on your camera:

$ env LANG=C gphoto2 --port usb: --capture-tethered
Waiting for events from camera. Press Ctrl-C to abort.                         
UNKNOWN PTP Property d105 changed
UNKNOWN PTP Property d108 changed
...
File capt0000.cr2 exists. Overwrite? [y|n] y                                   
Saving file as capt0000.cr2
Deleting 'capt0000.cr2' from folder '/'...
UNKNOWN Camera Status 0
UNKNOWN PTP Property d102 changed
...

It will emit a lot of “PTP Property”output, store the image in your current directory on your computer, and then wait for more input. Press ctrl+c to stop it. If any of the shooting commands don’t work, check your camera settings because it may be too close to an object to focus, or your room may be too dark, or it’s not set to shoot RAW. When your test succeeds, congratulations, you can do tethered shooting! Now you can be a command-line commando and stick with ghoto, or you can fire up Darktable. Follow me for a tour of Darktable.

Tethered Shooting in Darktable

With your camera still attached, open Darktable. Click “scan for devices”, and when it recognizes your camera click “tethered shoot” (figure 1).

fig 1 darktable

This should take you to the Tethering page, and if it doesn’t then find your own way there. Click the eyeball in the Live View dialogue (figure 2), and if the stars align and your camera is supported you’ll have a live preview in Darktable.

fig 2 darktable

Just for fun click the ‘capture image’ button, and voilà! Darktable takes a picture (figure 3).

fig 3 darktable

Darktable has an almost overwhelming wealth of features. Take a look in just the Live View dialogue: you can zoom, rotate, flip horizontally, focus, turn on focusing and composition guides, and overlay preview.

The ‘camera settings’ dialogue is where the real fun begins. Depending on which of your camera functions Darktable supports you can control aperture, ISO, white balance, shutter speed, and focusing modes. Toggle the eyeballs to preview the various settings on the selected image.

Time Lapse

Use the ‘camera control’ tab to set up time lapse shooting. Click the ‘delayed capture mode’ and ‘sequenced capture mode’ buttons, set the timer interval, and then the count, which is how many photos you want to shoot. In figure 4 it’s set to shoot 24 pictures at intervals of 60 seconds.

fig 4 darktable

For longer intervals it’s unlikely your camera battery will last, so you’ll need an AC adapter. Remember to take your camera out of power-save mode so it doesn’t turn itself off. You’ll also need to decide if you want to set exposure and focus manually, or leave automatic functions on for changing conditions.

You can also do bracketed shooting in Live View. Click the ‘bracketed capture mode’ button, set how many images you want to shoot on the ‘bracket’ line, and the ‘bkt. steps’ value. This is how many exposure steps you want between each shot, and your available values depend on your camera. Some cameras allow 1/3 EV (exposure value) steps, and some do not support fractional steps. 1 EV is one full stop.

Once you have captured your images you need to use the Lighttable and Darkroom tabs to edit and manage them. See A RAW Feast on the Linux Darktable to learn some of the basics, or consult the Darktable manual.