ffpyplayer icon indicating copy to clipboard operation
ffpyplayer copied to clipboard

Seek doesn't update position and frame while video is paused

Open germn opened this issue 8 years ago • 2 comments

If you'll call seek while video is paused, it's position and frame (picture) will remain old.

This simple code can be used for testing: main.py test.kv

Here's how seeking works with gstplayer:

And here's same code with ffpyplayer:

germn avatar Jan 14 '17 16:01 germn

Lets keep this open because it should be fixed in ffpyplayer itself. Then the 6-frame hack in kivy can be removed.

matham avatar Oct 09 '17 21:10 matham

Hi, I'm wondering if the seek function could implement a callback method to signal when the seek has actually arrived at the correct position. I have a similar hack in my application where I keep reading frames until I find one within range of the seek that was issued.

Basically my workaround is

player.seek(timestamp)

while frame is not None:
    frame, _ = player.get_frame(force_refresh=True)
    if frame:
         if float_equals(timestamp, frame[1]):
             notify(frame[0], frame[1])
         else:
             frame = None
player.set_pause(True)

It seems that get_frame has an implicit set_pause(False) in it or something but didn't really read that in the documentation. Which also brings me to a second possible request of making a peek_frame function or something that might be useful in situations.

TheRealLambinator avatar Mar 11 '22 00:03 TheRealLambinator