Skip to content

Commit

Permalink
Merge pull request #21 from NicolaSmaniotto/hwdec
Browse files Browse the repository at this point in the history
Add hwdec option
  • Loading branch information
marzzzello committed Jul 6, 2022
2 parents 956f65a + f3725bb commit e732ffb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions src/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ local thumbnailer_options = {
-- Add a "--profile=<mpv_profile>" to the mpv sub-call arguments
-- Use "" to disable
mpv_profile = "",
-- Hardware decoding
mpv_hwdec = "no",
-- Output debug logs to <thumbnail_path>.log, ala <cache_directory>/<video_filename>/000000.bgra.log
-- The logs are removed after successful encodes, unless you set mpv_keep_logs below
mpv_logs = true,
Expand Down
6 changes: 3 additions & 3 deletions src/thumbnailer_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
end)

0 comments on commit e732ffb

Please sign in to comment.