-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ffpyplayer video: better video seek #5313
Conversation
The problem with this is that some videos only have I-frames at regular intervals of e.g. 5 or 10 seconds. When |
@matham, yes, I know it, but I think it's better to use inaccurate seek on practice. When we seek accurately we will wait same 5-10 second seeing slowed/speeded video stream. It's confusing, I'm not sure it worth it. It's debatable issue, but I can notice that Long story short, I like inaccurate seeking much more. Feel free to accept or reject this PR. P.S. Sorry if I'm being annoying, couldn't you also take a look when you have time at this ffpyplayer-related PR? I use it for a long time and it works fine for me. |
Ok, a better solution then is to add a Remember to add docs for the meaning and implication of using the precise flag though. |
# Conflicts: # kivy/core/video/video_ffpyplayer.py
|
kivy/core/video/video_ffpyplayer.py
Outdated
@@ -255,11 +255,13 @@ def _next_frame_run(self): | |||
while not self._ffplayer_need_quit: | |||
seek_happened = False | |||
if seek_queue: | |||
vals = seek_queue[:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for copy and then delete is because of threading issues. If you get the last value and then delete all elements, because this runs in a second thread, in between the get and delete a new seek may have been added from the other thread. So you end up losing that seek request. The way it was before (copy and then delete the number of copied elements) is thread safe so please change it back to that.
Right now changing position of video with ffpyplayer is a bit buggy. Audio stream will seek correctly, while video stream will be slowed or speeded for few seconds before both streams became synchronized.
This PR fixes it making seeking much nicer. While ffpyplayer doc says this method is "inaccurate", on practice it works better given us very close position to wanted and synchronized streams momentarily.
I tested it on Windows and Android on different videos for a long time.