Hi guys,
I'm trying to import a movie, get each frame, run some processing on that frame, and then save it in a frame array.
I've got it working without bugs, however, the method i currently use:
http://forum.processing.org/topic/import-whole-video-at-once
requires the draw loop to be active for the frames to be loaded.
Unfortunately this is a big no-no for the program I'm creating, which will use the frames that have been processed for some sprite work after (the clip is a blue-screen with the sprite i need on it).
Question is, is there any way to load all a movies frames without the draw loop running?
I suspect the answer to this question involves some complicated java (threading) which i have no experience with, but that's ok.
here's a small sample of relevent code:
public void ProcessMovie(PApplet parent, String movieName) {
this.parent = parent;
GSMovie myMovie = new GSMovie(this.parent, movieName);
myMovie.play();
myMovie.read();
System.out.println(myMovie.length()); // returns 0 since the movie hasnt yet loaded frame 1.
frames = new State[(int)myMovie.length()]; // state is besically [int x, int y, PImage graphic]
// following was an attempted mod from the frame by frame example in processing
for(int i=0; i!=myMovie.length(); ++i) {
myMovie.play();
myMovie.jump(i);
myMovie.pause();
myMovie.read();
frames[i] = extract(myMovie);
}
}
I'm not opposed to using the core movie class instead of GSMovie but as far as i'm aware GSMovie has more functionality.
Any help would be appreciated :D,
Thanks in advance.