Giter VIP home page Giter VIP logo

mpv_thumbnail_script's Introduction

mpv_thumbnail_script.lua

Click the image (or here) to view a YouTube video of the script in action

(You might also be interested in mpv_crop_script.lua)


What is it?

mpv_thumbnail_script.lua is a script/replacement OSC for mpv to display preview thumbnails when hovering over the seekbar, without any external dependencies1, cross-platform-ly2!

The script supports all four built-in OSC layouts, as seen in this Youtube video.
The script will also do multiple passes over the video, generating thumbnails with increasing frequency until the target is reached. This allows you to preview the end of the file before every thumbnail has been generated.

How do I install it?

Grab both the two .luas from the releases page and place them both to your mpv's scripts directory.

For example:

  • Linux/Unix/Mac: ~/.config/mpv/scripts/mpv_thumbnail_script_server.lua & ~/.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua
  • Windows: %APPDATA%\mpv\scripts\mpv_thumbnail_script_server.lua & %APPDATA%\mpv\scripts\mpv_thumbnail_script_client_osc.lua

(See the Files section in mpv's manual for more info.)

You should also read the Configuration section.

While the script doesn't need external dependencies and can work with mpv alone, it can also use FFmpeg for slightly faster thumbnail generation; just make sure ffmpeg[.exe] is in your PATH and prefer_mpv is set to no in your configuration.

However, FFmpeg does not support "ordered chapters" in MKVs (segment linking, ie. an .mkv references another .mkv), which can break the thumbnailing process. You have been warned.

In general, you should just use multiple worker scripts (Configuration) instead of taking the FFmpeg-risk.

Note: You will need a rather new version of mpv due to the new binds used in the patched osc.lua.

How do I use it?

Just open a file and hover over the seekbar!
Although by default, videos over an hour will require you to press the T (that's shift+t) keybind. You may change this duration check in the configuration (autogenerate_max_duration).

Also of note: the script does not manage the thumbnails in any way, you should clear the directory from time to time.

Configuration

Note! Because this script replaces the built-in OSC, you will have to set osc=no in your mpv's main config file.

Multithreading:
This script can use multiple concurrent thumbnailing jobs.
Simply copy the mpv_thumbnail_script_server.lua once or twice (mpv_thumbnail_script_server-1.lua, mpv_thumbnail_script_server-2.lua) and the workers will automatically register themselves with the core.
This improves thumbnailing speed a bunch, but you will quickly max out your CPU - I recommend only having two or three copies of the script.
(Why multiple copies of the same file? mpv gives each script their own thread - easy multithreading!)

To adjust the script's options, create a file called mpv_thumbnail_script.conf inside your mpv's lua-settings directory.

For example:

  • Linux/Unix/Mac: ~/.config/mpv/lua-settings/mpv_thumbnail_script.conf
  • Windows: %APPDATA%\mpv\lua-settings\mpv_thumbnail_script.conf

(See the Files section in mpv's manual for more info.)

In this file you may set the following options:

# The thumbnail cache directory.
# On Windows this defaults to %TEMP%\mpv_thumbs_cache,
# and on other platforms to /tmp/mpv_thumbs_cache.
# The directory will be created automatically, but must be writeable!
# Use absolute paths, and take note that environment variables like %TEMP% are unsupported (despite the default)!
cache_directory=/tmp/my_mpv_thumbnails
# THIS IS NOT A WINDOWS PATH. COMMENT IT OUT OR ADJUST IT YOURSELF.

# Whether to generate thumbnails automatically on video load, without a keypress
# Defaults to yes
autogenerate=[yes/no]

# Only automatically thumbnail videos shorter than this (in seconds)
# You will have to press T (or your own keybind) to enable the thumbnail previews
# Set to 0 to disable the check, ie. thumbnail videos no matter how long they are
# Defaults to 3600 (one hour)
autogenerate_max_duration=3600

# Use mpv to generate thumbnail even if ffmpeg is found in PATH
# ffmpeg is slightly faster than mpv but lacks support for ordered chapters in MKVs,
# which can break the resulting thumbnails. You have been warned.
# Defaults to yes (don't use ffmpeg)
prefer_mpv=[yes/no]

# Explicitly disable subtitles on the mpv sub-calls
# mpv can and will by default render subtitles into the thumbnails.
# If this is not what you wish, set mpv_no_sub to yes
# Defaults to no
mpv_no_sub=[yes/no]

# Enable to disable the built-in keybind ("T") to add your own, see after the block
disable_keybinds=[yes/no]

# The maximum dimensions of the thumbnails, in pixels
# Defaults to 200 and 200
thumbnail_width=200
thumbnail_height=200

# The thumbnail count target
# (This will result in a thumbnail every ~10 seconds for a 25 minute video)
thumbnail_count=150

# The above target count will be adjusted by the minimum and
# maximum time difference between thumbnails.
# The thumbnail_count will be used to calculate a target separation,
# and min/max_delta will be used to constrict it.

# In other words, thumbnails will be:
# - at least min_delta seconds apart (limiting the amount)
# - at most max_delta seconds apart (raising the amount if needed)
# Defaults to 5 and 90, values are seconds
min_delta=5
max_delta=90
# 120 seconds aka 2 minutes will add more thumbnails only when the video is over 5 hours long!

# Below are overrides for remote urls (you generally want less thumbnails, because it's slow!)
# Thumbnailing network paths will be done with mpv (leveraging youtube-dl)

# Allow thumbnailing network paths (naive check for "://")
# Defaults to no
thumbnail_network=[yes/no]
# Override thumbnail count, min/max delta, as above
remote_thumbnail_count=60
remote_min_delta=15
remote_max_delta=120

# Try to grab the raw stream and disable ytdl for the mpv subcalls
# Much faster than passing the url to ytdl again, but may cause problems with some sites
# Defaults to yes
remote_direct_stream=[yes/no]

(see src/options.lua for all possible options)

With disable_keybind=yes, you can add your own keybind to input.conf with script-binding generate-thumbnails, for example:

shift+alt+s script-binding generate-thumbnails

Development

Included in the repository is the concat_files.py tool I use for automatically concatenating files upon their change, and also mapping changes to the output file back to the source files. It's really handy on stack traces when mpv gives you a line and column on the output file - no need to hunt down the right place in the source files!

The script requires Python 3, so install that. Nothing more, though. Call it with concat_files.py cat_osc.json.

You may also, of course, just cat the files together yourself. See the cat_osc.json/cat_server.json for the order.

Donation

If you really get a kick out of this (weirdo), you can paypal me or send bitcoins to 1K9FH7J3YuC9EnQjjDZJtM4EFUudHQr52d. Just having the option there, is all.

Footnotes

1You may need to add mpv[.exe] to your PATH (and will have to add ffmpeg[.exe] if you want faster generation).

2Developed & tested on Windows and Linux (Ubuntu), but it should work on Mac and whatnot as well, if 1 has been taken care of.

mpv_thumbnail_script's People

Contributors

djdv avatar ento avatar nottsunami avatar theamm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpv_thumbnail_script's Issues

crash similar too #11 on 0.4.2

It looks like issue #11 but I'm using 0.4.2 so this should have been fixed in that release. It happen when moving between files in a directory with a key bound to the command playlist-prev.
Here is the error:

[mpv_thumbnail_script_client_osc]
[mpv_thumbnail_script_client_osc] stack traceback:
[mpv_thumbnail_script_client_osc]       [C]: in function 'max'
[mpv_thumbnail_script_client_osc]       .../.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua:857: in function 'on_thumb_progress'
[mpv_thumbnail_script_client_osc]       .../.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua:1061: in function 'handler'
[mpv_thumbnail_script_client_osc]       mp.defaults:339: in function 'handler'
[mpv_thumbnail_script_client_osc]       mp.defaults:459: in function 'call_event_handlers'
[mpv_thumbnail_script_client_osc]       mp.defaults:496: in function 'dispatch_events'
[mpv_thumbnail_script_client_osc]       mp.defaults:452: in function <mp.defaults:451>
[mpv_thumbnail_script_client_osc]       [C]: in ?
[mpv_thumbnail_script_client_osc]       [C]: in ?
[mpv_thumbnail_script_client_osc] Lua error: .../.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua:857: bad argument #1 to 'max' (number expected, got nil)
     Subs  --sid=1 (subrip)
No video or audio streams selected.

Can't regenerate thumbnails

Can't regenerate thumbnails on full file that was downloaded and opened partially. When I open a file that was downloaded partially and trying to regenerate thumbnails when it has downloaded using Shift+T it stays old (e.g. 2 thumbs of 150). Is it a way to regenerate thumbs without clearing cache and restarting player? Started thumbnails jobs appears, but nothing happens.

Unstable behaviour while catching thumbs (with mpv)

Till the thumbnails' caching is done, a "ghost instance" of mpv jumps like crazy in the dock; till all thumbs are generated it is impossible to access mpv in fullscreen mode as it just keeps changing space (screen). This behaviour happens both in shorter than 3600" videos and in longer ones - script trigered by keybind. NOT the case if using ffmpeg as per lua seting conf.

mpv 0.27.0
OSX 10.11.6
mpv_thumbnail_script 0.3.0

Have to say, great plug!! Congrats and thank you =)

Script is broken on 0.29.0-353 git 65b1c2d

It works just fine on 0.29.0-318 git g17ad1e. On the latest version it never starts generating thumbnails, but I've noticed it can use thumbnails that are already cached.

FFmpeg does not use ordered chapters

https://trac.ffmpeg.org/ticket/3123
This means MKVs with multiple segments will fail to generate thumbnails for the end of the file (because mpv figures the total duration and ffmpeg doesn't consider the other segments).
mpv handles them fine, but is slower in comparison.

Figure out a way to check if file uses ordered chapters and fall back to mpv
or start messing with parsing the segment list and concat filters 🤢

Or maybe invest into multiple worker threads and ditch ffmpeg.

attempt to compare nil with number

Hi,

After playing an .avi video and quitting using Q, the following error was printed:

[mpv_thumbnail_script_client_osc] 
[mpv_thumbnail_script_client_osc] stack traceback:
[mpv_thumbnail_script_client_osc] 	.../.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua:1080: in function 'prop'
[mpv_thumbnail_script_client_osc] 	mp.defaults:392: in function 'handler'
[mpv_thumbnail_script_client_osc] 	mp.defaults:486: in function 'call_event_handlers'
[mpv_thumbnail_script_client_osc] 	mp.defaults:520: in function 'dispatch_events'
[mpv_thumbnail_script_client_osc] 	mp.defaults:479: in function <mp.defaults:478>
[mpv_thumbnail_script_client_osc] 	[C]: in ?
[mpv_thumbnail_script_client_osc] 	[C]: in ?
[mpv_thumbnail_script_client_osc] Lua error: .../.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua:1080: attempt to compare nil with number

HTH.

Thumbnailing is not working anymore on Windows mpv build

i try new build andi get this error

[   0.006][w][cplayer] Warning: option --o is deprecated and might be removed in the future (lack of maintainer).
[   0.006][f][cplayer] Error parsing commandline option o: option requires parameter
[   0.006][w][cplayer] Make sure you're using e.g. '--o=value' instead of '--o value'.
[   0.006][i][cplayer] Exiting... (Fatal error)

and console output is

PS C:\Program Files\mpv player> mpv poki.mkv
[mpv_thumbnail_script_client_osc] The 'tracks-changed' event is deprecated and will be removed.
 (+) Video --vid=1 (*) (h264 1280x720 24.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
 (+) Subs  --sid=1 (*) (ass)
AO: [wasapi] 48000Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:00:00 / 00:24:35 (0%) A-V:  0.000
[mpv_thumbnail_script_client_osc] The 'tick' event is deprecated and will be removed.
AV: 00:00:00 / 00:24:35 (0%) A-V:  0.000
[mpv_thumbnail_script_server] Thumbnailing command failed!
[mpv_thumbnail_script_server] mpv process error: nil
[mpv_thumbnail_script_server] Process stdout:
[mpv_thumbnail_script_server] Debug log: C:\Program Files\mpv player\portable_config\watch_later\poki-467305219\000000.bgra.log
[mpv_thumbnail_script_server] Output file missing! C:\Program Files\mpv player\portable_config\watch_later\poki-467305219\000000.bgra

Thumbnail not work on MacOS

MacOS 10.14.4
mpv 0.32.0

Install MPV via brew cask (support added to Applications ) brew cask install mpv
I added these lines intro /Applications/mpv.app/Contents/Resources/mpv.conf

player-operation-mode=pseudo-gui
osc=no
load-scripts=yes

Copied 2 files mpv_thumbnail_script_client_osc.lua mpv_thumbnail_script_server.lua to ~/.config/mpv/scripts/
Open MPV to try thumbnail on seek bar but not work.
Please what I went wrong ?

Thumbnailing works for local videos but not remote videos (Youtube, Vimeo)

On Windows 10. Thumbnailing works for local videos but fails for remote videos - with no obvious warnings or errors. I've only tried Youtube and Vimeo. Any help would be appreciated. Thanks in advance.

Log file:
mpv-log.txt

mpv.conf

no-border
#cache=1048576
cursor-autohide=200
keep-open
autofit-larger=100%x95%
#cursor-autohide-fs-only
pause=no
no-pause
# For thumbnails lua script:
osc=no



[extension.jpg]
#osd-level=0
#osd-bar=no
pause=yes

[extension.png]
#osd-level=0
#osd-bar=no
pause=yes

[extension.gif]
loop-file=yes
no-pause

[extension.webm]
loop-file=yes
no-pause

[extension.mp4]
loop-file=yes
no-pause

console output:

~
> mpv https://www.youtube.com/watch?v=MkE2lxkw00w
Playing: https://www.youtube.com/watch?v=MkE2lxkw00w
 (+) Video --vid=1 (*) (vp9 320x240 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) 'DASH audio' (vorbis 2ch 44100Hz) (external)
AO: [wasapi] 44100Hz stereo 2ch float
VO: [gpu] 320x240 yuv420p
(Paused) AV: 00:00:00 / 00:03:14 (0%) A-V:  0.000 Cache: 193s+5MB

mpv --version:

~
> mpv --version
mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
ffmpeg library versions:
   libavutil       56.19.101
   libavcodec      58.30.100
   libavformat     58.18.100
   libswscale      5.2.100
   libavfilter     7.31.100
   libswresample   3.2.100
ffmpeg version: 4.1+1209.ge320f9576a

Screenshot:
mpv-thumbnailing2

Thumbnailing failed on Windows

I get this error "thumbnailing failed, check console for details'. Not sure if I did something wrong.

Here's my log: https://hastebin.com/yofowemabe.md

And my mpv_thumbnail_script.conf:

# The thumbnail cache directory.
# On Windows this defaults to %TEMP%\mpv_thumbs_cache,
# and on other platforms to /tmp/mpv_thumbs_cache.
# The directory will be created automatically, but must be writeable!
# Use absolute paths, and take note that environment variables like %TEMP% are unsupported (despite the default)!
cache_directory=/tmp/my_mpv_thumbnails

# Whether to generate thumbnails automatically on video load, without a keypress
# Defaults to yes
autogenerate=yes

# Only automatically thumbnail videos shorter than this (in seconds)
# You will have to press T (or your own keybind) to enable the thumbnail previews
# Set to 0 to disable the check, ie. thumbnail videos no matter how long they are
# Defaults to 3600 (one hour)
autogenerate_max_duration=3600

# Use mpv to generate thumbnail even if ffmpeg is found in PATH
# It's better to use ffmpeg, but the choice is yours
# Defaults to no
prefer_mpv=yes

# Enable to disable the built-in keybind ("T") to add your own, see after the block
disable_keybinds=no

# The maximum dimensions of the thumbnails, in pixels
# Defaults to 200 and 200
thumbnail_width=200
thumbnail_height=200

# The thumbnail count target
# (This will result in a thumbnail every ~10 seconds for a 25 minute video)
thumbnail_count=150

# The above target count will be adjusted by the minimum and
# maximum time difference between thumbnails.
# The thumbnail_count will be used to calculate a target separation,
# and min/max_delta will be used to constrict it.

# In other words, thumbnails will be:
# - at least min_delta seconds apart (limiting the amount)
# - at most max_delta seconds apart (raising the amount if needed)
# Defaults to 5 and 90, values are seconds
min_delta=5
max_delta=90
# 120 seconds aka 2 minutes will add more thumbnails only when the video is over 5 hours long!

packaging

Hi
I was searching this featur for mpv since 2016 😄
till today someone post your script github on that issue.
thank you for your amazing helpful script. 🌹
I can package it for debian/ubuntu/arch/windows if you want easy install

Thumbnailing failed on some youtube DASH videos

When mpv opens DASH and audio streams separately or only the DASH stream, thumbnailing is failed with this message:

$ mpv --ytdl-format=135 https://www.youtube.com/watch?v=oM36vTQOkP0
Playing: https://www.youtube.com/watch?v=oM36vTQOkP0
 (+) Video --vid=1 (*) (h264 642x480)
VO: [opengl] 642x480 yuv420p
V: 00:00:00 / 00:19:26 (0%) DS: 2.500/0 Cache:  4s
[mpv_thumbnail_script_client_osc] Creating /dev/shm/DC-1_runtime/cache/mpv_thumbnails/watchvoM36vTQOkP0-0 
V: 00:00:00 / 00:19:26 (0%) DS: 2.333/0 Cache:  4s
[mpv_thumbnail_script_server] Thumbnailing command failed! 
[mpv_thumbnail_script_server] init 
[mpv_thumbnail_script_server]  
[mpv_thumbnail_script_server] Debug log: /dev/shm/DC-1_runtime/cache/mpv_thumbnails/watchvoM36vTQOkP0-0/000000.bgra.log 
[mpv_thumbnail_script_server] Output file missing! /dev/shm/DC-1_runtime/cache/mpv_thumbnails/watchvoM36vTQOkP0-0/000000.bgra 

The log file is completely missing. When using --ytdl-format=18 the thumbnailing is ok.

Not all videos are failing, but I can't see the differences between them. For example this works:

$ mpv --ytdl-format=135 https://www.youtube.com/watch?v=7rG7wPCcxmw                                                                                                    
Playing: https://www.youtube.com/watch?v=7rG7wPCcxmw
 (+) Video --vid=1 (*) (h264 854x480 25.000fps)
 (+) Subs  --sid=1 --slang=en 'vtt' (webvtt) (external)
VO: [opengl] 854x480 yuv420p
V: 00:00:00 / 00:11:22 (0%) DS: 2.500/0 Cache:  9s+0KB
[mpv_thumbnail_script_client_osc] Creating /dev/shm/DC-1_runtime/cache/mpv_thumbnails/watchv7rG7wPCcxmw-0 
V: 00:00:08 / 00:11:22 (1%) DS: 2.400/1 Cache: 80s+21MB

[suggestion] Optimize high CPU and resource usage

Hi, thanks again for the script. After I got it working, I saw that it uses a lot of resources, it maxes out all cores of my CPU for a minute or two on startup. I tried reducing the size and number of thumbnails, which helps, but it still makes my laptop's fans come on and can interfere with the video playback.

I had been looking for something like IINA on the Mac does, it seems to be able to make thumbnails almost instantly, and without heavy resource usage. Also it doesn't seem to leave thumbnails behind on the drive, that need cleaning out. I don't know how they do that, but maybe you'd like to take a look at their code?

autogenerate does not work

No matter what I put in the config file, autogenerating does not work, I have to press the key-binding, which on the other hand works fine.

As per default, this should work, but it does not. I guess, it has something to do with self.state.available, whatever that does in detail. the autogenerate-values is only used once and that is in an if-statement, asking if it is true but it is &&-linked with the self.state.available, which seems to be set to false in some functions.

SMPlayer

This is cool wish it work with smplayer.

Not sure if maybe I need to add a setting or something

lua index error

Lua error: ...\AppData\Roaming\mpv\manuel-load-scripts\osc.lua:86: attempt to index global 'Thumbnailer' (a nil value)

thumbnail size relative to window size

It would be great to be able to specify thumbnail_height and thumbnail_width as a relative value to the current window size.

ATM with the default settings, resizing a window to say 480p would generate thumbnails that take a lot of space, but then setting the same window in full screen on a 4k screen we would end up with tiny thumbnails. Setting thumbnails size to, for example 20% of the current window, we would have an appropriate sized thumbnail whatever the size of the window we watch the video in.

race condition(?) crashing mpv_thumbnail_script

Sometimes mpv_thumbnail_script_client_osc crashes leaving me with no OSC (but videos continue playing). This is a bit tricky to replicate since I've only noticed it happening when I'm rapidly changing the playing file with loadfile over JSON IPC.

Seemingly what happens is mpv starts to load one file, then shortly later (within a second or so) another loadfile command comes through. It seems to be timing sensitive since rapidly sending back to back loadfile commands won't always trigger this, but I can usually trigger the bug after a few seconds of trying.

In the following logfile snippet there are two loadfile commands initiated by IPC, the first at [0.026] and the second at [0.594]. Shortly after the second at [0.632], mpv_thumbnail_script_client_osc crashes:

[   0.026][v][ipc_0] Client connected
[   0.026][d][cplayer] Run command: loadfile, flags=0, args=[/private/tmp/mpv-test/su-25.webm, replace, ]
...
[   0.045][d][mpv_thumbnail_script_server_2] Loading lua script /Users/john/.config/mpv/scripts/mpv_thumbnail_script_server-2.lua...
[   0.046][d][mpv_thumbnail_script_server_2] loading mp.defaults
[   0.047][d][mpv_thumbnail_script_server_2] loading file /Users/john/.config/mpv/scripts/mpv_thumbnail_script_server-2.lua
[   0.049][d][mpv_thumbnail_script_server_2] reading options for mpv_thumbnail_script 
[   0.054][d][mpv_thumbnail_script_client_osc] Loading lua script /Users/john/.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua...
[   0.054][d][mpv_thumbnail_script_client_osc] loading mp.defaults
[   0.055][d][mpv_thumbnail_script_client_osc] loading file /Users/john/.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua
[   0.064][d][mpv_thumbnail_script_client_osc] reading options for mpv_thumbnail_script 
[   0.064][d][mpv_thumbnail_script_client_osc] reading options for osc 
[   0.064][v][mpv_thumbnail_script_client_osc] lua-settings/osc.conf not found. 
[   0.065][d][mpv_thumbnail_script_client_osc] osc_init 
[   0.076][d][mpv_thumbnail_script_server_1] Loading lua script /Users/john/.config/mpv/scripts/mpv_thumbnail_script_server-1.lua...
[   0.076][d][mpv_thumbnail_script_server_1] loading mp.defaults
[   0.077][d][mpv_thumbnail_script_server_1] loading file /Users/john/.config/mpv/scripts/mpv_thumbnail_script_server-1.lua
[   0.080][d][mpv_thumbnail_script_server_1] reading options for mpv_thumbnail_script 
[   0.089][v][file] Opening /private/tmp/mpv-test/su-25.webm
[   0.104][d][file] Stream opened successfully.
[   0.150][d][mpv_thumbnail_script_server_2] Announcing self to master... 
[   0.150][d][cplayer] Run command: script-message, flags=0, args=[mpv_thumbnail_script-worker, mpv_thumbnail_script_server_2]
[   0.150][d][mpv_thumbnail_script_client_osc] Registered worker mpv_thumbnail_script_server_2 
[   0.150][d][cplayer] Run command: script-message-to, flags=0, args=[mpv_thumbnail_script_server_2, mpv_thumbnail_script-slaved]
[   0.150][d][mpv_thumbnail_script_server_2] Successfully registered with master 
[   0.174][v][cplayer] Opening done: /private/tmp/mpv-test/su-25.webm
[   0.181][d][mpv_thumbnail_script_server_1] Announcing self to master... 
[   0.245][v][cplayer] Starting playback...
[   0.245][d][cplayer] Run command: script-message, flags=0, args=[mpv_thumbnail_script-worker, mpv_thumbnail_script_server_1]
[   0.246][d][mpv_thumbnail_script_client_osc] Registered worker mpv_thumbnail_script_server_1 
[   0.246][d][cplayer] Run command: script-message-to, flags=0, args=[mpv_thumbnail_script_server_1, mpv_thumbnail_script-slaved]
[   0.246][d][mpv_thumbnail_script_server_1] Successfully registered with master 
[   0.593][d][cplayer] Run command: script-message, flags=0, args=[thumbnails-generator-broadcast, gallery_thumbgen_2]
[   0.594][d][cplayer] Run command: script-message, flags=0, args=[thumbnails-generator-broadcast, gallery_thumbgen_1]
[   0.594][d][cplayer] Run command: loadfile, flags=0, args=[/private/tmp/mpv-test/pro-bicycling.webm, replace, ]
[   0.594][d][cplayer] Run command: script-message, flags=0, args=[thumbnails-generator-broadcast, gallery_thumbgen_1]
[   0.594][d][cplayer] Run command: script-message, flags=0, args=[thumbnails-generator-broadcast, gallery_thumbgen_2]
[   0.595][d][mpv_thumbnail_script_client_osc] Gathering video/thumbnail state 
[   0.595][d][cplayer] Run command: script-binding, flags=9, args=[mpv_thumbnail_script_client_osc/__keybinding2]
[   0.595][d][cplayer] Run command: seek, flags=9, args=[60.000000, relative, unused]
[   0.595][d][cplayer] Run command: seek, flags=9, args=[60.000000, relative, unused]
[   0.595][v][mkv] queuing seek to 120.000000
[   0.595][v][mkv] cached range 0: 0.000000 <-> 7.200000
[   0.595][v][cplayer] EOF code: 3  
[   0.595][v][cplayer] Running hook: peerflix_hook/on_unload
[   0.595][d][cplayer] Run command: hook-ack, flags=0, args=[on_unload]
[   0.595][v][vd] Uninit video.
[   0.628][d][cache] request seek: 0 <= to=920807 (cur=917504) <= 983040  
[   0.628][v][cache] Terminating cache...
[   0.628][v][cache] Cache exiting...
[   0.632][v][cplayer] finished playback, success (reason 2)
[   0.632][i][cplayer] 
[   0.632][i][cplayer] Auto-loading profile 'extension.webm'
[   0.632][d][cplayer] Setting option 'loop-file' = 'inf' (flags = 116)
[   0.632][i][cplayer] Playing: /private/tmp/mpv-test/pro-bicycling.webm
[   0.632][v][cplayer] Running hook: ytdl_hook/on_load
[   0.632][d][ytdl_hook] script running time: 4.1000000000069e-05 seconds 
[   0.632][d][cplayer] Run command: hook-ack, flags=0, args=[on_load]
[   0.632][w][mpv_thumbnail_script_client_osc] 
[   0.632][w][mpv_thumbnail_script_client_osc] stack traceback:
[   0.633][w][mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:942: in function 'get_thumbnail_size'
[   0.633][w][mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:887: in function 'update_state'
[   0.633][w][mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:869: in function 'on_video_change'
[   0.633][w][mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:1227: in function 'prop'
[   0.633][w][mpv_thumbnail_script_client_osc] 	mp.defaults:365: in function 'handler'
[   0.633][w][mpv_thumbnail_script_client_osc] 	mp.defaults:459: in function 'call_event_handlers'
[   0.633][w][mpv_thumbnail_script_client_osc] 	mp.defaults:496: in function 'dispatch_events'
[   0.633][w][mpv_thumbnail_script_client_osc] 	mp.defaults:452: in function <mp.defaults:451>
[   0.633][w][mpv_thumbnail_script_client_osc] 	[C]: ?
[   0.633][w][mpv_thumbnail_script_client_osc] 	[C]: ?
[   0.633][v][cplayer] Running hook: txt_hook/on_load
[   0.633][f][mpv_thumbnail_script_client_osc] Lua error: ...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:942: attempt to index local 'video_dec_params' (a nil value)
[   0.633][v][file] Opening /private/tmp/mpv-test/pro-bicycling.webm
[   0.636][v][mpv_thumbnail_script_client_osc] Exiting...

failed on password protected videos

the script doesn't handle username+password, so I can't use it on nicovideo.jp.
The debug log:

[   0.010][i][cplayer] Playing: http://smile-fnl21.nicovideo.jp/smile?m=26882407.33245low
[   0.010][v][ffmpeg] Opening http://smile-fnl21.nicovideo.jp/smile?m=26882407.33245low
[   3.877][w][ffmpeg] http: HTTP error 403 Forbidden
[   3.877][e][stream] Failed to open http://smile-fnl21.nicovideo.jp/smile?m=26882407.33245low.
[   3.877][v][cplayer] Opening failed or was aborted: http://smile-fnl21.nicovideo.jp/smile?m=26882407.33245low
[   3.877][v][cplayer] finished playback, loading failed (reason 4)
[   3.877][i][cplayer] 
[   3.877][i][cplayer] 
[   3.877][i][cplayer] Exiting... (Errors when loading file)

can i somehow make a keybind to STOP the thumbaniling process?

so i now there's a keybind to start the procces but for my needs it would be more usefull to make keybind for stopping to proccess.

when i need to open 2-3 videos to compare visual quality i dont want to wastefully generate thumbnails so i'll just stop it for those videos would be usefull but not sure how to implement it, can i get any help with this ?

thumbnailing for network path very slow. Isn't there a way to explicitly use lower resolutions for thumbnailing

@TheAMM Hi and first thank you for this amazing script. I had been using it for a few weeks, and it's really amazing.

However, thumbnailing for network paths is really slow, and uses much bandwidth. I tried both remote_direct_stream=yes and no.
Can't we set somewhere in the script, an option to use, say, 240p version of the stream for thumbnail generation?

(something like what happens in mpv when you include option
--ytdl-format="worstvideo[height>=240]/worst[height>=240]"

no more Shift+T for Floating (osx)

Hello ,

i installed your lua script for generating thumbnails,
and it works beautifully, thank you very much.

However, upon installing, afterwards i noticed some strange behaviour,
for example i can no longer let the window "float" on top.

when i press Shift-T now it says "Started Thumbnailer Jobs" instead of the desired "stay on top"

failed with long path

When i'm watching a video linked on facebook with a very long link, thumbnails can't be created

Playing: https://l.facebook.com/l.php?u=https%3A%2F%2Fyoutu.be%2F-E-FKChxM18&h=ATNoW6c2D1VOu07rOg7VBoAFNy6W3Bd0UU4fQAZX-vsz7ZjZRYnlkCwnlBmYO7tStj2J7aV6_GRwNAVarz_r7KMcLu9cHQ84MrwgmKbGmmmApxBdlu1BMMlUuUAzW3-uYnX5fK-P8Y3My3UdLEqxhq8GM1noRSBa_xuWogxZLSNuHWGI43M4yA0z0F3dcyCvGFIZ_Y_E-Tk5Lb0KPPOUnHV_ayjmaM_ofiqtSQn-UmC3dp4RC0Zb_AHq--hZ5FxY-qsyZkYI9UYV9EClexI4Kbn7B_XkDTzVCMxl
 (+) Video --vid=1 (*) (h264 640x480 25.000fps)
 (+) Audio --aid=1 --alang=und (*) 'DASH audio' (aac 2ch 44100Hz) (external)
Failed to create  for shader cache (No such file or directory)---disabling.
AO: [pulse] 44100Hz stereo 2ch float
[mpv_thumbnail_script_client_osc] Creating /dev/shm/DC-1_runtime/cache/mpv_thumbnails/-E-FKChxM18hATNoW6c2D1VOu07rOg7VBoAFNy6W3Bd0UU4fQAZX-vsz7ZjZRYnlkCwnlBmYO7tStj2J7aV6_GRwNAVarz_r7KMcLu9cHQ84MrwgmKbGmmmApxBdlu1BMMlUuUAzW3-uYnX5fK-P8Y3My3UdLEqxhq8GM1noRSBa_xuWogxZLSNuHWGI43M4yA0z0F3dcyCvGFIZ_Y_E-Tk5Lb0KPPOUnHV_ayjmaM_ofiqtSQn-UmC3dp4RC0Zb_AHq--hZ5FxY-qsyZkYI9UYV9EClexI4Kbn7B_XkDTzVCMxl-0
VO: [opengl] 640x480 yuv420p
[mpv_thumbnail_script_client_osc] mkdir: cannot create directory ‘/dev/shm/DC-1_runtime/cache/mpv_thumbnails/-E-FKChxM18hATNoW6c2D1VOu07rOg7VBoAFNy6W3Bd0UU4fQAZX-vsz7ZjZRYnlkCwnlBmYO7tStj2J7aV6_GRwNAVarz_r7KMcLu9cHQ84MrwgmKbGmmmApxBdlu1BMMlUuUAzW3-uYnX5fK-P8Y3My3UdLEqxhq8GM1noRSBa_xuWogxZLSNuHWGI43M4yA0z0F3dcyCvGFIZ_Y_E-Tk5Lb0KPPOUnHV_ayjmaM_ofiqtSQn-UmC3dp4RC0Zb_AHq--hZ5FxY-qsyZkYI9UYV9EClexI4Kbn7B_XkDTzVCMxl-0’: File name too long

You should use some kind of hash.

failed when using --dvd-device

When I'm watching a dvd from .iso file, the script is still trying read from real dvd device:

[mpv_thumbnail_script_server] Thumbnailing remote path, falling back on mpv. 
[mpv_thumbnail_script_server] libdvdnav: Using dvdnav version 6.0.0
[mpv_thumbnail_script_server] libdvdread: Could not open /dev/sr0 with libdvdcss.
[mpv_thumbnail_script_server] libdvdread: Can't open /dev/sr0 for reading
[mpv_thumbnail_script_server] libdvdnav: vm: failed to open/read the DVD
[mpv_thumbnail_script_server] Thumbnailing command failed! 
[mpv_thumbnail_script_server] mpv process error: nil 

I have an idea

Hello.
Now I find that the script can just generate all the preview thumbnail, which will lead to much high CPU usage for a long time. For I usually enjoy the movies while my computer's performance is poor, so I have to pause to wait for the completion of the generating the thumbnails.

So I have a plan, how could it generate the thumb when and where I want ......

0.4.0 crash - due to stream being re-created by filter changes

[mpv_thumbnail_script_client_osc] 
[mpv_thumbnail_script_client_osc] stack traceback:
[mpv_thumbnail_script_client_osc] 	[C]: in function 'max'
[mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:853: in function 'on_thumb_progress'
[mpv_thumbnail_script_client_osc] 	...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:1046: in function 'handler'
[mpv_thumbnail_script_client_osc] 	mp.defaults:339: in function 'handler'
[mpv_thumbnail_script_client_osc] 	mp.defaults:458: in function 'call_event_handlers'
[mpv_thumbnail_script_client_osc] 	mp.defaults:495: in function 'dispatch_events'
[mpv_thumbnail_script_client_osc] 	mp.defaults:451: in function <mp.defaults:450>
[mpv_thumbnail_script_client_osc] 	[C]: ?
[mpv_thumbnail_script_client_osc] 	[C]: ?
[mpv_thumbnail_script_client_osc] Lua error: ...nfig/mpv/scripts/mpv_thumbnail_script_client_osc.lua:853: bad argument #1 to 'max' (number expected, got nil)

If it's any help, I was using a fuse virtual filesystem to hold the video that triggered the bug, the file was actually hosted remotely, perhaps the seek broke some assumptions?

Can't click seekbar nor any on-screen buttons on Lubuntu

The thumbnails show up when I hover the cursor on the seekbar, but I can't click on it. If I doubleclick on the seekbar, the video goes fullscreen as if there was no UI.

I've tried this on my other laptop that also has Lubuntu and it doesn't work there either.

I'm using:
mpv_thumbnail_script v0.4.1
mpv 0.26.0
Lubuntu 17.10.1

When used with ffmpeg leverage vaapi for much faster generation

I've been experimenting with hw accelerated ffmpeg thumbnailer via changing ffmpeg command to:

    local ffmpeg_command = {
        "ffmpeg",
        "-loglevel", "quiet",
        "-noaccurate_seek",
        "-hwaccel", "vaapi",
        "-hwaccel_device", "/dev/dri/renderD128",
        "-hwaccel_output_format", "vaapi", 
        "-ss", format_time(timestamp, ":"),
        "-i", file_path,

        "-frames:v", "1",
        "-an",

        "-vf", ("scale_vaapi=%d:%d,scale_vaapi=format=rgb32,hwdownload,format=rgb32"):format(size.w, size.h),
        "-c:v", "rawvideo",
        "-pix_fmt", "bgra",
        "-f", "rawvideo",

        "-y", output_path
    }```


And it is much much faster. could it be used when ffmpeg is picked?

Thumbnailing command failed

Cannot generate thumbnail
Terminal response:

AV: 00:00:00 / 00:23:40 (0%) A-V:  0.000
[mpv_thumbnail_script_client_osc_3] The 'tick' event is deprecated and will be removed.
[mpv_thumbnail_script_client_osc_2] The 'tick' event is deprecated and will be removed.
[mpv_thumbnail_script_client_osc_1] The 'tick' event is deprecated and will be removed.
AV: 00:00:00 / 00:23:40 (0%) A-V: -0.000
[mpv_thumbnail_script_server_1] Thumbnailing command failed!
[mpv_thumbnail_script_server_1] mpv process error: nil
[mpv_thumbnail_script_server_1] Process stdout:
[mpv_thumbnail_script_server_1] Debug log: D:\Pictures\mpv\thumbnails\DMGRoku_de_Nashi_Majutsu_Koushi_to_Akashic_Records01BDRip1080PBIG5-274665133\000128.bgra.log
[mpv_thumbnail_script_server_1] Output file missing! D:\Pictures\mpv\thumbnails\DMGRoku_de_Nashi_Majutsu_Koushi_to_Akashic_Records01BDRip1080PBIG5-274665133\000128.bgra

Debug log:

[   0.010][v][cplayer] mpv 0.32.0-53-g1881698543 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[   0.010][v][cplayer]  built on Sun Feb  9 19:25:16 +08 2020
[   0.010][v][cplayer] ffmpeg library versions:
[   0.010][v][cplayer]    libavutil       56.39.100
[   0.010][v][cplayer]    libavcodec      58.68.100
[   0.010][v][cplayer]    libavformat     58.38.100
[   0.010][v][cplayer]    libswscale      5.6.100
[   0.010][v][cplayer]    libavfilter     7.75.100
[   0.010][v][cplayer]    libswresample   3.6.100
[   0.010][v][cplayer] ffmpeg version: git-2020-02-09-3f24e744a
[   0.010][v][cplayer] 
[   0.010][v][cplayer] Configuration: /home/shinchiro/build/build64/packages/mpv-prefix/src/mpv/waf configure --enable-static-build --enable-pdf-build --disable-manpage-build --enable-libmpv-shared --enable-lua --enable-javascript --enable-sdl2 --enable-libarchive --enable-libass --enable-libbluray --enable-dvdnav --enable-uchardet --enable-rubberband --enable-lcms2 --enable-openal --enable-spirv-cross --enable-vulkan --enable-vapoursynth --prefix=/home/shinchiro/build/build64/install/mingw
[   0.011][v][cplayer] List of enabled features: asm atomics build-date cplayer cuda-hwaccel cuda-interop d3d-hwaccel d3d11 d3d9-hwaccel debug-build direct3d dos-paths drmprime dvdnav egl-angle egl-angle-win32 egl-helpers ffmpeg ffnvcodec gl gl-dxinterop gl-dxinterop-d3d9 gl-win32 glob glob-win32 gnuc gpl iconv javascript jpeg lcms2 libarchive libass libass-osd libav-any libavcodec libavdevice libavutil libbluray libm libmpv-shared libplacebo lua luajit mingw noexecstack openal optimize plain-gl posix-or-mingw rubberband sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-static spirv-cross spirv-cross-static static-build stdatomic uchardet vapoursynth vulkan wasapi win32-desktop win32-internal-pthreads win32-pipes zlib
[   0.011][v][cplayer] Command line options: '--msg-level=all=no' '--no-ytdl' '--user-agent=libmpv' '--referrer=' '--hwdec=no' '--log-file=D:\Pictures\mpv\thumbnails\DMGRoku_de_Nashi_Majutsu_Koushi_to_Akashic_Records01BDRip1080PBIG5-274665133\000128.bgra.log' 'D:\Videos\不正经的魔术讲师\[DMG][Roku_de_Nashi_Majutsu_Koushi_to_Akashic_Records][01][BDRip][1080P][BIG5].mp4' '--start=1216.503846' '--frames=1' '--hr-seek=yes' '--no-audio' '--vf=scale=200:112' '--vf-add=format=bgra' '--of=rawvideo' '--ovc=rawvideo' '--o' 'D:\Pictures\mpv\thumbnails\DMGRoku_de_Nashi_Majutsu_Koushi_to_Akashic_Records01BDRip1080PBIG5-274665133\000128.bgra'
[   0.011][v][cplayer] mpv 0.32.0-53-g1881698543 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[   0.011][v][cplayer]  built on Sun Feb  9 19:25:16 +08 2020
[   0.011][v][cplayer] ffmpeg library versions:
[   0.011][v][cplayer]    libavutil       56.39.100
[   0.011][v][cplayer]    libavcodec      58.68.100
[   0.011][v][cplayer]    libavformat     58.38.100
[   0.011][v][cplayer]    libswscale      5.6.100
[   0.011][v][cplayer]    libavfilter     7.75.100
[   0.011][v][cplayer]    libswresample   3.6.100
[   0.011][v][cplayer] ffmpeg version: git-2020-02-09-3f24e744a
[   0.011][v][cplayer] 
[   0.011][v][cplayer] Configuration: /home/shinchiro/build/build64/packages/mpv-prefix/src/mpv/waf configure --enable-static-build --enable-pdf-build --disable-manpage-build --enable-libmpv-shared --enable-lua --enable-javascript --enable-sdl2 --enable-libarchive --enable-libass --enable-libbluray --enable-dvdnav --enable-uchardet --enable-rubberband --enable-lcms2 --enable-openal --enable-spirv-cross --enable-vulkan --enable-vapoursynth --prefix=/home/shinchiro/build/build64/install/mingw
[   0.011][v][cplayer] List of enabled features: asm atomics build-date cplayer cuda-hwaccel cuda-interop d3d-hwaccel d3d11 d3d9-hwaccel debug-build direct3d dos-paths drmprime dvdnav egl-angle egl-angle-win32 egl-helpers ffmpeg ffnvcodec gl gl-dxinterop gl-dxinterop-d3d9 gl-win32 glob glob-win32 gnuc gpl iconv javascript jpeg lcms2 libarchive libass libass-osd libav-any libavcodec libavdevice libavutil libbluray libm libmpv-shared libplacebo lua luajit mingw noexecstack openal optimize plain-gl posix-or-mingw rubberband sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-static spirv-cross spirv-cross-static static-build stdatomic uchardet vapoursynth vulkan wasapi win32-desktop win32-internal-pthreads win32-pipes zlib
[   0.013][d][global] config path: '' -> 'C:\Users\phoen\AppData\Roaming/mpv'
[   0.014][d][global] config path: 'encoding-profiles.conf' -/-> 'C:\Users\phoen\AppData\Roaming/mpv/encoding-profiles.conf'
[   0.014][d][global] config path: 'encoding-profiles.conf' -/-> 'C:/Apps/mpv/encoding-profiles.conf'
[   0.014][d][global] config path: 'encoding-profiles.conf' -/-> 'C:/Apps/mpv/mpv/encoding-profiles.conf'
[   0.015][d][global] config path: 'mpv.conf' -/-> 'C:\Users\phoen\AppData\Roaming/mpv/mpv.conf'
[   0.015][d][global] config path: 'config' -/-> 'C:\Users\phoen\AppData\Roaming/mpv/config'
[   0.016][d][global] config path: 'mpv.conf' -> 'C:/Apps/mpv/mpv.conf'
[   0.016][d][global] config path: 'config' -/-> 'C:/Apps/mpv/config'
[   0.016][d][global] config path: 'mpv.conf' -/-> 'C:/Apps/mpv/mpv/mpv.conf'
[   0.016][d][global] config path: 'config' -/-> 'C:/Apps/mpv/mpv/config'
[   0.016][v][cplayer] Reading config file C:/Apps/mpv/mpv.conf
[   0.017][v][cplayer] Applying profile 'default'...
[   0.017][v][cplayer] Setting option 'border' = 'no' (flags = 4)
[   0.017][v][cplayer] Setting option 'save-position-on-quit' = '' (flags = 4)
[   0.017][v][cplayer] Setting option 'osc' = 'no' (flags = 4)
[   0.017][v][cplayer] Setting option 'sub-auto' = 'fuzzy' (flags = 4)
[   0.017][v][cplayer] Setting option 'screenshot-jpeg-quality' = '100' (flags = 4)
[   0.017][v][cplayer] Setting option 'screenshot-template' = 'D:\Pictures\MPV\%f-%p' (flags = 4)
[   0.017][v][cplayer] Setting option 'priority' = 'high' (flags = 4)
[   0.017][v][cplayer] Setting option 'vo' = 'gpu' (flags = 4)
[   0.017][v][cplayer] Setting option 'hwdec' = 'auto' (flags = 4)
[   0.017][v][cplayer] Setting option 'gpu-context' = 'auto' (flags = 4)
[   0.017][v][cplayer] Setting option 'gpu-api' = 'auto' (flags = 4)
[   0.017][v][cplayer] Setting option 'autofit-larger' = '50%x50%' (flags = 4)
[   0.017][v][cplayer] Setting option 'geometry' = '49%x49%' (flags = 4)
[   0.017][v][cplayer] Setting option 'gpu-shader-cache-dir' = 'M:\Pictures\MPV\GPU_cache' (flags = 4)
[   0.018][v][cplayer] Setting option 'keep-open' = 'yes' (flags = 4)
[   0.018][v][cplayer] Setting option 'slang' = 'zh,chi' (flags = 4)
[   0.018][v][cplayer] Setting option 'icc-profile-auto' = '' (flags = 4)
[   0.018][v][cplayer] Setting option 'blend-subtitles' = 'video' (flags = 4)
[   0.018][v][cplayer] Setting option 'msg-level' = 'all=no' (flags = 8)
[   0.018][v][cplayer] Setting option 'ytdl' = 'no' (flags = 8)
[   0.018][v][cplayer] Setting option 'user-agent' = 'libmpv' (flags = 8)
[   0.018][v][cplayer] Setting option 'referrer' = '' (flags = 8)
[   0.018][v][cplayer] Setting option 'hwdec' = 'no' (flags = 8)
[   0.018][v][cplayer] Setting option 'log-file' = 'D:\Pictures\mpv\thumbnails\DMGRoku_de_Nashi_Majutsu_Koushi_to_Akashic_Records01BDRip1080PBIG5-274665133\000128.bgra.log' (flags = 8)
[   0.018][v][cplayer] Setting option 'start' = '1216.503846' (flags = 8)
[   0.018][v][cplayer] Setting option 'frames' = '1' (flags = 8)
[   0.018][v][cplayer] Setting option 'hr-seek' = 'yes' (flags = 8)
[   0.018][v][cplayer] Setting option 'audio' = 'no' (flags = 8)
[   0.018][v][cplayer] Setting option 'vf' = 'scale=200:112' (flags = 8)
[   0.019][v][cplayer] Setting option 'vf-add' = 'format=bgra' (flags = 8)
[   0.019][v][cplayer] Setting option 'of' = 'rawvideo' (flags = 8)
[   0.019][v][cplayer] Setting option 'ovc' = 'rawvideo' (flags = 8)
[   0.019][f][cplayer] Error parsing commandline option o: option requires parameter
[   0.019][w][cplayer] Make sure you're using e.g. '--o=value' instead of '--o value'.
[   0.019][i][cplayer] 

My mpv_thumbnail_script.conf:

cache_directory=D:\Pictures\mpv\thumbnails
autogenerate_max_duration=0

The problem seems to be caused here:

[   0.019][w][cplayer] Make sure you're using e.g. '--o=value' instead of '--o value'.

my mpv version:

mpv 0.32.0-201-ge7bab0025f Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
 built on Sun Mar  1 14:21:15 +08 2020
FFmpeg library versions:
   libavutil       56.42.100
   libavcodec      58.73.102
   libavformat     58.39.101
   libswscale      5.6.100
   libavfilter     7.77.100
   libswresample   3.6.100
FFmpeg version: git-2020-02-29-8f3df1dd4

But how to solve it?
I didn't add any parameters when using mpv.

no close button

Normally, a title bar with window controls (close, minimize, maximize) appears when I hover over the top of the video. When using the script and turning off the built-in OSC, the title bar no longer appears upon hover. The bottom bar is still there.

Thumbnails generated with wrong aspect ratio

I have a mkv video for which mkvinfo reports:

|  + Video track
|   + Pixel width: 576
|   + Pixel height: 568
|   + Display width: 1010
|   + Display height: 568

And mpv reports:

 (+) Video --vid=1 (*) (h264 576x568 25.000fps)

So basically it has different pixel and display width. It looks like script ends up relying on pixel width (with almost 1:1 ratio) rather than display width (with 16:9 ratio).

I did some debugging and it seems that in video-dec-params dw=w=576 while in video-params dw=1010. Maybe script shold use video-params? I'm using hwdec=vaapi, maybe that's what makes it different.

Thumbnailing stopped working after mpv update (v2:0.32.0+git~bionic1)

I suspect that the 2:0.32.0+git~bionic1 release of mpv broke something in the image thumbnailer. Getting this error message

[mpv_thumbnail_script_server] Thumbnailing command failed! 
[mpv_thumbnail_script_server] mpv process error: nil 
[mpv_thumbnail_script_server] Process stdout:  
[mpv_thumbnail_script_server] Debug log: /tmp/my_mpv_thumbnails/myexamplemovie-1775712629/000032.bgra.log 
[mpv_thumbnail_script_server] Output file missing! /tmp/my_mpv_thumbnails/myexamplemovie-1775712629/000032.bgra 

Debug-info

$ mpv --version
mpv git-2020-02-01-f304a79 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
 built on Fri Feb 21 02:24:22 UTC 2020
ffmpeg library versions:
   libavutil       56.38.100
   libavcodec      58.67.100
   libavformat     58.37.100
   libswscale      5.6.100
   libavfilter     7.72.100
   libswresample   3.6.100
ffmpeg version: git-2020-02-01-843c24a

mpv_thumbnail_script_client_osc.lua:

    mpv_thumbnail_script.lua 0.4.2 - commit a2de250 (branch master)
    https://github.com/TheAMM/mpv_thumbnail_script
    Built on 2018-02-07 20:36:55

mpv_thumbnail_script_server.lua:

    mpv_thumbnail_script.lua 0.4.2 - commit a2de250 (branch master)
    https://github.com/TheAMM/mpv_thumbnail_script
    Built on 2018-02-07 20:36:54

Thumbnailing command failed on Mac

I installed the scripts, but I get the error message: "Thumbnailing failed, check console for details." The folder for the file's thumbnails is created, but there are no thumbnails or log files in it, even if I put "mpv_keep_logs=yes" in mpv_thumbnail_script.conf - I tried it on several files, some mkvs and an avi, none work. Using macOS 10.12.

mpv's main log file contains the following, let me know if you need more:

[   0.010][v][cplayer] mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
[   0.010][v][cplayer]  built on Fri Oct  5 00:01:23 CEST 2018
[   0.010][v][cplayer] ffmpeg library versions:
[   0.010][v][cplayer]    libavutil       56.14.100
[   0.010][v][cplayer]    libavcodec      58.18.100
[   0.010][v][cplayer]    libavformat     58.12.100
[   0.010][v][cplayer]    libswscale      5.1.100
[   0.010][v][cplayer]    libavfilter     7.16.100
[   0.010][v][cplayer]    libswresample   3.1.100
[   0.010][v][cplayer] ffmpeg version: 4.0.2
[   0.010][v][cplayer] 
[   0.010][v][cplayer] Configuration: waf configure --prefix=/Users/djinn/apps/homebrew/Cellar/mpv/0.29.1 --enable-html-build --enable-javascript --enable-libmpv-shared --enable-lua --confdir=/Users/djinn/apps/homebrew/etc/mpv --datadir=/Users/djinn/apps/homebrew/Cellar/mpv/0.29.1/share/mpv --mandir=/Users/djinn/apps/homebrew/Cellar/mpv/0.29.1/share/man --docdir=/Users/djinn/apps/homebrew/Cellar/mpv/0.29.1/share/doc/mpv --enable-zsh-comp --zshdir=/Users/djinn/apps/homebrew/Cellar/mpv/0.29.1/share/zsh/site-functions
[   0.010][v][cplayer] List of enabled features: 51deb apple-remote asm atomics bsd-fstatfs build-date cocoa coreaudio cplayer cplugins debug-build drmprime fchmod ffmpeg gl gl-cocoa glob glob-posix gnuc gpl iconv javascript jpeg lcms2 libaf libass libass-osd libav-any libavcodec libavdevice libdl libm libmpv-shared lua macos-cocoa-cb macos-touchbar optimize osx-thread-name plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads rubberband stdatomic videotoolbox-gl videotoolbox-hwaccel zlib zsh-comp
[   0.010][d][ytdl_hook] Loading lua script @ytdl_hook.lua...
[   0.010][d][stats] Loading lua script @stats.lua...
[   0.011][d][ytdl_hook] loading mp.defaults
[   0.011][d][stats] loading mp.defaults
[   0.014][d][stats] loading @stats.lua

(...)

[   0.701][v][cplayer] first video frame after restart shown
[   0.702][d][cplayer] Run command: script-message, flags=0, args=[mpv_thumbnail_script-worker, mpv_thumbnail_script_server]
[   0.702][d][mpv_thumbnail_script_server] Announcing self to master... 
[   0.702][d][cplayer] Run command: script-message, flags=0, args=[mpv_thumbnail_script-worker, mpv_thumbnail_script_server]
[   0.702][d][cplayer] Run command: script-binding, flags=9, args=[mpv_thumbnail_script_client_osc/__keybinding2]
[   0.714][v][cplayer] starting audio playback
[   0.719][d][mpv_thumbnail_script_client_osc] Thumbnailer.state: {"finished_thumbnails" = 0, "is_remote" = false, "thumbnail_template" = "/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388/%06d.bgra", "thumbnail_directory" = "/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388", "thumbnail_delta" = 17.033386666667, "worker_extra" = {}, "available" = true, "thumbnail_count" = 150, "thumbnail_size" = {"w" = 200, "h" = 112}, "thumbnails" = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, "ready" = true} 
[   0.719][d][mpv_thumbnail_script_client_osc] Registered worker mpv_thumbnail_script_server 
[   0.720][v][cplayer] playback restart complete
[   0.721][d][cplayer] Run command: script-message-to, flags=0, args=[mpv_thumbnail_script_server, mpv_thumbnail_script-slaved]
[   0.721][d][mpv_thumbnail_script_server] Successfully registered with master 
[   0.736][v][cplayer] Change display sync audio drift: -1
[   0.738][d][mpv_thumbnail_script_client_osc] Splitting 150 thumbnails amongst 1 worker(s) 
[   0.739][d][mpv_thumbnail_script_client_osc] Giving workers state: {"enabled":true,"finished_thumbnails":0,"worker_input_path":"/Volumes/My Videos/The.Movie.Name.mkv","is_remote":false,"thumbnail_template":"/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388/%06d.bgra","thumbnail_directory":"/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388","thumbnail_delta":17.033387,"worker_extra":[],"available":true,"thumbnail_count":150,"thumbnail_size":{"w":200,"h":112},"thumbnails":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"ready":true} 
[   0.740][d][mpv_thumbnail_script_client_osc] Assigning job to mpv_thumbnail_script_server [1,65,129,33,97,17,49,81,113,145,9,25,41,57,73,89,105,121,137,5,13,21,29,37,45,53,61,69,77,85,93,101,109,117,125,133,141,149,3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,139,143,147,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150] 
[   0.757][d][cplayer] Run command: script-message-to, flags=0, args=[mpv_thumbnail_script_server, mpv_thumbnail_script-job, {"enabled":true,"finished_thumbnails":0,"worker_input_path":"/Volumes/My Videos/The.Movie.Name.mkv","is_remote":false,"thumbnail_template":"/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388/%06d.bgra","thumbnail_directory":"/Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388","thumbnail_delta":17.033387,"worker_extra":[],"available":true,"thumbnail_count":150,"thumbnail_size":{"w":200,"h":112},"thumbnails":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"ready":true}, [1,65,129,33,97,17,49,81,113,145,9,25,41,57,73,89,105,121,137,5,13,21,29,37,45,53,61,69,77,85,93,101,109,117,125,133,141,149,3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,139,143,147,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150]]
[   0.760][d][mpv_thumbnail_script_server] Handling given job 
[   0.760][d][mpv_thumbnail_script_server] Generating 150 thumbnails @ 200x112 for "/Volumes/My Videos/The.Movie.Name.mkv" 
[   0.760][d][mpv_thumbnail_script_server] Starting work on thumbnail 0 
[   0.760][d][cplayer] Run command: script-message, flags=0, args=[mpv_thumbnail_script-progress, 1]
[   0.792][e][mpv_thumbnail_script_server] Thumbnailing command failed! 
[   0.792][e][mpv_thumbnail_script_server] mpv process error: init 
[   0.792][e][mpv_thumbnail_script_server] Process stdout:  
[   0.792][e][mpv_thumbnail_script_server] Debug log: /Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388/000000.bgra.log 
[   0.792][e][mpv_thumbnail_script_server] Output file missing! /Users/username/.config/mpv/mpv_thumbs_cache/The.Movie.Name-322085388/000000.bgra 
[   0.792][d][cplayer] Run command: show-text, flags=0, args=[Thumbnailing failed, check console for details, 3500, 0]

Thumbnailing command failed

OS

Arch Linux with linux kernel 5.2

mpv version

0.32.0_5_g2fd34889fe

error log

000000.bgra.log

console log

[mpv_thumbnail_script_client_osc] The 'tick' event is deprecated and will be removed.
AV: 00:00:00 / 00:23:40 (0%) A-V:  0.000
[mpv_thumbnail_script_server] Thumbnailing command failed! 
[mpv_thumbnail_script_server] mpv process error: nil 
[mpv_thumbnail_script_server] Process stdout:  
[mpv_thumbnail_script_server] Debug log: /tmp/mpv_thumbs_cache/YGNeo.subEndro01GB1080PMP4-481353632/000000.bgra.log 
[mpv_thumbnail_script_server] Output file missing! /tmp/mpv_thumbs_cache/YGNeo.subEndro01GB1080PMP4-481353632/000000.bgra

Optimization for static videos

I've set thumbnail_network=yes
And as you know there are some music videos with static image and I was wondering if it could be optimized, so that only one thumbnail would be generated instead of default 150.
It's not that big of a deal, but would be easier on cpu.

feature request

Hello.

  1. Can you add a script option to enable --no-config argument? The script stucks on generating thumbnails unless I add this argument to server.lua.

  2. Could be useful to have an option to specify --profile argument with specific profile name for generating thumbnails.

Improve thumbnail "feel"

Currently thumbnails will be chosen by taking a timestamp and turning that into a thumbnail index by math.flooring it with the thumbnail interval/delta.
This means the thumbnail being displayed is before the position the user would click on, and slightly misleading; the jump will rarely happen on the actual thumbnail timestamp (and overriding the seek would be a pain/detrimental for accurate seeking) but instead after the moment has passed.

This feels "wrong".
How do other players do it? Do they choose their thumbnail timestamps with some clever logic?
What logic do they use to choose which thumbnail to show? Is it a "closest" timestamp, the next thumbnail, or what?
The downside with displaying simply the next thumbnail would be short videos having their thumbnails be almost useless. Maybe move generate timestamps up by half an interval and choose the closest thumbnail?


This is here to allow others to chime in. What are your thoughts?

thumbnail script just stops :/

so i am not sure what is causing this, but i really set a max number of humbnaills
i set it too 1160 and min space between i set it to 1 second but why does script fails?

i get this error

[mpv_thumbnail_script_server_1] Too many events queued.
[mpv_thumbnail_script_server_4] Too many events queued.
[mpv_thumbnail_script_server_6] Too many events queued.
[mpv_thumbnail_script_server_3] Too many events queued.
[mpv_thumbnail_script_server_8] Too many events queued.
[mpv_thumbnail_script_server_5] Too many events queued.
[mpv_thumbnail_script_server_7] Too many events queued.
[mpv_thumbnail_script_server_2] Too many events queued.
[mpv_thumbnail_script_server] Too many events queued.
[mpv_thumbnail_script_server_7] Thumbnail 145 did not match expected size, regenerating
VO: [gpu] 720x302 yuv420p
[mpv_thumbnail_script_client_osc] The 'tick' event is deprecated and will be removed.

Thumbnailing failed

The log output

[   0.003][v][cplayer] mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[   0.003][v][cplayer]  built on Sat Apr  4 05:54:47 UTC 2020
[   0.003][v][cplayer] ffmpeg library versions:
[   0.003][v][cplayer]    libavutil       56.31.100
[   0.003][v][cplayer]    libavcodec      58.54.100
[   0.003][v][cplayer]    libavformat     58.29.100
[   0.003][v][cplayer]    libswscale      5.5.100
[   0.003][v][cplayer]    libavfilter     7.57.100
[   0.003][v][cplayer]    libswresample   3.5.100
[   0.003][v][cplayer] ffmpeg version: 4.2.2
[   0.003][v][cplayer] 
[   0.003][v][cplayer] Configuration: ./waf configure --enable-dvbin --enable-dvdnav --enable-html-build --enable-javascript --enable-cdda --zshdir=/usr/share/zsh/vendor-completions --prefix=/usr --confdir=/etc/mpv
[   0.003][v][cplayer] List of enabled features: 52arch aligned_alloc alsa asm atomics build-date cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build drm drmprime dvbin dvdnav egl egl-drm egl-helpers egl-x11 fchmod ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack javascript jpeg lcms2 libarchive libass libass-osd libav-any libavcodec libavdevice libavutil libbluray libdl libm libplacebo librt linux-fstatfs lua memfd_create optimize oss-audio posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h vulkan wayland wayland-protocols x11 xv zlib
[   0.003][v][cplayer] Command line options: '--msg-level=all=no' '--no-ytdl' '--user-agent=libmpv' '--referrer=' '--hwdec=no' '--log-file=/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra.log' '[HorribleSubs]_Fairy_Tail_-_01_[720p].mkv' '--start=4.9057565' '--frames=1' '--hr-seek=yes' '--no-audio' '--vf=scale=200:112' '--vf-add=format=bgra' '--of=rawvideo' '--ovc=rawvideo' '--o=' '/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra'
[   0.003][v][cplayer] mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[   0.003][v][cplayer]  built on Sat Apr  4 05:54:47 UTC 2020
[   0.003][v][cplayer] ffmpeg library versions:
[   0.003][v][cplayer]    libavutil       56.31.100
[   0.003][v][cplayer]    libavcodec      58.54.100
[   0.003][v][cplayer]    libavformat     58.29.100
[   0.003][v][cplayer]    libswscale      5.5.100
[   0.003][v][cplayer]    libavfilter     7.57.100
[   0.003][v][cplayer]    libswresample   3.5.100
[   0.003][v][cplayer] ffmpeg version: 4.2.2
[   0.003][v][cplayer] 
[   0.003][v][cplayer] Configuration: ./waf configure --enable-dvbin --enable-dvdnav --enable-html-build --enable-javascript --enable-cdda --zshdir=/usr/share/zsh/vendor-completions --prefix=/usr --confdir=/etc/mpv
[   0.003][v][cplayer] List of enabled features: 52arch aligned_alloc alsa asm atomics build-date cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build drm drmprime dvbin dvdnav egl egl-drm egl-helpers egl-x11 fchmod ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack javascript jpeg lcms2 libarchive libass libass-osd libav-any libavcodec libavdevice libavutil libbluray libdl libm libplacebo librt linux-fstatfs lua memfd_create optimize oss-audio posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h vulkan wayland wayland-protocols x11 xv zlib
[   0.003][v][cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[   0.004][v][cplayer] Applying profile 'default'...
[   0.004][v][cplayer] Reading config file /etc/mpv/mpv.conf
[   0.004][v][cplayer] Applying profile 'default'...
[   0.004][v][cplayer] Reading config file /home/terra/.config/mpv/mpv.conf
[   0.004][v][cplayer] Applying profile 'default'...
[   0.004][v][cplayer] Setting option 'osc' = 'no' (flags = 4)
[   0.004][v][cplayer] Setting option 'screenshot-directory' = '~/pictures/mpvscreenshots' (flags = 4)
[   0.004][v][cplayer] Setting option 'screenshot-template' = '%F-%P' (flags = 4)
[   0.004][v][cplayer] Setting option 'quiet' = 'yes' (flags = 4)
[   0.004][v][cplayer] Setting option 'ao' = 'pulse' (flags = 4)
[   0.004][v][cplayer] Setting option 'msg-level' = 'all=no' (flags = 8)
[   0.004][v][cplayer] Setting option 'ytdl' = 'no' (flags = 8)
[   0.004][v][cplayer] Setting option 'user-agent' = 'libmpv' (flags = 8)
[   0.004][v][cplayer] Setting option 'referrer' = '' (flags = 8)
[   0.004][v][cplayer] Setting option 'hwdec' = 'no' (flags = 8)
[   0.004][v][cplayer] Setting option 'log-file' = '/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra.log' (flags = 8)
[   0.004][v][cplayer] Setting option 'start' = '4.9057565' (flags = 8)
[   0.004][v][cplayer] Setting option 'frames' = '1' (flags = 8)
[   0.004][v][cplayer] Setting option 'hr-seek' = 'yes' (flags = 8)
[   0.004][v][cplayer] Setting option 'audio' = 'no' (flags = 8)
[   0.004][v][cplayer] Setting option 'vf' = 'scale=200:112' (flags = 8)
[   0.004][v][cplayer] Setting option 'vf-add' = 'format=bgra' (flags = 8)
[   0.004][v][cplayer] Setting option 'of' = 'rawvideo' (flags = 8)
[   0.004][v][cplayer] Setting option 'ovc' = 'rawvideo' (flags = 8)
[   0.004][v][cplayer] Setting option 'o' = '' (flags = 8)
[   0.005][v][ifo_dvdnav] Opening /home/terra/.config/mpv/input.conf
[   0.005][v][bdmv/bluray] Opening /home/terra/.config/mpv/input.conf
[   0.005][v][file] Opening /home/terra/.config/mpv/input.conf
[   0.005][d][file] resize stream to 131072 bytes
[   0.005][d][file] Stream opened successfully.
[   0.005][v][input] Parsing input config file /home/terra/.config/mpv/input.conf
[   0.005][v][input] Input config file /home/terra/.config/mpv/input.conf parsed: 18 binds
[   0.005][d][global] user path: '/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra.log' -> '/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra.log'
[   0.005][d][stats] Loading lua script @stats.lua...
[   0.005][d][console] Loading lua script @console.lua...
[   0.005][d][global] config path: 'scripts' -> '/home/terra/.config/mpv/scripts'
[   0.005][d][global] config path: 'scripts' -/-> '/home/terra/.mpv/scripts'
[   0.005][d][global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[   0.005][d][mpv_thumbnail_script_client_osc] Loading lua script /home/terra/.config/mpv/scripts/mpv_thumbnail_script_client_osc.lua...
[   0.005][d][stats] loading mp.defaults
[   0.005][d][mpv_thumbnail_script_server] Loading lua script /home/terra/.config/mpv/scripts/mpv_thumbnail_script_server.lua...  stamp-h1
[   0.005][v][cplayer] Waiting for scripts...
[   0.006][d][mpv_thumbnail_script_client_osc] loading mp.defaults
[   0.006][d][mpv_thumbnail_script_server] loading mp.defaults
[   0.007][d][mpv_thumbnail_script_client_osc] loading file /home/terra/.config/mpv/scripts/mpv_thumbnail_script_client_osc.lual argument [-Wnonnull]
[   0.007][d][stats] loading @stats.lua
[   0.007][d][mpv_thumbnail_script_server] loading file /home/terra/.config/mpv/scripts/mpv_thumbnail_script_server.luamode *') to parameter of typ
[   0.007][d][console] loading mp.defaults
[   0.008][d][console] loading @console.lua
[   0.008][d][mpv_thumbnail_script_server] reading options for mpv_thumbnail_script 
[   0.008][d][global] config path: 'script-opts/mpv_thumbnail_script.conf' -/-> '/home/terra/.config/mpv/script-opts/mpv_thumbnail_script.conf'data' here
[   0.008][d][global] config path: 'script-opts/mpv_thumbnail_script.conf' -/-> '/home/terra/.mpv/script-opts/mpv_thumbnail_script.conf'
[   0.008][d][stats] reading options for stats 
[   0.008][d][global] config path: 'script-opts/mpv_thumbnail_script.conf' -/-> '/etc/mpv/script-opts/mpv_thumbnail_script.conf'
[   0.008][d][global] config path: 'script-opts/stats.conf' -/-> '/home/terra/.config/mpv/script-opts/stats.conf'
[   0.008][d][global] config path: 'script-opts/stats.conf' -/-> '/home/terra/.mpv/script-opts/stats.conf'
[   0.008][d][mpv_thumbnail_script_server] script-opts/mpv_thumbnail_script.conf not found. 
[   0.008][d][global] config path: 'lua-settings/mpv_thumbnail_script.conf' -> '/home/terra/.config/mpv/lua-settings/mpv_thumbnail_script.conf'
[   0.008][w][mpv_thumbnail_script_server] lua-settings/ is deprecated, use directory script-opts/ 
[   0.008][d][global] config path: 'script-opts/stats.conf' -/-> '/etc/mpv/script-opts/stats.conf'
[   0.008][d][stats] script-opts/stats.conf not found. 
[   0.008][v][mpv_thumbnail_script_server] Opened config file lua-settings/mpv_thumbnail_script.conf. 
[   0.008][d][global] config path: 'lua-settings/stats.conf' -/-> '/home/terra/.config/mpv/lua-settings/stats.conf'mode *') to parameter of typ
[   0.008][d][global] config path: 'lua-settings/stats.conf' -/-> '/home/terra/.mpv/lua-settings/stats.conf'
[   0.008][d][global] config path: 'lua-settings/stats.conf' -/-> '/etc/mpv/lua-settings/stats.conf'
[   0.008][d][stats] lua-settings/stats.conf not found. 
[   0.009][d][console] reading options for console 
[   0.009][d][global] config path: 'script-opts/console.conf' -/-> '/home/terra/.config/mpv/script-opts/console.conf'
[   0.009][d][global] config path: 'script-opts/console.conf' -/-> '/home/terra/.mpv/script-opts/console.conf'
[   0.009][d][global] config path: 'script-opts/console.conf' -/-> '/etc/mpv/script-opts/console.conf'
[   0.009][d][console] script-opts/console.conf not found. 
[   0.009][d][global] config path: 'lua-settings/console.conf' -/-> '/home/terra/.config/mpv/lua-settings/console.conf'
[   0.009][d][global] config path: 'lua-settings/console.conf' -/-> '/home/terra/.mpv/lua-settings/console.conf'
[   0.009][d][global] config path: 'lua-settings/console.conf' -/-> '/etc/mpv/lua-settings/console.conf'
[   0.009][d][console] lua-settings/console.conf not found. 
[   0.010][d][cplayer] Run command: define-section, flags=64, args=["input_stats", "i script-binding stats/display-stats\nI script-binding stats/display-stats-toggle\n", "default"]
[   0.010][d][cplayer] Run command: enable-section, flags=64, args=["input_stats", "allow-hide-cursor+allow-vo-dragging"]
[   0.010][d][cplayer] Run command: define-section, flags=64, args=["input_forced_stats", "", "force"]
[   0.010][d][cplayer] Run command: enable-section, flags=64, args=["input_forced_stats", "allow-hide-cursor+allow-vo-dragging"]
[   0.013][d][global] config path: 'fonts' -/-> '/home/terra/.config/mpv/fonts'
[   0.013][d][global] config path: 'fonts' -/-> '/home/terra/.mpv/fonts'
[   0.013][d][global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[   0.013][v][osd/libass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 2.6.1 (COMPLEX)
[   0.013][d][global] config path: 'subfont.ttf' -/-> '/home/terra/.config/mpv/subfont.ttf'
[   0.013][d][global] config path: 'subfont.ttf' -/-> '/home/terra/.mpv/subfont.ttf'
[   0.013][d][global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[   0.013][d][global] config path: 'fonts.conf' -/-> '/home/terra/.config/mpv/fonts.conf'
[   0.013][d][global] config path: 'fonts.conf' -/-> '/home/terra/.mpv/fonts.conf'
[   0.013][d][global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[   0.013][v][osd/libass] Setting up fonts...
[   0.184][v][vo/gpu] Using FBO format rgba16f.
[   0.184][v][vo/gpu] No advanced processing required. Enabling dumb mode.
[   0.185][d][vo/gpu/opengl] vertex shader source:
[   0.185][d][vo/gpu/opengl] [  1] #version 440
[   0.185][d][vo/gpu/opengl] [  2] #define tex1D texture
[   0.185][d][vo/gpu/opengl] [  3] #define tex3D texture
[   0.185][d][vo/gpu/opengl] [  4] #define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))0 [720p].mkv    [HorribleSu
[   0.185][d][vo/gpu/opengl] [  5] in vec2 vertex_position;
[   0.185][d][vo/gpu/opengl] [  6] in vec2 vertex_texcoord0;
[   0.185][d][vo/gpu/opengl] [  7] out vec2 texcoord0;
[   0.185][d][vo/gpu/opengl] [  8] void main() {
[   0.185][d][vo/gpu/opengl] [  9] gl_Position = vec4(vertex_position, 1.0, 1.0);
[   0.185][d][vo/gpu/opengl] [ 10] texcoord0 = vertex_texcoord0;
[   0.185][d][vo/gpu/opengl] [ 11] }
[   0.185][d][vo/gpu/opengl] fragment shader source:
[   0.185][d][vo/gpu/opengl] [  1] #version 440
[   0.185][d][vo/gpu/opengl] [  2] #define tex1D texture
[   0.185][d][vo/gpu/opengl] [  3] #define tex3D texture
[   0.185][d][vo/gpu/opengl] [  4] #define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))=root ; COMMAND=/usr/bin/apt
[   0.185][d][vo/gpu/opengl] [  5] out vec4 out_color;
[   0.185][d][vo/gpu/opengl] [  6] in vec2 texcoord0;
[   0.185][d][vo/gpu/opengl] [  7] layout(std140, binding=0) uniform UBO {
[   0.185][d][vo/gpu/opengl] [  8] layout(offset=0) mat3 colormatrix;
[   0.185][d][vo/gpu/opengl] [  9] layout(offset=48) vec3 colormatrix_c;
[   0.185][d][vo/gpu/opengl] [ 10] layout(offset=64) vec3 src_luma;
[   0.185][d][vo/gpu/opengl] [ 11] layout(offset=80) vec3 dst_luma;
[   0.185][d][vo/gpu/opengl] [ 12] layout(offset=96) vec2 texture_size0;
[   0.185][d][vo/gpu/opengl] [ 13] layout(offset=112) mat2 texture_rot0;
[   0.185][d][vo/gpu/opengl] [ 14] layout(offset=144) vec2 texture_off0;
[   0.185][d][vo/gpu/opengl] [ 15] layout(offset=152) vec2 pixel_size0;
[   0.185][d][vo/gpu/opengl] [ 16] };
[   0.185][d][vo/gpu/opengl] [ 17] uniform sampler2D texture0;
[   0.185][d][vo/gpu/opengl] [ 18] void main() {
[   0.185][d][vo/gpu/opengl] [ 19] vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
[   0.185][d][vo/gpu/opengl] [ 20] color.rgba = 1.000000 * vec4(texture(texture0, texcoord0)).rgba;
[   0.185][d][vo/gpu/opengl] [ 21] color = color.bgra;
[   0.185][d][vo/gpu/opengl] [ 22] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
[   0.185][d][vo/gpu/opengl] [ 23] color = vec4(color.rgb * color.a, color.a);
[   0.185][d][vo/gpu/opengl] [ 24] // color mapping
[   0.185][d][vo/gpu/opengl] [ 25] color.rgb *= vec3(1.000000);
[   0.185][d][vo/gpu/opengl] [ 26] color.rgb *= vec3(1.000000);
[   0.185][d][vo/gpu/opengl] [ 27] // transparency checkerboard
[   0.185][d][vo/gpu/opengl] [ 28] bvec2 tile = lessThan(fract(gl_FragCoord.xy * 1.0/32.0), vec2(0.5));
[   0.185][d][vo/gpu/opengl] [ 29] vec3 background = vec3(tile.x == tile.y ? 0.93 : 0.87);
[   0.185][d][vo/gpu/opengl] [ 30] color.rgb += background.rgb * (1.0 - color.a);
[   0.185][d][vo/gpu/opengl] [ 31] color.a = 1.0;
[   0.185][d][vo/gpu/opengl] [ 32] out_color = color;
[   0.185][d][vo/gpu/opengl] [ 33] }
[   0.185][d][vo/gpu/opengl] shader link log (status=1): 
[   0.189][v][cplayer] first video frame after restart shown
[   0.189][v][cplayer] playback restart complete @ 4.922000
[   0.189][v][vo/gpu/x11] Disabling screensaver.
[   0.189][w][mpv_thumbnail_script_client_osc] The 'tick' event is deprecated and will be removed.
[   0.189][d][cplayer] Run command: script-binding, flags=73, args=["mpv_thumbnail_script_client_osc/__keybinding2"]
[   0.189][d][cplayer] Run command: script-binding, flags=73, args=["mpv_thumbnail_script_client_osc/__keybinding2"]
[   0.191][v][cplayer] EOF code: 1  
[   0.192][d][vd] Uninit decoder.
[   0.193][v][vf] dropping frame due to pin disconnect
[   0.194][d][cplayer] Terminating demuxers...
[   0.194][d][cplayer] Done terminating demuxers.
[   0.194][v][cplayer] finished playback, success (reason 0)
[   0.194][i][cplayer] 
[   0.194][i][cplayer] Playing: /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra
[   0.194][v][ifo_dvdnav] Opening /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra
[   0.194][d][mpv_thumbnail_script_client_osc] osc_init 
[   0.194][v][bdmv/bluray] Opening /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra
[   0.194][v][file] Opening /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra
[   0.194][e][file] Cannot open file '/tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra': No such file or directory
[   0.194][e][stream] Failed to open /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra.
[   0.194][v][cplayer] Opening failed or was aborted: /tmp/my_mpv_thumbnails/HorribleSubs_Fairy_Tail_-_01_720p-276569298/000000.bgra
[   0.194][v][cplayer] finished playback, loading failed (reason 4)
[   0.194][i][cplayer] 
[   0.194][i][cplayer] 
[   0.194][i][cplayer] Exiting... (Some errors happened)
[   0.195][d][stats] Exiting...
[   0.196][d][mpv_thumbnail_script_server] Changing files, subprocess killed 
[   0.196][d][mpv_thumbnail_script_server] Exiting...
[   0.196][d][console] Exiting...
[   0.196][d][mpv_thumbnail_script_client_osc] Exiting...
[   0.230][v][vo/gpu/x11] Enabling screensaver.
[   0.252][d][vo/gpu] flushing shader cache
[   0.254][d][vo/gpu/x11] uninit ...
mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
 built on Sat Apr  4 05:54:47 UTC 2020
ffmpeg library versions:
   libavutil       56.31.100
   libavcodec      58.54.100
   libavformat     58.29.100
   libswscale      5.5.100
   libavfilter     7.57.100
   libswresample   3.5.100
ffmpeg version: 4.2.2

Does not work on my Ubuntu 19.10 machine

0.3.2 crashes

Hello.

mpv_thumbnail_script_client_osc:
mpv_thumbnail_script_client_osc: stack traceback:
mpv_thumbnail_script_client_osc:        ...table_config/scripts/mpv_thumbnail_script_client_osc.lua:583: in main chunk
mpv_thumbnail_script_client_osc:        [C]: at 0x7ff7d3f953a0
mpv_thumbnail_script_client_osc:        [C]: at 0x7ff7d3f949a0
mpv_thumbnail_script_client_osc: Lua error: ...table_config/scripts/mpv_thumbnail_script_client_osc.lua:350: attempt to index global 'bit32' (a nil value)

OSC indicates cached data with incorrect order of magnitude

The OSC's cache display appears to be off by an order of magnitude - probably due to assuming the cache size is set in bytes as opposed to KiB.

Steps to reproduce:
Configure mpv's cache with a size of n MiB and replay a sufficiently large video file.

Expected behaviour:
mpv_thumbnail_script_client_osc should indicate a cache size of roughly n MiB

Current behaviour:
mpv_thumbnail_script_client_osc indicates a cache size of roughly n KiB (as opposed to MiB)

versions: mpv 0.27.2 / mpv_thumbnail_script 0.4.2

I have confirmed that, using the same configuration, mpv's default OSC shows the correct cache size. Does anybody else encounter this issue? If this is not due to my (slightly) out of date version of mpv, I'd be happy to provide a PR which fixes the issue.

Thank you for this overall fantastic extension.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.