diff --git a/README.md b/README.md index e861222..56c170e 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,11 @@ remote_max_delta=120 # Much faster than passing the url to ytdl again, but may cause problems with some sites # Defaults to yes remote_direct_stream=[yes/no] + +# Parameter that mpv should use for hardware decoding +# If properly configured can really improve thumbnail generation speed and cpu load +# Default to no, see https://mpv.io/manual/master/#options-hwdec for the values +mpv_hwdec=no ``` (see [`src/options.lua`](/src/options.lua) for all possible options) diff --git a/src/options.lua b/src/options.lua index 73ed89c..f57fcb5 100644 --- a/src/options.lua +++ b/src/options.lua @@ -33,6 +33,8 @@ local thumbnailer_options = { -- Add a "--profile=" to the mpv sub-call arguments -- Use "" to disable mpv_profile = "", + -- Hardware decoding + mpv_hwdec = "no", -- Output debug logs to .log, ala //000000.bgra.log -- The logs are removed after successful encodes, unless you set mpv_keep_logs below mpv_logs = true, diff --git a/src/thumbnailer_server.lua b/src/thumbnailer_server.lua index 0d0955e..2c096fc 100644 --- a/src/thumbnailer_server.lua +++ b/src/thumbnailer_server.lua @@ -38,8 +38,8 @@ function create_thumbnail_mpv(file_path, timestamp, size, output_path, options) -- Pass User-Agent and Referer - should do no harm even with ytdl active "--user-agent=" .. mp.get_property_native("user-agent"), "--referrer=" .. mp.get_property_native("referrer"), - -- Disable hardware decoding - "--hwdec=no", + -- User set hardware decoding + "--hwdec=" .. thumbnailer_options.mpv_hwdec, -- Insert --no-config, --profile=... and --log-file if enabled (thumbnailer_options.mpv_no_config and "--no-config" or nil), @@ -270,4 +270,4 @@ register_timer = mp.add_periodic_timer(0.1, register_function) mp.register_script_message("mpv_thumbnail_script-slaved", function() msg.debug("Successfully registered with master") register_timer:stop() -end) \ No newline at end of file +end)