Skip to content

Commit

Permalink
feat: enable hw for decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
hooke007 authored and po5 committed Oct 29, 2022
1 parent 1bab743 commit a4d2f10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Hover on the timeline for nice thumbnails.
`spawn_first`: Spawn thumbnailer on file load for faster initial thumbnails. Defaults to no.
`network`: Enable on remote files. Defaults to no.
`audio`: Enable on audio files. Defaults to no.
`hwdec`: Enable hardware decoding. Defaults to no.
`use_lua_io`: Windows only: write directly to pipe (requires LuaJIT). Should improve performance, ymmv.

## For UI developers: How to add thumbfast support to your script
Expand Down
3 changes: 3 additions & 0 deletions thumbfast.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ network=no
# Enable on audio playback
audio=no

# Enable hardware decoding
hwdec=no

# Windows only: don't use subprocess to communicate with socket (warning: blocks, might cause hangs)
use_lua_io=no
7 changes: 6 additions & 1 deletion thumbfast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ local options = {
-- Enable on audio playback
audio = false,

-- Enable hardware decoding
hwdec = false,

-- Windows only: don't use subprocess to communicate with socket
use_lua_io = false
}
Expand Down Expand Up @@ -284,12 +287,14 @@ local function spawn(time)

remove_thumbnail_files()

local mpv_hwdec = "no"
if options.hwdec then mpv_hwdec = "auto" end
local args = {
"mpv", path, "--no-config", "--msg-level=all=no", "--idle", "--pause", "--keep-open=always", "--really-quiet", "--no-terminal",
"--edition="..(mp.get_property_number("edition") or "auto"), "--vid="..(mp.get_property_number("vid") or "auto"), "--no-sub", "--no-audio",
"--start="..time, "--hr-seek=no",
"--ytdl-format=worst", "--demuxer-readahead-secs=0", "--demuxer-max-bytes=128KiB",
"--vd-lavc-skiploopfilter=all", "--vd-lavc-software-fallback=1", "--vd-lavc-fast", "--vd-lavc-threads=2",
"--vd-lavc-skiploopfilter=all", "--vd-lavc-software-fallback=1", "--vd-lavc-fast", "--vd-lavc-threads=2", "--hwdec="..mpv_hwdec,
"--vf="..vf_string(filters_all, true),
"--sws-allow-zimg=no", "--sws-fast=yes", "--sws-scaler=fast-bilinear",
"--video-rotate="..last_rotate,
Expand Down

0 comments on commit a4d2f10

Please sign in to comment.