Skip to content

Instantly share code, notes, and snippets.

@booyaa
Last active December 19, 2015 17:28
Show Gist options
  • Save booyaa/5991347 to your computer and use it in GitHub Desktop.
Save booyaa/5991347 to your computer and use it in GitHub Desktop.
Time lapsing your hackday

timelapsing your hackday

why?

why not? timelapsing your hackday is a great way to record memories in an unobtrusive manner. you could also spot patterns such as when you got stuck on a particular hard problem or when you were just plan bored.

please feel free to comment on the gist or drop me a tweet on @booyaa. i'd love to hear your thoughts and ideas on how i could improve the process.

desktop

i'll be using screencapture because it comes with osx.

source: http://osxdaily.com/2010/06/09/screen-capture-in-mac-os-x/

webcam

imagesnap replaces isightcapture which no longer works mountain lion. imagesnap is based on isightcapture, but has been recompiled for newer version of osx.

source: http://osxdaily.com/2007/01/24/capture-isight-images-using-the-command-line/ download: http://iharder.sourceforge.net/current/macosx/imagesnap/

script

you're better off runnning a script rather than a scheduled job, just so you aware that it's still capturing. besides the internet doesn't need to see you hacking code naked.

yes, this is quick and dirty shell script, but it works. you'll need to create a stage directory in your home dir: ```mkdir ~/stage``

then create this script in your favourite editor. i'd recommend saving it in ~/bin (yes you'll need to create that too if you don't already have a bin dir).

call it capture.sh

while true
do
  TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
  WORKDIR=~/stage/ # create this directory or point to your alternative
  SLEEPFOR=10 # seconds
  WORKSPACE=workspace-
  ISIGHT=isight-

  echo capturing workspace
  # -C include the cursor
  # -x don't play sound
  # -d display errors via the UI
  /usr/sbin/screencapture -Cxd -tjpg $WORKDIR$WORKSPACE$TIMESTAMP.jpg

  echo capturing face
  ~/bin/imagesnap -w 1 $WORKDIR$ISIGHT$TIMESTAMP.jpg

  sleep $SLEEPFOR
  echo slept for $SLEEPFOR seconds
done

then to run just do ~/bin/capture.sh

timelapse video

to convert into all the images into a video i'd recommend using convert that comes with imagemagick which you can install using homebrew brew install imagemagick

to convert your webcam grabs into a video

convert -delay 2 isight*.jpg m2v:isight.mpg

to convert your desktop grabs into a video

convert -delay 2 workspace*.jpg m2v:workspace.mpg

you'll probably have to tweak the timings to see how much of a delay you'll need.

source: http://www.munz.li/2008/07/23/time-lapse-convert-single-jpg-images-to-a-movie/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment