Hey I am a very new user to processing I want to play my own video in a sketch rather than capture.
using this code it will play audio but no video
import processing.video.*;
Movie myMovie;
void setup() {
size(600, 600);
myMovie = new Movie(this, "birthday.mov");
myMovie.play();
}
void draw() {
image(myMovie, 600, 600);
}
void movieEvent(Movie m) {
m.read();
}
I am also not sure how my folders need to be setup so that it will access the video properly. Where should the library folder be/ do I need a data folder.
If I want to loop a video within another code do I just add above before the beginning/ how do I integrate???
for example
import processing.video.*;
Movie myMovie;
void setup() {
size(200, 200);
myMovie = new Movie(this, "birthday.mov");
myMovie.loop();
}
void draw() {
image(myMovie, 0, 0);
}
void movieEvent(Movie m) {
m.read();
}
int numPixels;
int blockSize = 10;
Movie myMovie;
int myMovieColors[];
int[] previousFrame;
int TOLERANCE = 50;
boolean go = false;
boolean record = false;
int fake_frame_rate = 0;
MovieMaker mm;
void setup() {
size(626, 352, P3D);
myMovie = new Movie(this, "birthday.mov"); //put movie here
mm = new MovieMaker(this,width,height,"output3.mov", 24, MovieMaker.RAW, MovieMaker.BEST);
numPixels = width*height;
myMovieColors = new int[numPixels];
previousFrame = new int[numPixels];
//myMovie.speed(0.5);
myMovie.loop();
}
void draw() {
loadPixels();
if (!go) {
for (int i = 0; i < numPixels; i++) { // For each pixel in the video frame...
pixels[i] = myMovieColors[i];
}
} else {
int movementSum = 0; // Amount of movement in the frame
for (int i = 0; i < numPixels; i++) {
color currColor = myMovieColors[i];
color prevColor = previousFrame[i];
// Extract the red, green, and blue components from current pixel
int currR = (currColor >> 16) & 0xFF;
int currG = (currColor >> 8) & 0xFF;
int currB = currColor & 0xFF;
// Extract red, green, and blue components from previous pixel
int prevR = (prevColor >> 16) & 0xFF;
int prevG = (prevColor >> 8) & 0xFF;
int prevB = prevColor & 0xFF;
// Compute the difference of the red, green, and blue values