hi
image() method has some problems about open file .mp4
other example can open same video file but in my coding doesn’t work
can you help me?
this is my coding
import processing.video.*;
import com.hamoid.*;
int cellSize = 10;
int cols, rows;
float secondsnb;
int imagesnb;
int seconds2;
Capture cam1;
Capture cam2;
VideoExport videoExport;
Movie timeLapse;
PImage img1;
PImage img2;
PImage pg;
//font
PFont f;
PFont g;
int fontS = 80;
int fontT = 20;
int fontA = 255;
int count = 0;
int countObs = 0;
void setup() {
String[]cameras = Capture.list();
printArray(cameras);
//fullScreen(2);
size(1600, 900);
frameRate(30);
cols = width / cellSize;
rows = height / cellSize;
colorMode(RGB, 255, 255, 255, 100);
cam1 = new Capture(this, 1600, 900, cameras[1], 30);
cam2 = new Capture(this, 1600, 900, cameras[2], 30);
f = createFont(“Berlin sans FB BOLD”,fontS);
pg = cam2;
background(0);
}
void captureEvent(Capture c){
if (c == cam2){
cam2.read();
}
}
void movieEvent(Movie m){
if( m == timeLapse){
timeLapse.read();
}
}
void draw() {
if(secondsnb == 0){
videoExport = new VideoExport(this, “data/camera.mp4”,pg);
videoExport.setGraphics(pg);
videoExport.startMovie();
cam1.start();
cam2.start();
}
secondsnb++;
if (secondsnb %5 == 0 && secondsnb <= 100) {
imagesnb ++ ;
pg = cam2.get();
videoExport.saveFrame( );
}
if(imagesnb >= 20){
videoExport.endMovie();
cam2.stop();
timeLapse = new Movie(this, “camera.mp4”);
//break;
}
if (cam1.available() && secondsnb <= 100) {
cam1.read();
cam1.loadPixels();
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
int x = i*cellSize;
int y = j*cellSize;
int loc = (cam1.width - x - 1) + y*cam1.width;
float r = red(cam1.pixels[loc]);
float g = green(cam1.pixels[loc]);
float b = blue(cam1.pixels[loc]);
color c = color(r, g, b, 75);
pushMatrix();
translate(x+cellSize/2, y+cellSize/2);
rotate((2 * PI * brightness(c) / 255.0));
rectMode(CENTER);
fill(c);
noStroke();
// Rects are larger than the cell for some overlap
rect(0, 0, cellSize+6, cellSize+6);
popMatrix();
}
}
}
if(secondsnb / 100 == 1){
cam1.stop();
background(0);
}
if(secondsnb / 100 >1){
seconds2 ++;
}
if(secondsnb / 100 >1 && seconds2 < 100){
fill(255,fontA);
textFont(f,fontS);
text(" “, width/2 - 400, height/2);
text(” “, width/2 - 400, height/2 + 80);
}
if(seconds2 >= 100 && seconds2 <= 150){
background(255);
fill(0,fontA);
text(” ", width/2 - 250, height/2);
}
if( seconds2 == 150){
background(0);
timeLapse.play();
}
if( seconds2 > 150){
image(timeLapse, 0, 0, width, height);
}
if( seconds2 > 300){
// stop();
secondsnb = 0;
imagesnb = 0;
seconds2 = 0;
}
}
operation OS : window 10
here is error
BaseSrc: [source] : Could not open file “C:\Users\source\final\data\camera.mp4” for reading.
BaseSrc: [source] : GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.