Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Created May 13, 2009 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wizardishungry/111265 to your computer and use it in GitHub Desktop.
Save wizardishungry/111265 to your computer and use it in GitHub Desktop.
#!/bin/sh
#short circuit if screensaver is running
/usr/sbin/lsof /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine && exit
CAPTURE="/opt/local/bin/isightcapture -t jpg"
cd $HOME/Documents/captures
D1=`date +%y%m%d/%H`
D2=`date +%y%m%d.%H%M%S`
# If the date directory does not exist, create it
if [ ! -d $D1 ] ; then
mkdir -p $D1
fi
# Construct the filename and path and capture a pic
FN="$D1/$D2.jpg"
$CAPTURE $FN
# Make a symlinked image of the last photo taken
if [ -h 'last.jpg' ] ; then
rm last.jpg
fi
ln -s $FN last.jpg
#!/bin/sh
COUNTER=0;
DIR=$HOME/Documents/captures
rm $DIR/series/*.jpg
for i in `find $DIR -name '*.jpg'` ;
do
#Write the filename to be friendly with ffmpeg's odd filename input
FILENAME=`printf '%03d.jpg' $COUNTER`
cp $i $DIR/series/$FILENAME
let COUNTER=COUNTER+1;
done
name="$DIR/videos/timelapse-overall.mp4"
nice /opt/local/bin/ffmpeg -y -r 20 -b 64k -i $DIR/series/%3d.jpg $name
#!/bin/sh
COUNTER=0;
DIR=$HOME/Documents/captures
rm $DIR/series/*.jpg
for i in `find $DIR -newerBt '1 day ago' -name '*.jpg'` ;
do
#Write the filename to be friendly with ffmpeg's odd filename input
FILENAME=`printf '%03d.jpg' $COUNTER`
cp $i $DIR/series/$FILENAME
let COUNTER=COUNTER+1;
done
name="$DIR/videos/timelapse-`date +%Y-%m-%d`.mp4"
nice /opt/local/bin/ffmpeg -y -r 20 -b 64k -i $DIR/series/%3d.jpg $name
ln -sf $name $DIR/videos/latest.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment