marzzzello / mpv_thumbnail_script

A Lua script to show preview thumbnails in mpv's OSC seekbar, sans external dependencies (fork)
GNU General Public License v3.0
270 stars 20 forks source link

Support for YT storyboard #23

Closed ftk closed 2 years ago

ftk commented 2 years ago

Calls yt-dlp to get URLs with thumbnail atlases("storyboard") if it's a network stream (format "sb0"). Then downloads these atlases and splits them into thumbnails. This allows for much faster thumbnail generation (a few seconds). Currently yt-dlp only supports storyboards for youtube. This PR assumes 5x5 atlases (currently yt-dlp doesn't expose atlas dimensions, I'll open a PR to yt-dlp later)

marzzzello commented 2 years ago

Thanks! This is really nice and allows to display the thumbnails for youtube much faster. I tested it and everything looks good so far. I'll merge and create a pre-release to get more feedback.

paseu commented 2 years ago

It is super fast, but it's not following mpv_thumbnail_script.conf(remote_max_delta and remote_thumbnail_count). In case of short videos, it seems to generate 5 seconds apart thumbnails and it generates 10 seconds apart thumbnails in case of several hours videos(I tested 7 and 10 hours videos on youtube)

marzzzello commented 2 years ago

@paseu yes, I don't think it's a big issue as it doesn't use much CPU. It just uses more bandwidth but that's negligible for youtube streaming. Or what's your reason for wanting less (or more?) thumbnails?

paseu commented 2 years ago

First, thumbnails are saved in /tmp/ so they take memory(playing 10 hour video, it generated 3600 thumbnails over 200MB). Also I got error messages while script generating thumbnails of long videos(maybe several hours.. in my case i got error playing 7hour video) and thumbnail script did not complete generating thumbnails. I'm not saying this patch is bad, just report some error messages and problems.

error message from mpv [youtube address] -v

... [mpv_thumbnail_script_server] Too many events queued. //Maybe this is not this patch's fault? [mpv_thumbnail_script_server_4] Output file missing! /tmp/mpv_thumbs_cache/watchvAgpWX18dby4-0/000114.bgra.atlas ...

After these messages, it stopped generating thumbnails.

I made more mpv_thumbnail_script_server-[num].lua files then less errors occured but still did.