karthink / elfeed-tube

Youtube integration for Elfeed, the feed reader for Emacs
The Unlicense
249 stars 11 forks source link

elfeed-tube-mpv feels slow #16

Open ParetoOptimalDev opened 1 year ago

ParetoOptimalDev commented 1 year ago

I think if it reported progress as it downloads the video or even just said Starting mpv: Downloading XXMB video ✓ after Starting mpv: Connected to Elfeed ✓ it would fix things? Maybe it's more accurate to say "starting stream for video" if mplayer is just filling some buffer. And perhaps I can modify the buffer size on a stable internet connection to improve this a bit as well.

Or perhaps there are ways to improve things not starting so fast?

It looks like mpv https://youtu.be/DYeh7_FdmDg takes about 4 seconds for me and I see mpv doesn't output progress by default.

Skimming through the mpv manual I can't see a good way to do this. I suppose it's not that big of an issue, but in those 4 seconds I frequently think "is it working".

karthink commented 1 year ago

@ParetoOptimalDev I've pushed a lazy fix in 3842d564. By default the mpv window opens immediately. Let me know if this makes the feedback issue better or worse.

ParetoOptimalDev commented 1 year ago

This seems to be the best one can do to get some feedback asap:

mpv --osd-level=3 --force-window=immediate https://youtu.be/DYeh7_FdmDg

Alternatively... maybe blocking until the video is ready to play, using a sentinel, and having a rotating progress bar in message area would be better?

Like:

(defun circular-progress-bar ()
  "Show a circular progress bar animation."
  (interactive)
  (let ((bar-sequence "-\\|/"))
    (cl-loop while t do
        (dolist (char (string-to-list bar-sequence))
          (message (format "[%c]" char))
          (sleep-for 0.1)))))

(circular-progress-bar)
ParetoOptimalDev commented 1 year ago

https://github.com/torque/mpv-progressbar apparently also does this behavior and guesses at progress and gives some sort of feedback based on bitrate.

ParetoOptimalDev commented 1 year ago

Another thing I tried but forgot to post:

mpv --cache=yes --osd-level=3 --osd-msg3='waiting for cache: ${seeking} cache %: ${cache-buffering-state}' --force-window=immediate https://youtu.be/DYeh7_FdmDgmpv --load-stats-overlay=yes

The docs for cache-buffering-state say:

cache-buffering-state The percentage (0-100) of the cache fill status until the player will unpause (related to paused-for-cache).

So my hope was that it would immediately print number representing % of cache buffer filled. Sadly what happens is:

ParetoOptimalDev commented 1 year ago

Also, thanks very much for the quick response. Wanted to make sure I mentioned that in case my commentary came across as anything as less than grateful :heart:

karthink commented 1 year ago

This seems to be the best one can do to get some feedback asap:

mpv --osd-level=3 --force-window=immediate https://youtu.be/DYeh7_FdmDg

From reading the man page, it looks like --force-window=immediate (as opposed to "yes") can cause other issues. Any idea what those issues are?

Alternatively... maybe blocking until the video is ready to play, using a sentinel, and having a rotating progress bar in message area would be better?

How would Emacs know when the video is ready to play?