Today I was working on a slit scan variation to get an animated slit scan. My goal is, that a movement goes through a video and every slice is updated from the video and shows a different time. like running the video from 120 different starting position and only showing slices of each of them from different moment.
The way I try to achive this is by saving parts of the video as images to an array and continously add images to the array and remove images from it. Then I want to get() of every image in the array a part and update the images in the array.
like this:
get from index a:
x1(a)* width
x2(a)* width
by updating the array I hope to get the movement.
But, when I set the array Sizesize (int fBm) to something like 120, it only return a black screen. When I set it to 5, I get something like 30 slices, even though I set the slice to height/array.length (int fBm).
Any Advide?
import processing.video.*;
Movie movie;
int movieFPS=25;
float increase = 160;
float movieFrameTime = 1.0/movieFPS;
float movieTime;
int fBm = 60;
PImage[] frameBuffer = new PImage[fBm];
int frameNumber = 0;
int slice = height/fBm;//height/images.length;
int ypos =0;
PImage display;
void setup() {
size(720, 1280);
movie = new Movie(this, "DSC_0054.mp4");
movie.play();
background(0);
frameRate(25);
for (int i=frameBuffer.length-1; i>0; i--) {
frameBuffer[i] = new PImage();
}
}
void draw() {
if (movie.available()) {
movieTime = (increase * movieFrameTime) % movie.duration();
movie.jump(movieTime);
movie.read();
}
for (int i= 0; i<frameBuffer.length-1; i++)
{
frameBuffer[i]=frameBuffer[i+1];
}
frameBuffer[frameBuffer.length-1] = movie.get(0, 0, width, height);
for (int i = 0; i<frameBuffer.length; i ++) {
display = frameBuffer[i].get(0, ypos, width, slice);
image(display, 0, ypos);
ypos += slice;
if (ypos >= height) {
ypos =0;
}
}
increase+=1;
}