DSLR stop motion bash script

January 2nd, 2011

My wife got a new camera about 6 or 7 months ago.  A Nikon d700 fancy smancy camera which she is using for her business.  Thus, I inherited her old Canon Rebel xsi.  The idea of using it for animation came to mind and rattled in my brain for a few months.   I searched the internet for any information about using digital cameras for stop motion.  Being that I prefer to work in Linux, I avoided trying out any windows software.  Although Dragon Stop Motion does sound like a good program for Windows.  For Linux I was stuck with Gphoto2 to interact with my digital camera.

Gphoto2 works really well for controlling digital cameras from your PC.  You can get files from your flash card and set it to capture a picture at intervals to do some time-lapse type stuff.  They are even trying to get movie recording working for the newer DSLRs.  But I was looking at it for animation.  Apparently stop motion requires some special lenses if you want to avoid flickering light.  The flickering light comes from the aperture being reset between each capture (it does this so that you can look through the viewfinder).  This means you have to find a lenses with a manual aperture.  But what I found out while testing Gphoto was that if you capture multiple previews with the –capture-preview option the aperture stays put.  This sounds great for the flickering issue ,plus taking thousands of shots (its animation, you need thousands of frames) wears out a digital camera’s aperture, too.  The only downside is that capture-preview has a lower quality than your camera is capable of (an 848×560 jpeg for my xsi).  So, I won’t be shooting in HD but its still pretty good.

Anyway, I spent a few nights trying to write a bash script that would use Gphoto to capture previews and name to files in sequence according to the number of the last captured preview.  Here it is:

#!/bin/sh
if [ -e preview.jpg ]
then rm preview.jpg
fi
if [ -e 0001.jpg ]
then
last_file_sequence_number=$(ls *.jpg | tail -1 | cut -c 1-4)
N=”$(echo $last_file_sequence_number | sed ‘s/0*//’)”
N=$(($N+1))
new_file_sequence_number=`printf “%04d\n” $N`
echo “Capturing frame $new_file_sequence_number”
gphoto2 –capture-preview –filename=$new_file_sequence_number.%C
else
gphoto2 –capture-preview –filename=0001.%C
echo “Capturing first frame 0001″
fi

Make sure you have Gphoto working correctly before you run it. I’m thinking maybe I should add a way to open the image after the capture to see it.  Plus I am going to need to get an AC adapter for my camera if I actually want to animate something.

Here is my first stop motion test using the script:


I think the shadow from my hand fell into frame a couple times. I’ll have to be more careful when I shoot again.

Inkscape Animation Extension

September 14th, 2010

I have been working all week on an extension for Inkscape to import a series of pencil sketch frames into layers which I can then ink and paint in Inkscape. I am also working on an extension to output those inked layers into a series of frames. I usually create my frames in Pencil and wanted a better way to ink them. So I started coding. Python coding is brand new to me. I mostly used bash scripting before now.

My input plugin was based on the Hello World example extension. I have this extension working but I’d like to iron it out. Plus Inkscape wasn’t made to handle hundreds of bitmap images.

My output plugin is being based partly on Chris McCormick’s GIFanimate extension and mostly on the Gimp XCF layers extension.

I have a working version.  You can download it at my project page.  I’d like to add some features but I think I’m gonna get back to animating for a bit and test out my extension.

Splashpage update.

August 24th, 2010

I finally figured out how to insert a video into an svg/xml document that will play in firefox when you mouseover it.  It might work in other browsers.  But the <video> tag is rather new in html. 

I’ve been working on some 11 Second Club stuff between the new baby whining and the toddler rampaging around the house.  I enjoy animating in 2D.  Too bad its not a popular form of animation these days.

New Splash Page

July 10th, 2010

I’ve been working on a new splash page for my website.  I’ve been trying some new stuff.  I still want to add to it, but I’m still learning how to code stuff in svg.  I added a page for my demo reel, but I still don’t have it ready to put up.  We have a new baby here, so I’ve been kinda busy lately.

Noah Nokia

March 2nd, 2010

I'm on the phone, Dad.

Christmas 2009

February 5th, 2010

Noah ChristmasNoah Curious

11 Second Club January

February 1st, 2010

This was my entry for the 11 Second Club in January. I wish I had more time to work on it before the month ended. At least I am learning a few things about 2D animation. 1

Updating my blog

January 9th, 2009

I finally got around to upgrading this blog to the latest version of wordpress.  I’ve been meaning to do it for years. I also have plans to add some kind of photo viewer to display photos of my family and maybe some videos too.

We’ve had a good holiday season and my son, Noah, has had surgery to correct his problem.  He has been the happiest baby I’ve ever known.  He recovered quickly and has only had a few problems since.  His surgeon says he should get better as he grows bigger.  We are hoping he’s right and that we’ll soon have a happy healthy baby.

As for my animation aspirations, I’ve been rather lax in my training.  My projects have been set aside and my desk has been such a mess.  I am trying to get myself organized but I fear as soon as I do we will be moving again.  This apartment is just not working out for us.

Anyway, I hope to get some pictures up soon and maybe some artwork as well.  Like some of the illustrations I did recently for a book.

Noah and I

September 8th, 2008

Nate and Noah

Here’s my little cowboy. Growing bigger everyday.

Noah Patrick Jent

August 13th, 2008

It has been a rough couple of weeks for my wife and I. Little Noah was born on Friday August 1 after 3 days of my wife being induced. He was a big healthy looking baby.

But by Sunday morning he still had not pooped. This was a problem that had to be diagnosed at the Children’s Medical Center. After a week of being separated and my wife being totally stressed out. We were finally told that he has Hirschsprung’s disease like I do. He did finally poop that Sunday afternoon and he seems to be normal and healthy now. They will likely do the surgery when he is a bit older. Hopefully it all goes well and he can live a normal life like I have.