Update: MovieMaker is now part of Processing’s core video library so this post is now irrelevant!

Based on some code from Shawn Van Every and Dan O’Sullivan, I’ve created a Processing library that allows you to take any pixel array (from the window or from a PImage) and create a quicktime movie.

  • It might be buggy if the movie file already exists. In theory, it should delete the file and rewrite a new one, but this is not always working.
  • You must call finishMovie() yourself. You might try calling it in stop() or destroy() but it doesn’t seem to work consistently so in my example below, I just call it in mousePressed(). Ultimately, I’d like to have the library call it automatically when the applet quits. . .
  • Need to implement more codecs (you can actually pass in any available constants, i just made nice little variables for a few.)
  • This needs to be tested on Windows. In theory, the library checks your OS and flips pixels if you are using Windows, but haven’t tested it yet. Oh, and there might be a problem on intel macs if they think like windows in terms of pixels.
  •  
    E-mail me bug reports, questions, comments, etc.!

    Example code:

    import moviemaker.*;
    
    MovieMaker mm;
    float theta = 0;
    
    void setup() {
      size(200,200);
      mm = new MovieMaker(this,width,height,"p5test.mov", MovieMaker.JPEG, MovieMaker.HIGH,30);
    }
    
    void draw() {
      background(sin(theta)*127+127,255,cos(theta)*127+127);
      theta += 0.05;
      loadPixels();
      mm.addFrame(pixels,width,height);
    }
    
    public void mousePressed() {
      mm.finishMovie();
    }

    Available constants:
    code: RAW, JPEG, CINEPAK, SORENSON, VIDEO
    quality: LOW, MEDIUM, HIGH, BEST