Time Lapse Video using CubieTruck and Nikon D200

Today it was whole lot fun exploring the possibilities with Raspberry Pi and DSLR for taking time lapse video. Latter I moved from Raspberry Pi to CubieTruck so that I can attach hard drive for large storage capacity. I found a small command line utility gphoto which can be used as remote control for a DSLR. I can use the utility to click a photo and stream the picture to the Pi.

The version I found on the apt-get was little old so I had to compile my own version. Then you can play around with the gphoto command to play around.

sudo su
cd /root
apt-get install -y libltdl-dev libusb-dev libexif-dev libpopt-dev libgd2-xpm libgd2-xpm-dev libxml2-dev ffmpeg
mkdir gphoto2
cd gphoto2/
wget http://ftp.de.debian.org/debian/pool/main/libu/libusbx/libusbx_1.0.11.orig.tar.bz2
tar xjvf libusbx_1.0.11.orig.tar.bz2
cd libusbx
cd libusbx-1.0.11/
./configure 
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/libgphoto/2.5.2/libgphoto2-2.5.2.tar.bz2
tar xjf libgphoto2-2.5.2.tar.bz2
cd libgphoto2-2.5.2
./configure 
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/gphoto/2.5.2/gphoto2-2.5.2.tar.gz
tar xzvf gphoto2-2.5.2.tar.gz
cd gphoto2-2.5.2
./configure 
make
make install
cd ..
ldconfig
cd /root
rm -rf gphoto2/

EDIT: Forgot to mention about the cronjob

#!/bin/sh
filecount=$(ls -l //cdn.imthi.com/mnt/storage/timeLapse/*.jpg |grep -v '/$'| wc -l)
for count in 1 2 3 4 5 6
do
filecount=$(($filecount + 1))
filename=$(printf "frame_%09d.jpg" $filecount)
/usr/local/bin/gphoto2 --set-config autofocusdrive=1 --capture-image-and-download --force-overwrite --filename=/mnt/storage/timeLapse/$filename
sleep 7
done

Last but not the least to make the images into a movie

ffmpeg -f image2 -i frame_%09d.jpg time-lapse.mp4

It was fun I hope you will enjoy doing it 😉

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle