thumbfast icon indicating copy to clipboard operation
thumbfast copied to clipboard

Support pre-generated web thumbnails

Open po5 opened this issue 10 months ago • 2 comments

Supports YouTube videos and Twitch VODs. cf. #3, #111 No actual logic is specific to those sites, it's just that yt-dlp doesn't currently support anything else. I may make PRs to yt-dlp later implementing "storyboards" for more websites.

It's good enough that I'd like others to try it and report issues. Commits are a mess because I'm still experimenting a lot, they'll be squashed eventually.

I wonder if it may be possible to avoid spinning up a whole mpv process for each atlas, and instead use EDL or lavf:// to open multiple images and save them separately with an output template.

TODO:

  • Reorganize the code, remove useless stuff
  • Test with private videos (forward cookies setting)
  • Better feedback if yt-dlp isn't found
  • Mirror video filters to storyboard thumbnails (e.g. rotation, flipping, cropping)
  • Even quicker thumbnail prioritization (by reserving n slots to the cursor?)
  • Make it work nicely with the raw thumbfast-render API (even though there are currently no users of it)
  • Make sure we never crash when switching between files
  • Make sure we don't try to render thumbnails before they're written
  • Make regular network thumbnailing placeholder consistent with this? (only broadcast info once we have the first thumbnail's dimensions, or the other way around, broadcast estimated dimensions before we get back the storyboard data)
  • Make sure that absolutely everything is still fine with regular thumbnailing
  • Fix audio crackling when spawning fragment downloads (happens even with --ao=null --ao-null-untimed) likely an mpv bug

My primary test videos:

  • Short vid https://www.youtube.com/watch?v=HOpbPQGEH9k
  • Long vid https://www.youtube.com/watch?v=fKM2NYABFFc
  • Wrong thumbnail width reported by YouTube (159 instead of 160) https://www.youtube.com/watch?v=3To5DZ65n0U

po5 avatar Apr 08 '25 07:04 po5

On Windows beside reverting https://github.com/po5/thumbfast/commit/9deb0733c4e36938cf90e42ddfb7a19a8b2f4641 i also had to remove --vo=null to get it working.

Using --vo=null ends with an error: thumbfast: storyboard download failed atlas: 2 status: 2. The subprocess terminates without generating any .bgra files.

[   0.248][v][demux] Detected file format: webp_pipe (libavformat)
[   0.248][v][cplayer] Opening done: https://i.ytimg.com/sb/HOpbPQGEH9k/storyboard3_L3/M6.jpg?sqp=-oaymwENSDfyq4qpAwVwAcABBqLzl_8DBgjQ5MWpBg==&sigh=rs$AOn4CLAmRjZeNEAFVmD_SSdYuAV5WVIAiQ
[   0.248][v][cplayer] Running hook: auto_profiles/on_preloaded
[   0.248][v][cplayer] Failed sending hook command auto_profiles/on_preloaded. Removing hook.
[   0.248][v][lavf] select track 0
[   0.248][i][cplayer] ● Image  --vid=1  (webp 972x540)
[   0.248][f][cplayer] Error opening/initializing the selected video_out (--vo) device.
[   0.248][v][lavf] deselect track 0
[   0.248][i][cplayer] Video: no video
[   0.248][f][cplayer] No video or audio streams selected.
[   0.248][d][cplayer] Terminating demuxers...
[   0.248][d][ffmpeg] AVIOContext: Statistics: 41056 bytes read, 0 seeks
[   0.248][d][cplayer] Done terminating demuxers.
[   0.248][v][cplayer] finished playback, no audio or video data played (reason 4)
[   0.248][f][encode] no data written to target file
[   0.248][i][cplayer] Exiting... (Interrupted by error)
[   0.248][d][positioning] Destroying client handle...
[   0.248][d][cplayer] Run command: del, flags=64, args=[name="user-data/mpv/console"]
[   0.248][d][select] Destroying client handle...
[   0.248][d][commands] Destroying client handle...
[   0.249][d][stats] Destroying client handle...
[   0.249][d][console] Destroying client handle...
[   0.251][d][SystemMediaTransportControls] Destroying client handle...

Also about Twitch vods, i wonder if this won't be a potential issue here.

Sneakpeakcss avatar Apr 08 '25 19:04 Sneakpeakcss

Can reproduce, turns out in newer mpv versions (0.39+?) vo=null no longer works with the encoding mode? I removed it. I'll look into the issue with 9deb0733c4e36938cf90e42ddfb7a19a8b2f4641 next time I boot into Windows.

Also about Twitch vods, i wonder if https://github.com/mpv-player/mpv/issues/14840 won't be a potential issue here.

This is also a newly introduced issue, and it's completely irrelevant to us. They'll fix it eventually, probably.

Love running into new issues after updating mpv, wonder what else it broke (: Edit: Looks like you can no longer set an empty value for input-commands in an auto-profile, mpv will straight up refuse to run. Fun.

po5 avatar Apr 09 '25 13:04 po5