You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.
// put at least two mp4 files in the data/ directory of this sketch
import gohai.glvideo.*;
import java.io.File;
GLMovie movie;
String movieNames[] = {};
int currentMovieIndex;
int time;
void settings() {
size( 640, 480, P2D );
}
void setup() {
// read all .mp4 files from data directory
File dir = new File(dataPath(""));
File[] files = dir.listFiles();
for( int i=0; i < files.length; i++ ){
String path = files[i].getAbsolutePath();
if( path.toLowerCase().endsWith(".mp4") ) movieNames = append( movieNames, path );
}
// load the first movie
println( "load first movie" );
movie = new GLMovie( this, movieNames[0] );
movie.loop();
time = millis();
}
void draw() {
// load new movie every 5 seconds
if( time > 0 && millis() > time + 5000 ) {
// try to free memory; nothing of this seems to work
g.removeCache( movie );
movie.close();
movie = null;
System.gc();
// load next movie
++currentMovieIndex;
if( currentMovieIndex >= movieNames.length ) currentMovieIndex = 0;
String newMovieName = movieNames[ currentMovieIndex ];
println( "load movie '" + newMovieName + "'" );
movie = new GLMovie( this, newMovieName );
movie.loop();
time = millis();
}
// display movie on screen
if( movie.available() ) movie.read();
background(0);
image( movie, 0, 0, width, height );
}
a video is displayed and every 5 seconds the video is replaced with a new video. I'm running this on a Mac and in Activity Monitor I can see an increase in the memory every time a new video loads. After a few minutes, the framerate drops and videoplayback gets chunky.
I'm running this on Processing 3.2.2 with GL Video 1.1.
I'm not that experienced in processing or java, so I don't know how I can debug and fix this issue. Can someone help me out here?
The text was updated successfully, but these errors were encountered:
You might want to try and see if the native Java_gohai_glvideo_GLVideo_gstreamer_1close function (written in C) leaves any memory around, or if there is something the reference counting is overlooking.
But to be hontest, at this point, the priority is to get the library running well across all OS, and most users probably won't spawn new instances every 5 seconds. You might want to try concatenating your video files into one long file and simply use jump() to change the current playback position.
Hi there,
I have this simple test case:
a video is displayed and every 5 seconds the video is replaced with a new video. I'm running this on a Mac and in Activity Monitor I can see an increase in the memory every time a new video loads. After a few minutes, the framerate drops and videoplayback gets chunky.
I'm running this on Processing 3.2.2 with GL Video 1.1.
I'm not that experienced in processing or java, so I don't know how I can debug and fix this issue. Can someone help me out here?
The text was updated successfully, but these errors were encountered: