import processing.video.*; Capture cam; MovieMaker mm; int secondsPerFrame = 0; int framesPerSecond = 0; void setup() { size(640, 480); cam = new Capture(this, width, height); cam.settings(); String [] lines = loadStrings("TimeLapseSettings.txt"); if(lines==null) { saveStrings("TimeLapseSettings.txt", new String[]{"secondsPerFrame=1\nframesPerSecond=15"}); lines = loadStrings("TimeLapseSettings.txt"); } secondsPerFrame = Integer.parseInt(lines[0].split("=")[1]); framesPerSecond = Integer.parseInt(lines[1].split("=")[1]); mm = new MovieMaker(this, width, height, uniqueMovieFileName(), framesPerSecond); } String uniqueMovieFileName() { int c = 1; String fn = "movie-"+c+".mov"; while(new File(fn).exists()) { c++; fn = "movie-"+c+".mov"; } return fn; } int index = 0; void draw() { if (cam.available() == true) { cam.read(); image(cam, 0, 0); mm.addFrame(); } PFont fontA = loadFont("CourierNew36.vlw"); // Set the font and its size (in units of pixels) textFont(fontA, 12); fill(100); text("frame: "+index, 20, height - 20); delay(1000*secondsPerFrame); } void keyPressed() { //if (key == 'q') { mm.finish(); // Finish the movie if space bar is pressed! exit(); //} }