processing / processing-video

GStreamer-based video library for Processing
274 stars 130 forks source link

loop is not working #182

Closed clankill3r closed 1 year ago

clankill3r commented 3 years ago

I have a movie and it does not loop. Since the code is compiled without the sources and I have no spare time atm I can't look into it. I do now that movie.available() returns false at the end of the video.

I see if I can upload the video later.

OSX 10.15.7

ptterb commented 2 years ago

I have the same issue. If I use a small movie file (~50mb) it will loop, but a larger file (~500mb) just stops at the end.

`Movie vid;

void setup() { fullScreen(); vid = new Movie(this, "jose.mp4"); vid.loop(); }

void draw() { background(0); image(vid, 0,0, width, height); }

// Called every time a new frame is available to read void movieEvent(Movie m) { m.read(); }`

clankill3r commented 2 years ago

As a workaround you can use this:

boolean is_movie_finished(Movie m) {
  return m.duration() - m.time() < 0.05;
}

and if so, use mov.jump(0);

luiscastilho commented 1 year ago

This problem still occurs with processing-video release 10 (2.2). And the workaround above still works as well.

kjhollen commented 1 year ago

I'm seeing this issue with files as small as 28MB, on M1 Silicon & an older mac laptop. The workaround described above works great for me!

codeanticode commented 1 year ago

Is this something that's still happening with the latest version of the library (2.2.x)?

cacheflowe commented 1 year ago

Is this something that's still happening with the latest version of the library (2.2.x)?

I thought it was still broken, but I just tested several different size/length videos with the latest video library (2.2.1), and looping does seem to work now! I'm on Windows 11 & the latest Processing core

codeanticode commented 1 year ago

@cacheflowe Great news, thanks for confirming!

ffd8 commented 1 year ago

Unfortunately .loop() is broken on my setup, Processing 4.1.3, Video v2.2.2, Apple M1, Macos 12.5.1. Using the code above worked to loop once I disabled the movie.loop() code.

if (movie.available()) {
  movie.read();
  if (is_movie_finished(movie)) {
    movie.jump(0);
  }
}
benoitbohnke commented 6 months ago

Same problem occurs to me with mp4 format only. I've add this before setup() : boolean is_movie_finished(Movie m) { return m.duration() - m.time() < 0.05; } And this to the draw() loop : if (is_movie_finished(movie)) { print(is_movie_finished(movie), "movie finished"); movie.jump(0); }