Loading...
Logo
Processing Forum
hey,
i have some trouble with the new video library, cause i remember things seemed to work well before but don't do at the moment.
i simply play a video, apply some effects on each image and record the result in a new video.
the effects are so extensive that it won't happen in realtime. no problem- i just need the result... anyway
if i read an image from the movie, edit and save it in the draw method or maybe in a separated method the result is that i only get a few images from the whole movie. it seems like the movie is played in a separated thread and the effect and recording just gets an image from time to time.
 does anybody have the same problem, or know what may be wrong?

thanks,
ramin

Replies(2)

Maybe you can decrease framerate ... but i don't use this library yet so i don't know if it work

for example:: this program makes a little effect. the result is a 6 times shorter movie.

import processing.video.*;

Movie myMovie;
MovieMaker mm;

int nbShifts = 60;
ArrayList<Shift> shifts;

void setup() {
  size(720,576); 
  myMovie = new Movie(this, "F:/Sequenz 01.mov");

  mm = new MovieMaker(this, width, height, "drawing.mov",
  25,MovieMaker.H263, MovieMaker.HIGH);

  myMovie.play();
  shifts = new ArrayList<Shift>();
  for(int i=0; i < nbShifts; ++i)
    shifts.add(new Shift((int) random(height),(int) random(10),(int) random(14,24)));
}




int f=0;
void movieEvent(Movie myMovie) {
  myMovie.read();
  PImage img = shift(myMovie, myMovie,shifts);
  image(img, 0,0,720,576);

  mm.addFrame(img.pixels,width,height);
  for(int i=0; i < nbShifts; ++i)
    shifts.get(i).mod();
  println(f++);
}

void draw() {

}

PImage shift(PImage Simg, PImage cimg, ArrayList<Shift> shifts) {
  PImage img2 = createImage(Simg.width,Simg.height,RGB);
  img2.copy(Simg,0,0,Simg.width,Simg.height,0,0,Simg.width,Simg.height);
  img2.filter(INVERT);
  int y = (int) random(height);
  for(int i=0; i <nbShifts; ++i) {
    img2.copy(cimg,0,(int)shifts.get(i).y,Simg.width,shifts.get(i).z,
    shifts.get(i).s,(int)shifts.get(i).y, Simg.width,shifts.get(i).z);

    img2.copy(cimg,0,(int)shifts.get(i).y,(int)shifts.get(i).s,shifts.get(i).z,
    0,(int)shifts.get(i).y, (int)shifts.get(i).s, (int)shifts.get(i).z);
  }
  return img2;
}

class Shift {

  float y,yn,ym;  
  int z, s;


  Shift(int y, int s, int z) {
    yn = random(10);
    this.y = noise(yn)*height;
    // this.y = y;
    this.s = s; 
    this.z = z;
    ym = random(0.005,0.02);
  }


  public void mod() {
    yn+=ym;
    y = noise(yn)*height;
  }
}

void keyPressed() {
  if (key == ' ') {
    mm.finish();
    exit();
  }
}