I want to write a program that allows me to move through a video clip frame by frame by pressing arrow keys. I tried to implement this idea with Processing's Movie class and its jump() and read() commands, but this didn't work well, perhaps because the underlying java quicktime library is designed for streaming playback and not displaying individual frames.
I figured the next best thing would be exporting a video to individual image files with QuickTime Pro and loading each image file on command. That works for a couple hundred images but then Processing throws an out of memory error. From profiling the sketch, I can see that Processing is retaining a reference to every image that is loaded with loadImage().
You can get a sense of what I'm trying to do with this code snippet that ignores all the key command stuff:
void draw() {
imgCounter ++;
fileName = makeFileName(path, imgCounter); //magical subroutine to create correct file names
img = loadImage(fileName);
image(img,0,0);
}
My question is, how do I get Processing to release references to an image after it's been displayed so that it can be GCed?
I figured the next best thing would be exporting a video to individual image files with QuickTime Pro and loading each image file on command. That works for a couple hundred images but then Processing throws an out of memory error. From profiling the sketch, I can see that Processing is retaining a reference to every image that is loaded with loadImage().
You can get a sense of what I'm trying to do with this code snippet that ignores all the key command stuff:
void draw() {
imgCounter ++;
fileName = makeFileName(path, imgCounter); //magical subroutine to create correct file names
img = loadImage(fileName);
image(img,0,0);
}
My question is, how do I get Processing to release references to an image after it's been displayed so that it can be GCed?
1