I'm currently working on a video displaying project. It will select from a large bank of movies, between 10 seconds and 3 minutes), all fairly low resolution (possibly as low as 40 x 10 pixels) based on various stimuli from a range of sensors. The program will output to an LED display
I have a bit of experience with using Processing and know that I could write a program to have this work, but normally when using Processing on a Macbook Pro, the machine tends to heat up quite a bit which makes me nervous about running a sketch for 24 hours, let alone a whole year.
Does anyone have any experience of this sort of thing and is Processing a good platform for running a display 24/7 for such a long time?
Thank you in advance for any advice and do please ask if I should clarify anything further.
I was wondering if someone may be able to help me with a project I'm working on. I'll give a brief outline. I've written 2 programs, the first of which continually captures and saves movies using the input from a MBP webcam. The second program searches within the movie folder and selects at random a movie to play, then when it's finished playing, plays another in the same fashion. Eventually, this will form a live video installation. The first program runs without any detectable problems, however the second doesn't work well at all.
I'm currently experiencing 2 problems with the second program, the first of which is that after playing about 5-7 videos, playback drastically slows down until it gives me the error:
An OutOfMemoryError means that your code is either using up too much memory
because of a bug (e.g. creating an array that's too large, or unintentionally
loading thousands of images), or that your sketch may need more memory to run.
If your sketch uses a lot of memory (for instance if it loads a lot of data files)
you can increase the memory available to your sketch using the Preferences window.
Exception in thread "Thread-11" java.lang.OutOfMemoryError: Java heap space
at processing.core.PImage.init(PImage.java:194)
at processing.video.Movie.read(Movie.java:448)
at processing.video.Movie.run(Movie.java:679)
at java.lang.Thread.run(Thread.java:680)
The other error is that sporadically the program crashes, highlighting the following line of code:
image(randomVideo, 0, 0, width, height);
With this error:
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 1681
at processing.core.PPolygon.scanline(PPolygon.java:445)
at processing.core.PPolygon.render(PPolygon.java:335)
at processing.core.PGraphics2D.endShape(PGraphics2D.java:401)
at processing.core.PGraphics.endShape(PGraphics.java:1242)
at processing.core.PGraphics.imageImpl(PGraphics.java:2925)
at processing.core.PGraphics2D.imageImpl(PGraphics2D.java:1410)
at processing.core.PGraphics.image(PGraphics.java:2853)
at processing.core.PGraphics.image(PGraphics.java:2829)
at processing.core.PApplet.image(PApplet.java:8690)
at CCTVPlayer.draw(CCTVPlayer.java:69)
at processing.core.PApplet.handleDraw(PApplet.java:1631)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)
I believe the first may be a memory leak, so I think I need a line like "
randomVideo.delete();" or something to clear the cache after each video plays, however I can't seem to find any reference to this existing.
I'd be very grateful for any help or advice on either of the problems. Apologies for the rather long post and thank youvery much in advance. Please let me know if I can provide any extra information. Here is the sketch:
import processing.video.*;
Movie randomVideo;
boolean playing = false;
boolean videoInFolder = false;
void setup() {
size(screen.width/2, screen.height/2, P2D);
}
void draw() {
if (!videoInFolder) {
int t = 0;
while (t < 1) {
String path = sketchPath + "/videos/";
File dataFolder = new File(path);
String[] fileList = dataFolder.list();
t = fileList.length;
}
videoInFolder = true;
}
if (!playing) {
String path = sketchPath + "/videos/";
File dataFolder = new File(path);
String[] fileList = dataFolder.list();
int i;
i = int(random(fileList.length));
println(fileList[i]);
randomVideo = new Movie(this, path + fileList[i]);