Audio repeat at the end
@matham I report also here the issue considering that my last test shows that it is not related to kivy. Material to replicate the issue has been posted and updated here: https://github.com/kivy/kivy/issues/7416#issuecomment-957360679
thank you
hey, long term ffpyplayer user here, that's happened a lot with me while using this lib, it's most probably because your main program thread exits and the MediaPlayer object threads are still hanging, that's why even if the video/audio ends, there's some weird sort of repetitions of the last couple of seconds.
the fix, is to not specify autoexit in ff_opts (if you are specifying that option, that is) and next, make sure that the video ends by doing something along the lines of
while True:
frame, val = player.get_image()
if val == 'eof':
player.close_player()
break
so that the player is closed whenever 'eof' is returned by get_frame()
alternatively, you could try something like this too
while True:
if player.get_pts() >= player.get_metadata()['duration']:
player.close_player()
break
the goal here is to identify when the playback ends and manually close that player instance on such event
the reason it's necessary to not specify autoexit in the ff_opts is that for some reason it doesn't return 'eof' as val when calling get_frame(), at least that's what I've experienced hope this helps :)
Thanks @addyett , considering that I'm using the ffpyplayer to show up a video in kivy, could you please let me know how should I edit the following code? Thank in advance.
from kivy.lang import Builder from kivy.app import App
KV = ''' Screen:
VideoPlayer:
source: 'Video1.mp4'
state: 'play'
allow_fullscreen: False
'''
class TestVideoPlayer(App): def build(self): return Builder.load_string(KV)
TestVideoPlayer().run()
A lot of users have the same issue, but there is still no fix for it, would be great to find even a partial solution, thanks