Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hwdec option #21

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)