We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I keep getting the same error, I'm very very new to programming so I'm unsure of what I'm doing wrong. Help?! I keep getting the message that I can't load the movie file.
import processing.video.*;
Movie myVideo;
int video_width = 768;
int video_height = 576;
int video_slice_x = video_width/2;
int window_width = 1000;
int window_height = video_height;
int draw_position_x = 0;
boolean newFrame = false;
void setup() {
myVideo = new Movie(this, "Sequence01_4.mov");
size(window_width, window_height, P2D);
background(0);
myVideo.loop();
}
void movieEvent(Movie myMovie) {
myMovie.read();
newFrame = true;
}
void draw() {
if (newFrame) {
loadPixels();
for (int y=0; y < window_height; y++){
int setPixelIndex = y*window_width + draw_position_x;
int getPixelIndex = y*video_width + video_slice_x;
pixels[setPixelIndex] = myVideo.pixels[getPixelIndex];
}
updatePixels();
draw_position_x++;
if (draw_position_x >= window_width) {
exit();
}
newFrame = false;
}
}
/Users/jessicaearle/Desktop/Screen Shot 2014-02-19 at 10.13.12 PM.png
Answers
Have you added the movie file to your sketch? What happens if you load "data/Sequence01_4.mov" instead?
You should put size() at the start of setup(), as recommended in the Reference. And you make it backward: in general, you call size() with numerical values, then you use the built-in variables width and height if needed.