dexeonify / mpv-config

My personal mpv config and user scripts. :)
68 stars 7 forks source link

high cpu usage when Thumbnailer running. #6

Closed IC0hO closed 2 years ago

IC0hO commented 2 years ago

First of all,Thank you for Thumbnailer functionality to ModernX.

I know that turning on the Thumbnailer function will increase the cpu usage.But every time you open the video file will make the cpu usage rate almost 100%, the cpu cooler also high-speed rotation up.

I'm using this osc theme and it doesn't happen 100% cpu usage rate of the time and the thumbnails are generated very fast.

Would you mind improving this thumbnailer ?

dexeonify commented 2 years ago

I'm only integrating Thumbnailer into the OSC, so I'm not very familiar with Thumbnailer's code itself. Any improvement suggestions should go to the upstream's issue tracker.

That said, I think there are some script-opts that can be tweaked on the user-side. What each option does is explained at the bottom of the file. Generally, you want to adjust the max_workers for lower CPU usage and the thumbnail size/quantity options:

# Thumbnail
dimension=320               # Max width and height before scaling
thumbnail_count=120         # Try to create this many thumbnails within the delta limits below
min_delta=5                 # Minimum time between thumbnails (seconds)
max_delta=30                # Maximum time between thumbnails (seconds)

for quicker thumbnail generation.

dexeonify commented 2 years ago

I'm using this osc theme and it doesn't happen 100% cpu usage rate of the time and the thumbnails are generated very fast.

After some testing, both thumbnail scripts are about similar in speed. I've tried to make the test consistent (1 worker, use_ffmpeg=yes, dimension=360, thumbnail_count=300, min_delta=1, max_delta=30). Perhaps it's the lack of progress bar (in mpv_thumbnail_script) that's tricking you into believing that the thumbnail generation has finished early? ;) If so, you can disable the progress bar in Thumbnailer's script-opts as well:

show_progress=0
IC0hO commented 2 years ago

After your configuration guidance, there will be no 100% cpu usage now, thank you for your work!