example
Example
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 16-4: Display QuickTime movie

import processing.video.*;

// Step 1. Declare Movie object
Movie movie; 

void setup() {
  size(320,240);
  
  // Step 2. Initialize Movie object
  // Movie file should be in data folder
  movie = new Movie(this, "cat.mov"); 
  
  // Step 3. Start movie playing
  movie.loop();
}

// Step 4. Read new frames from movie
void movieEvent(Movie movie) {
  movie.read();
}

void draw() {
  // Step 5. Display movie.
  image(movie,0,0);
}
  • http://www.lima.arc.ulaval.ca/moodle/course/view.php?id=2 Pierre Cote

    Hi Daniel,
    Seem that Exemple 16-4 is working (at least for me) only when skipping step 4 all together and moving “movie.read();” directlly inside draw() loop… As it is by the way with the next exemple 16-5, which is working fine. Best, Pierre.

  • Kit

    I have the same problem as Pierre. With the original code it gives an error about array coordinates being out of bounds on the image(movie,0,0) statement.

  • http://www.ccttours.com/blog ww

    ye, same error here, and you can solve it by simply:
    use “size(320, 240, P2D);” instead of “size(320, 240);”

    I don’t know why, but it really works. Good luck!

  • tomot

    wow! another year has passed since the last comment.

    yes “size(320,240, P2D)” brings up a display box, but still no video ,
    the IDE still give me an error.

    I’m wondering why Processing requires a connection to QuickTime ?
    I have installed the VLC media player in Win7, which has no problem playing any video format
    you throw at it. (.avi, .flv, mpg, mp3, .mov etc. etc. )

    cheers!

  • http://www.learningprocessing.com Daniel Shiffman

    Unfortunately, there are some problems with recorded video and the Processing video library due to Quicktime for Java fading away. I’m working on a new video library, we ran into some technical difficulties but hope to have something in early 2011. For now, I recommend using the openCV library or GSVideo for video. Check out:

    http://ubaa.net/shared/processing/opencv/
    http://gsvideo.sourceforge.net/
    http://www.mat.ucsb.edu/~a.forbes/PROCESSING/jmcvideo/jmcvideo.html