We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Framerate problems (Read 362 times)
Framerate problems
Nov 15th, 2008, 7:18pm
 
Hi All,

I'm new to the video libraries and I'm having problems getting the frame rate right for the movies I'm creating.

I would like to capture a video from my webcam with "Capture" and the save it using "MovieMaker." It seems straight forward enough but when I playback the video after saving them, it is always plays back at a much faster speed.  I would just like to be able to play it back at a normal speed.  I've tried fiddling with frame rate speed for Capture, MovieMaker, and the draw method, but nothing has really worked like i've wanted.

I'll post the code I'm using below.  Also, I am using my built in Apple iSight.  Thanks for any help I get, I appreciate it.

-A




import processing.video.*;

MovieMaker mm; //the moviemaker
Capture myCapture; //isight

void setup() {
 
 size(320, 240);

 myCapture = new Capture(this, width,height,30);
 
 mm = new MovieMaker(this, width, height, "mymovie.mov",30,MovieMaker.H263, MovieMaker.HIGH);
 // 30 fps, h263, high quality

}

void captureEvent(Capture myCapture) {
 myCapture.read();
}

void draw() {
 image(myCapture,0,0);
 // Add window’s pixels to movie
 mm.addFrame();
}

void keyPressed() {
 if (key == ' ') {
   mm.finish();
   exit();
 }
}
Re: Framerate problems
Reply #1 - Nov 15th, 2008, 9:56pm
 
Your machine is probably not fast enough to read video at 30 fps and also write it back out at the same time. The frame rate of the output file is constant (30 fps) no matter whether you get video input at 30 fps.

Try placing println(frameRate) inside draw().
Re: Framerate problems
Reply #2 - Nov 15th, 2008, 10:16pm
 
Cool, thanks Fry.  Thats exactly it.  I appreciate the reply, you've saved me alot of time!

I'm guessing there is no nice way around this read/write issue? Please let me know if there is.

Thanks again!

Alistair
Page Index Toggle Pages: 1