We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
myMovie and lastRow (Read 341 times)
myMovie and lastRow
Jul 31st, 2008, 2:05pm
 
Dear Discourse,

I am trying to read a .mov file and display it frame by frame (as in framingham by Fry).

With the current script my movie displays right in column but it seems like it doesn't scoot up the rows

any suggestion?  
thanks

*/////////////////////////////////////*
import processing.video.*;

Movie myMovie;

int column;
int columnCount;
int row;
int rowCount;
int lastRow;

// Buffer used to move all the pixels up
int[] scoot;



void setup() {
 size(1240,680, P3D);
frameRate(2);
 // Uses the default video input, see the reference if this causes an error
myMovie = new Movie(this, "station.mov");
myMovie.loop();

 column = 0;
 columnCount = width / myMovie.width;
 int rowCount = height / myMovie.height;
 /*lastRow = rowCount - 1;
 
 lastRow = rowCount -5;
 scoot = new int[lastRow*myMovie.height * width];*/
background(0);
}
 // Also try with other video sizes

void draw() {
 // By using video.available, only the frame rate need be set inside setup()
 if (myMovie.available()) {
   myMovie.read();
   set(myMovie.width*column, myMovie.height*lastRow, myMovie);
   column++;
   if (column == columnCount) {
     loadPixels();
       
     // Scoot everybody up one row
     arraycopy(pixels, myMovie.height*width, scoot, 0, scoot.length);
     arraycopy(scoot, 0, pixels, 0, scoot.length);

     // Set the moved row to black
     for (int i = scoot.length; i < width*height; i++) {
       pixels[i] = #000000;
     }
     column = 0;
     updatePixels();
   }
 }
 
}
Re: myMovie and lastRow
Reply #1 - Aug 7th, 2008, 8:07am
 
yeah, i'd like to do frame differencing frame-by-frame too. Using if(video.available()) in the loop can't seem to keep up with the video.play() in the setup even with frameRate(1).
Page Index Toggle Pages: 1