Stop motion animation

This animation is a test using a DV camera and a little script I wrote to control it.

Basically I wanted to be able to use my DV camera to take single frames, which could then be rolled into a finished video.

A little shell script follows, which does just what I need, using dvgrab and ffplay.

#!/bin/bash
# script to take a shot with DV camera

count=1
calldir=`pwd`
wrapdir='wraps'

function help_me
{
echo -e "HELP!"
echo -e "h - shows this help!"
echo -e "s - takes a shot"
echo -e "p - shows a preview of all the shots so far"
echo -e "w - writes the shots to a wrap file in ./$wrapdir"
echo -e "q - quits\n"
}

help_me

if [ ! -d $calldir/$wrapdir ] ; then
mkdir $calldir/$wrapdir || exit
fi

while [ "$ans" != "q" ]
do

echo -e "I'm waiting for instructions:(h|s|p|w|q)"
read -sn1 ans

if [ "$ans" = "h" ] ; then

help_me

elif [ "$ans" = "s" ] ; then

echo -e "grabbing a frame"
dvgrab --every 25 --duration 1 2>/dev/null
echo -e "grabbed $count\n\a"

count=$(($count+1))

elif [ "$ans" = "p" ] ; then

echo -e "Preview"
cat $calldir/*.dv | ffplay -
echo -e "Preview ended"

elif [ "$ans" = "w" ] ; then

echo -e "Wrapping up"
echo -e "Creating in in $calldir/$wrapdir"
echo -e "Enter filename for wrap:"

read filename

cd $calldir/$wrapdir || exit

cat $calldir/*.dv | dvgrab -stdin --format dv2 $filename 2>/dev/null

clear

# reset count after wrapping file
count=1

echo -e "Tidying up last wrap: deleting $calldir/*.dv"
rm $calldir/*.dv

echo -e "Preview wrap"
ffplay $calldir/$wrapdir/$filename*
echo -e "Preview wrap ended"

cd $calldir || exit

elif [ "$ans" = "q" ] ; then

echo -e "Quitting...\n"
exit

fi

done

Leave a comment