We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone. thanks in advance for the help. I am trying to run videos (multiple different videos for multiple different projects) in the background of a simple processing animation and I need them to loop seamlessly. I have tried multiple approaches with multiple codecs. I just want to see if anyone has any tips on making processing play well with video. Codecs I have tried without being able to get seamless loop :MPEG-2, Photo-JPEG, Animation, H.264, Pro-Res
static final String FILE = "video", EXT = ".mov";
static final String RENDERER = JAVA2D;
static final int FPS = 30;
Movie vid;
import processing.video.*;
void settings() {
size(1920, 1080, RENDERER);
noSmooth();
}
void setup() {
frameRate(FPS);
println(width, height);
vid = new Movie(this, FILE + EXT);
vid.loop();
}
void draw() {
image(vid, 0, 0);
}
void movieEvent(Movie m) {
m.read();
}
I have also tried using frame images and playing them one at a time, this works well for a 128 frame video but not for a 1800 frame video
static final String FILE = "videoFrame-", EXT = ".png";
static final String RENDERER = JAVA2D;
static final int FPS = 30;
PImage[] fireworx = new PImage[128];
int currentImage = 0;
void settings() {
size(1920, 1080, RENDERER);
fullScreen(RENDERER);
noSmooth();
for(int i=0;i<=127;i++){
fireworx[i] = loadImage(FILE + i + EXT );
}
}
void setup() {
frameRate(FPS);
println(width, height);
}
void draw() {
image(fireworx[currentImage], 0, 0);
if(currentImage < 127){
currentImage++;
}else{
currentImage = 0;
}
}
Any advice on looping video seamlessly with Processing is super welcome! Also if I am just barking up the wrong solution tree let me know! Again thanks for any help!