youtube-viewer icon indicating copy to clipboard operation
youtube-viewer copied to clipboard

Slow caching of the video stream

Open ZaxonXP opened this issue 2 years ago • 3 comments

I am using the latest version 3.9.9

Not sure if the--ytdl option is used for playback, but if I use with or without that option, the playback is not continuous as the buffer is ran out and it needs few seconds to fill it in. Then after few seconds the situation repeat.

I noticed that also youtube-dl downloads slow, but not the yt-dlp which downloads fast.

Is there a way to use the yt-dlp instead youtube-dl to speed up caching?

Kind regards, Piotr

ZaxonXP avatar Apr 19 '22 12:04 ZaxonXP

hello, has anyone figured anything out about this? having the same issue

Soliprem avatar Jun 25 '22 00:06 Soliprem

yt-dlp is already used instead of youtube-dl if it is installed, the issue is that youtube throttles requests of more than 10MB at a time, yt-dlp works around it by making many requests of 10MB using Range HTTP headers, but ffmpeg (which does the downloading for mpv) doesn't support that yet.

For now you can try to work around it by letting yt-dlp do the download with yt-dlp -o - https://... | mpv -, but this breaks seeking to timestamps that haven't been cached yet, other than not setting the media title, the chapter list and subtitles.

You can also try the files with contain both video and audio which are throttled less: mpv --ytdl-format='[height=360]' https://..., mpv --ytdl-format=best https://...

guidocella avatar Jun 25 '22 07:06 guidocella

Um, I thought this was the mpv repo lol. What I wrote I still correct if you copy URLs and open them in mpv but I don't think you can select the video+audio files with youtube-viewer, that may be nice to support since they download faster.

I also noticed that with video-only streams the lower the resolution the more you are throttled, so lowering the resolution doesn't help you download faster. So the fastest format to download is 360p single-file video+audio.

guidocella avatar Jun 25 '22 14:06 guidocella

We fixed this issue in the pipe-viewer repository (a fork that parses the YouTube website directly, it does not require a YouTube API key).

sun95n avatar Apr 19 '23 04:04 sun95n

Close the issue?

ItsTerm1n4l avatar Apr 28 '23 14:04 ItsTerm1n4l

I found some solution for this with the latest mpv build (0.35.0-386-gacababec20). Selecting the audio and video tracks can be done via mpv.config. I have something like this in mine:

script-opts=ytdl_hook-ytdl_path=/home/user/.local/bin/yt-dlp
script-opts=ytdl-format=bestvideo[width<=?1920]+bestaudio/bestvideo[height<=?1080]+bestaudio/bestvideo[width<=?1280][fps<=?30][vcodec!=?vp9]+bestaudio/bestvideo[height<=?480]/lq/vl/0
ytdl-format=bestvideo[width<=?1920]+bestaudio/bestvideo[height<=?1080]+bestaudio/bestvideo[width<=?1280][fps<=?30][vcodec!=?vp9]+bestaudio/bestvideo[height<=?480]/lq/vl/0

If for the youtube-viewer fix is not possible, then I will close this issue.

ZaxonXP avatar May 16 '23 11:05 ZaxonXP