processing-video
processing-video copied to clipboard
Apply loadPixels() to video is extremely slow in OpenGL renderers
I tried to replace the black pixels in a video in P3D renderer but just calling loadPixels() seems to make the programme extremely slow But it's ok when it applied to still Images so I guess some problems with the video library? I used the newest beta release of the video library
To recreate the problem
Movie myMovie
void setup(){
size (640,480,P3D);
myMovie = new Movie (this,"mymovie.mp4");
myMpvie.play();
}
void draw(){
background(0,255,0);
myMovie.loadPixels();
image(myMovie,0,0);
}
void movieEvent(Movie m){
m.read;
}
I run the above code, the movie play in like 0.3 FPS ( the movie is 320x240)
But with this
Movie myMovie
void setup(){
size (640,480,P3D);
myMovie = new Movie (this,"mymovie.mp4");
myMpvie.play();
}
void draw(){
background(0,255,0);
//myMovie.loadPixels();
image(myMovie,0,0);
}
void movieEvent(Movie m){
m.read;
}
or this
Movie myMovie
void setup(){
size (640,480);
myMovie = new Movie (this,"mymovie.mp4");
myMpvie.play();
}
void draw(){
background(0,255,0);
myMovie.loadPixels();
image(myMovie,0,0);
}
void movieEvent(Movie m){
m.read;
}
The movie is played in 24FPS, which is it's original frame rate.
I tried both on my MacBook Pro 15 2018 and My PC with AMD Ryzen 1600, AMD R9 380 and 16GB RAM so it seems not a hardware problem.....