404 Learning Processing
• height —An integer, typically the same height as the sketch.
• filename —A String for the movie’s file name.
• framerate —A frame rate for the movie, typically 30.
• type —What compression format should the movie use.
• quality —The compression quality for the movie.
An example of the constructor is as follows:
mm = new MovieMaker(this, width, height, " test.mov " , 30, MovieMaker.H263,
MovieMaker.HIGH);
e library off ers many options for compression codecs. e term codec originally comes from the term
“ coder-decoder, ” referring to a hardware device that converts analog video to digital. Here, however,
codec refers to a “ compressor-decompressor, ” software that coverts video between its raw, uncompressed
form (for viewing) and its compressed form (for storage). e following are the codecs available with the
MovieMaker library (check the reference page for any updates to this list: http://processing.org/reference/
libraries/video/MovieMaker.html ) .
ANIMATION, BASE, BMP, CINEPAK, COMPONENT, CMYK, GIF, GRAPHICS, JPEG,
MS_VIDEO, MOTION_JPEG_A, MOTION_JPEG_B, RAW, SORENSON, VIDEO, H261,
H263, H264
Selecting a codec will aff ect the size of the movie fi le as well as the quality. RAW , for example, will store
the video in its raw uncompressed (and therefore highest quality) form, but will result in an enormous
video fi le. You can read more about the various codecs at Apple’s QuickTime site.
• QuickTime: http://www.apple.com/quicktime/ .
• QuickTime Developer: http://developer.apple.com/quicktime/ .
Once you have selected a codec, you must then specify a codec quality, ranging from worst to lossless.
WORST, LOW, MEDIUM, HIGH, BEST, LOSSLESS
After the MovieMaker object is constructed, frames can be added one at a time to the movie by calling
the addFrame( ) function.
void draw() {
// Some cool stuff that you are drawing!
mm.addFrame();
}
Finally, in order for the movie fi le to play properly it has to be “ fi nished ” with the fi nishMovie( ) function.
If you quit the Processing sketch before this function is called, the movie fi le will not be recognized by
QuickTime! One solution is to fi nish the movie on a mouse click. However, if you are using mouse
presses already in your applet, you might want to consider other options, such as fi nishing on a key press
or after a timer has run out.
public void mousePressed() {
mm.finishMovie();
}