import processing.video.*; Capture cam; MovieMaker mm; void setup() { size(640, 480); cam = new Capture(this, width, height); cam.settings(); mm = new MovieMaker(this, width, height, uniqueMovieFileName(), 20); } 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; boolean saveAnImage = false; void draw() { if (cam.available() == true) { cam.read(); image(cam, 0, 0); if(saveAnImage) { mm.addFrame(); index++; saveAnImage = false; } } 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); } void mouseReleased() { saveAnImage = true; } void keyPressed() { //if (key == 'q') { mm.finish(); // Finish the movie if space bar is pressed! exit(); //} }