mpv_thumbnail_script
mpv_thumbnail_script copied to clipboard
[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?
The script is a hack, a curious thing to implement, a solution to give to people who whine after seek previews, working by subprocessing several dozen mpv calls to get a frame each. The readme probably doesn't stress it properly, but it's hilariously inefficient. Looking at IINA or any other thumbnailers doesn't really help, since they have raw access to the decoder and input stream. I'm not dumb, I'm working with what I've got without writing an external program for more efficient thumbnailing, because that's the fun of Lua scripts. Thumbnails are stored on disk because mpv requires a file path to load bitmap overlays, plus since the process is relatively slow and resource intensive, it's better to cache them for reuse. I have a few optimization ideas I'll implement if I ever bother to rewrite the script, but that's a medium-big if.
Well, I'm not complaining about free software, and I didn't mean to imply that you are dumb, you know more than I do if you can write this script... thanks again.
Nothing wrong with complaining, even when it's free software. I just explained the side you were not aware of.