From 02b6f6eb0757c941850f04378f9eb00b1037f35b Mon Sep 17 00:00:00 2001 From: dexeonify <72267349+dexeonify@users.noreply.github.com> Date: Mon, 5 Sep 2022 22:01:16 +0800 Subject: [PATCH] Tweak ffmpeg threads For my CPU model, my testing shows that 4 workers 2 threads generates thumbnails the quickest while using the least RAM. See the table below: | Samples | Workers/Threads | | -------- | 4/8 | 4/4 | 4/2 | 8/2 | | H.264 | 13s | 13s | 10s | 11s | - 4/2 | HEVC | 37s | 33s | 29s | 27s | - 8/2 | VP9 | 51s | 47s | 47s | 45s | - 8/2 | AV1 | 77s | 73s | 71s | 73s | - 4/2 Note: Each sample have varied durations and resolutions, so no conclusions regarding which video formats are easier to decode can be drawn. They merely serves as labels. From the table, 4/2 and 8/2 are tied as being the fastest. Picking 4/2 would be a no-brainer as it's also ligher on RAM. Keep in mind that the default of 3 workers 8 threads performed the worst, so it's important to tweak the workers/thread options to take full advantage of Thumbnailer. --- mpv.conf | 5 +++++ script-opts/thumbnailer.conf | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mpv.conf b/mpv.conf index 4a8bf07..dbcdf18 100644 --- a/mpv.conf +++ b/mpv.conf @@ -72,3 +72,8 @@ profile-desc=Fix abnormal stuttering when using auto-copy on >4K videos profile-cond=width >= 3840 and height >= 2160 profile-restore=copy hwdec=auto-safe + +[fast-av1-thumbnails] +profile-desc=Use mpv to generate thumbnails for AV1 videos, as it is significantly faster than ffmpeg +profile-cond=p["video-format"] == "av1" +script-opts-append=Thumbnailer-use_ffmpeg=no diff --git a/script-opts/thumbnailer.conf b/script-opts/thumbnailer.conf index 52bff6c..67f9db0 100644 --- a/script-opts/thumbnailer.conf +++ b/script-opts/thumbnailer.conf @@ -35,9 +35,9 @@ worker_remote_factor=1 #worker_delay=1 #worker_timeout=5 #accurate_seek=yes -#use_ffmpeg=yes +use_ffmpeg=yes #prefer_ffmpeg=yes -#ffmpeg_threads=1 +ffmpeg_threads=2 #ffmpeg_scaler=spline #ffmpeg_hwaccel=d3d11va #ffmpeg_hwaccel_device=0