Free timelapse screencasts in MacOS. Part I: snapshots

Medusa is giving a talk entitled ‘Independent Video Game Creation. Exploring the technical and creative process‘ in the incoming Animayo festival. We will build a game from zero to beta in three hours while discussing with the audience what makes a game fun.

We need to prepare some timelapse videos for the artistic part, namely speed paintings of concept art and textures and speed modeling and animation. We may even show some speed programming and speed music composing videos, because these things are pretty attractive once  you create your first one!

While recording the whole screen is quite easy with Quicktime Player X, we needed no more than two frames per second. I finally had to program my own Python script to do that, because everything was either expensive or didn’t meet our needs.

It uses TKinter to ask for the output directory, where it stores two frames each second. Nothing fancy, just simple and practical. Indeed, you have to stop it by pressing CTRL-C if you are using a console, or killing python with CMD-ALT-ESC. But it does its job!

You’ll know it’s working because it uses the ‘screencapture’ command, which makes that cool camera-like click sound when capturing the screen. Twice per second. Yes, I know. Mute your Mac.

import Tkinter, tkFileDialog, tkSimpleDialog
import os
import threading
import time
import sys

def take_snapshot(frame, command):
  frame += 1
  os.system(command  + str(frame).zfill(6)  + ".png")
  threading.Timer(0.5, take_snapshot, 
  [frame, command]).start()

snapshot_id = ""
if (len(sys.argv) == 2):
  snapshot_id = sys.argv[1]
root = Tkinter.Tk()
dirname = tkFileDialog.askdirectory(
  title='Output directory...')
if len(dirname ) > 0:
  print "Storing snapshots in %s" % dirname
  print "Press CTRL-C (probably many times) to stop."
  command = "screencapture " + dirname + "/" + 
take_snapshot(0, command)

Follows up: how to create a video from all these images!