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
Play Movie with Ping))) Choppy! (Read 1071 times)
Play Movie with Ping))) Choppy!
Jun 2nd, 2010, 6:40pm
 
Hi

I have a .MOV video file that is 640 x 480 px @ 24.99 FPS, no audio.
I want to trigger play when an object comes 10 cm or less to the Ping))) Ultrasonic Sensor.
Processing is getting the serial data with no problems.
The video plays when anything is at 10 cm or less from the sensor.
The thing is that the video plays at a very low frame rate.
I've tried several codecs and all of them play bad.
Processing is using 2048 MB of maximum available memory.

Thanks in advanced.

Code:
import processing.serial.*;
Serial myPort;
int val;
import processing.video.*;
Movie myMovie;
void setup() {
 String portName = Serial.list()[1];
 myPort = new Serial(this, portName, 115200);
 size(640, 480);
 myMovie = new Movie(this, "640x480_5.mov");
 myMovie.loop();
}
void draw() {
 if (myPort.available() > 0) {
   val = myPort.read();
   image(myMovie, 0, 0);
   if (val == 0) {
     myMovie.pause();
     println(val);
   }
   else {
     myMovie.play();
     println(val);
   }  
 }
}
Re: Play Movie with Ping))) Choppy!
Reply #1 - Jun 3rd, 2010, 2:56pm
 
I though maybe the serial communication was slowing things down so I'm just playing a video file and it still plays slooowww.

Code:
import processing.video.*;
import processing.opengl.*;
Movie myMovie;
void setup() {
 size(640, 480, P2D);
 myMovie = new Movie(this, "640x480_5.mov");
 myMovie.loop();
}
void movieEvent(Movie myMovie) {
 myMovie.read();
}
void draw() {
 image(myMovie,0, 0);
}
Page Index Toggle Pages: 1