Hic Sunt Dracones

DOF animation test

Posted on Wednesday, July 18, 2012
in Category Howto

Today I experimented with making a short animation and depth of field.


Since this was only a technical experiment I didn’t pay any attention on the physical setup of the scene, lighting, ‚Ķ I just put the first thing I found on my desk, mounted the camera on my tripod, connected it to the computer and started darktable. In tethering mode I started live view to see what I was doing, did some minor adjustment to the placement of the knife, set the camera to the widest aperture (f/1.8 in my case), set shutter speed and ISO. Then I focused on the tip of the knife and stepped through the focus range using the buttons in the live view module (small steps!), counting how often I had to click until I reached the other end of the knife. It turned out to be 45 clicks. I set the focus back on the tip, quit darktable and tried hard to not touch or even move anything.

Taking the shots

I didn’t use darktable to take the actual shots since I wanted to animate them. I used the gphoto2 command line tool with some minor shell scripting. This was what I used:

(for i in `seq 0 45`; do
    echo "capture-image-and-download"
    echo "set-config manualfocusdrive 4"
 done) | gphoto2 --shell

If I used capture-image instead of capture-image-and-download the whole process might have been a little faster. I will try that next time. In the end I had 46 CR2 files in my directory.

Post processing

I imported the folder with the pictures into darktable and opened the first of the sequence in darkroom mode. I adjusted the crop and lightness and added the monochrome and vignetting effects. Once I liked the result I switched back to lighttable mode, copied the history stack and applied it to all the other images. All I had to do now was setting the output size to 1280×720, select all images and hit export.

Assembling the video

Once I had the 46 files exported I used ffmpeg to generate the final video like this:

ffmpeg -f image2 -i img_%4d.jpg -r 15 -vcodec libtheora -vb 4096k \
       -acodec null dof_animation_test.ogv


Download for better quality.