ffpyplayer icon indicating copy to clipboard operation
ffpyplayer copied to clipboard

How to add these opts to ffpyplayer when using the kivy ffpyplayer provider?

Open ShootingStarDragon opened this issue 3 years ago • 2 comments

I'm making a desktop app with kivy and ffpyplayer is a godsend. However, I am trying to load youtube links asynchronously and sometimes I get this error:

[ERROR  ] [ffpyplayer  ] [tls @ 0000016d0bbd9640] Error in the pull function.
[WARNING] [ffpyplayer  ] [mov,mp4,m4a,3gp,3g2,mj2 @ 0000016d0bbf3280] Packet corrupt (stream = 1, dts = 2098176)
[WARNING] [ffpyplayer  ] [mov,mp4,m4a,3gp,3g2,mj2 @ 0000016d0bbf3280] .
[ERROR  ] [ffpyplayer  ] [mov,mp4,m4a,3gp,3g2,mj2 @ 0000016d0bbf3280] stream 1, offset 0x6f3118: partial file
[ERROR  ] [ffpyplayer  ] [tls @ 0000016d0bbd9640] The specified session has been invalidated for some reason.
[ERROR  ] [ffpyplayer  ] [aac @ 0000016d0e4ead00] decode_band_types: Input buffer exhausted before END element found

After googling for some time, people using discord.py also have this problem and they have solved it by adding 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5' to ffmpeg to force a reconnect. How can I do this for kivy? I tried adding these flags to ff_opts in video_ffpyplayer.py. However, I am still getting this error.

I also figured out that by holding the window with the mouse, you can block redraws. Will this break the ffpyplayer videoplayer when streaming from youtube? Just a thought.

TLDR: Is there a way to supply these commands to ffopts? 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5' (these are positional as per: https://superuser.com/a/1050499)

Is there a way to intercept this error message and get ffpyplayer video to restart/reconnect?

Thanks matham, ffpyplayer is amazing but I need a bit more help to get where I need to go. Cheers.

ShootingStarDragon avatar Sep 29 '22 18:09 ShootingStarDragon

so these commands are to ffprobe-all, but ffpyplayer is a port of ffplay, which does not have these commands. very suspicious

ShootingStarDragon avatar Oct 03 '22 02:10 ShootingStarDragon

typing this for the manual in the terminal ffplay -h > "ffplay h.txt" gets me these:

http AVOptions:
...
...
  -reconnect         <boolean>    .D........ auto reconnect after disconnect before EOF (default false)
  -reconnect_at_eof  <boolean>    .D........ auto reconnect at EOF (default false)
  -reconnect_streamed <boolean>    .D........ auto reconnect streamed / non seekable streams (default false)
  -reconnect_delay_max <int>        .D........ max reconnect delay in seconds after which to give up (from 0 to 4294) (default 120)

ShootingStarDragon avatar Oct 03 '22 03:10 ShootingStarDragon