Time lapse photography is a method of creating films by taking a series of photos with constant interval, for example one minute, and then combining them together as a movie.
I was sick a while ago. The first day I didn’t do much but sleep and read comics. The second day, the most exciting event of the day was to see how the frost flowers in the window melted. In the morning it was about -27C but then during the day the sun heated the window so much that the frost flowers melted away. Seeing new flowers in the window the following morning, I decided to try to make a time lapse video of how they melt.
Code to control the camera
First, I grapped a piece of old camera control code from one of my old posts. gphoto2 is able to control my Nikon D70 DSLR over USB: tell it to take a shot, download the image and so on. So this is the code I ended up with:
for i in {1..400};
do
echo "#################"
echo "Photo $i"
date
echo "#################"
#capture a photo
gphoto2 --capture-image &
sleep 60
gphoto2 --get-file=$i
done
This takes a picture, waits for 60 seconds, downloads the previous picture, and starts it all over again. As it does this for 400 times, it should give me almost 7 hours of shooting time.
Notes
- Nikon D70, on manual mode, 1/800s, F7.1, manual focus
- Sigma F2.8 105mm macro lens
- D70 needs to be set to PTP mode and also had to set the camera to store on the memory card (see gphoto2 –set-config-something..)
- Make sure you have enough space on the card! If this is a problem, you can also remove files from the camera using gphoto2 -D …
- Make sure you start with a full battery. I did. It went empty. Tried to replace it – only to find out that also my backup battery was empty. Fail.
- Don’t move the camera. Don’t touch it!
- During the shooting, I had this one-liner running in the folder where the images were downloaded:
while true; do gwenview -s . && sleep 300; pkill gwenview; doneto see some of the images on the screen all the time. It’d be nice if gwenview would integrate new files in the slideshow folder to the running slideshow, but as this didn’t work, I needed to kill and restart it every now and then to see the latest results.
Converting JPG files to video
It sure wasn’t easy to figure out a decent way to do this. But this is how I did it:
- Create a 3008x2000px (same as my camera resolution) jpg to use as title of the movie
- Save 4 copies of it (title1.jpg title2.jpg etc..)
- Create 1 second title clip:
mencoder -nosound mf://*.jpeg -mf w=1504:h=1000:type=jpg:fps=8 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2160000:v4mv -o title.avi - Create the ‘main film’:
mencoder -nosound mf://*.JPG -mf w=1504:h=1000:type=jpg:fps=8 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2160000:v4mv -o movie.avi - Join these together:
avimerge -o final.avi -i title.avi title.avi title.avi movie.avi title.avi title.avi
Result
Have you tried it? Show me your results!
Related posts:
- Time lapse photography: More frost flowers! A new time lapse movie every day! Not quite, but...
- Time lapse #2: View from window Being still sick & stuck inside, I took the effort...
- Time lapse: Cleaning roof from snow We cleaned the roof of the garage at my parents’...
- Winter / Talvi Some snowy shots from the weekend from Eastern Finland. I...
- Snow&Ice ...

Very nice job! I was impressed on the arrangements and coding you made to reach the goal!
To get your next time lapse video look even better I would propose some modifications to the set-up. I think they could be worth trying. Firstly, why don’t you use some extra lighting inside the room to highlight the flowers constantly. Secondly, try to find one-coloured dark background for the flowers to better bring them up. Good luck, man!
Thanks :) The coding part wasn’t that hard (except generating the video – I’m still not happy with the compressed quality.. )..
I now have two more sets running that will die when the cameras (Nikon D70 & Nikon L10) run out of battery.. I definitely need to figure out a way to power the cameras with external power sources..
Pingback: Weekly Digest for February 20th | Risto H. Kurppa
Pingback: Time lapse #2: View from window | Risto H. Kurppa
Pingback: Time lapse photography: More frost flowers! | Risto H. Kurppa
Someone posted this to Reddit: http://www.reddit.com/r/linux/comments/fop0n/time_lapse_photography_in_linux_gphoto2/