Skip to content

Commit

Permalink
同步与整合上游
Browse files Browse the repository at this point in the history
核心:
同步 --hwdec --icc-cache --icc-cache-dir --gpu-shader-cache --gpu-shader-cache-dir --screenshot-format
精简与修正部分参数注释

脚本:
load_plus 合并来自 autoload.lua 的性能优化
  • Loading branch information
hooke007 committed Jul 21, 2023
1 parent cc93b9d commit 179f177
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 40 deletions.
39 changes: 20 additions & 19 deletions portable_config/mpv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
d3d11-exclusive-fs = no # [当 --gpu-api=d3d11 时] 全屏时独占,默认 no
d3d11-flip = yes # (通常在 --d3d11-exclusive-fs=yes 和 --on-top 一起使用时)禁用它可避免MPV全屏时的冻屏问题,默认 yes

hwdec = no # 指定应使用的硬件视频解码API,默认值 no 为软解。值 auto 等效 yes 即原生硬解,但不支持部分设置/滤镜。
hwdec = no # 指定应使用的硬件视频解码API,默认值 no 为软解。值 auto 或 auto-safe(等效值 yes) 即优先尝试原生硬解,但不支持部分设置/滤镜。
# 它也可以是多个值组成的优先级列表,例如值 vulkan-copy,nvdec-copy,dxva2-copy 表示依次尝试这些解码模式
# 更多详情参见Wiki的FAQ页面下的“软硬解的选择”部分
hwdec-codecs = "h264,vc1,hevc,vp8,vp9,av1,prores"
Expand Down Expand Up @@ -50,12 +50,14 @@
idle = no # <yes|默认no|once> 是否空闲待机(中止播放或所有文件播放后依旧保持mpv运行)
input-ipc-server = # [使用SVP Manager时的值应为 mpvpipe ] IPC支持,默认为空
input-builtin-bindings = yes # 是否使用mpv初始的快捷键(禁用则只使用 input.conf 中的设定),默认 yes
input-default-bindings = yes # 类似上一项,但也关联mpv脚本中预设的弱绑定键位,默认 yes
input-default-bindings = yes # 类似上一项,但也涉及mpv脚本中预设的弱绑定键位,默认 yes
background = "#FF000000" # <格式为(AA)RRGGBB> 更改MPV初启动与播放无视频轨文件时的背景颜色
pause = no # 是否以暂停状态启动播放器,默认 no
panscan = 0.0 # <0.0-1.0> 裁切横向画面以充满窗口(建议配合 --keepaspect-window=no 使用),默认 0.0
loop = no # <N|inf|默认no> 始终循环播放当前文件
loop-playlist = no # <N|inf|force|默认no> 播放列表循环
panscan = 0.0 # <0.0-1.0> 额外的后处理(使用 --scale 的算法)放大画面,默认 0.0
# 这取决于窗口和源之间是否存在额外黑边(可用于 --keepaspect-window=no 时的画面自动填充),如不存在则什么也不做
# 值为 1 时,也常用于消除全屏播放时,片源与显示器的宽高比不一致而产生的黑边(部分画面在视觉效果上被裁切)
loop = no # <inf|默认no> 是否循环播放当前文件
loop-playlist = no # <inf|force|默认no> 播放列表循环。值 force 会强制播放列表中标记为失效的条目而不是跳过它
hr-seek-framedrop = yes # [补帧时推荐设置为no] 跳转时允许丢帧,默认 yes 。禁用它利于修正音频延迟
save-position-on-quit = no # 退出时记住播放状态,默认 no
watch-later-options = start,osd-level,speed,edition,pause,volume,mute,audio-delay,fullscreen,ontop,border,gamma,brightness,contrast,saturation,hue,deinterlace,vf,af,panscan,aid,vid,sid,sub-delay,sub-speed,sub-pos,sub-visibility,sub-scale,sub-use-margins,sub-ass-force-margins,sub-ass-vsfilter-aspect-compat,sub-ass-override,ab-loop-a,ab-loop-b,video-aspect-overrideosd-level,speed,edition,pause,volume,mute,audio-delay,fullscreen,ontop,border,gamma,brightness,contrast,saturation,hue,deinterlace,vf,af,panscan,aid,vid,sid,sub-delay,sub-speed,sub-pos,sub-visibility,sub-scale,sub-use-margins,sub-ass-force-margins,sub-ass-vsfilter-aspect-compat,sub-ass-override,ab-loop-a,ab-loop-b,video-aspect-override
Expand Down Expand Up @@ -83,16 +85,16 @@
##⇘⇘缓存相关

demuxer-max-bytes = 150MiB # 播放网络视频时的向后缓存大小(KiB或MiB),默认 150MiB
icc-cache = no # 是否在本地存储ICC配置文件的3dlut缓存,默认 no
icc-cache = yes # 是否在本地存储ICC配置文件的3dlut缓存,默认 yes
# 可以用来加快加载速度,未压缩的LUT的大小取决于 --icc-3dlut-size
icc-cache-dir =
# 指定ICC配置文件的3dlut缓存目录(例值 "~~/_cache/icc"),WIN平台默认为主设置路径
# 指定ICC配置文件的3dlut缓存目录(例值 "~~/_cache/icc"),Windows平台便携式设置下的默认实际为 "~~/cache"

gpu-shader-cache = no # 是否在本地存储GLSL着色器的编译缓存,可以提高启动性能,默认 no
gpu-shader-cache = yes # 是否在本地存储GLSL着色器的编译缓存,可以提高启动性能,默认 yes
gpu-shader-cache-dir =
# 指定GLSL着色器的编译缓存目录(例值 "~~/_cache/shader"),WIN平台默认为主设置路径
# 指定GLSL着色器的编译缓存目录(例值 "~~/_cache/shader"),Windows平台便携式设置下的默认实际为 "~~/cache"
watch-later-directory =
# 稍后观看功能的缓存目录,其中的文件记录 --watch-later-options 指定的项。默认为空(实际路径为 "~~/watch_later"
# 稍后观看功能的缓存目录,其中的文件记录 --watch-later-options 指定的项。WIN平台默认为 "~~/watch_later"



Expand Down Expand Up @@ -237,11 +239,11 @@
##--glsl-shaders-append 等效 --glsl-shader (注意和上行中参数的区别),表示追加着色器(单次仅能追加一项),并不会覆盖第一条 --glsl-shaders 指定的着色器,可无限追加该命令。

##初始加载多个着色器的示例写法
glsl-shaders = "~~/shaders/aaaaa.glsl;~~/shaders/bbbbb.glsl;~~/shaders/ccccc.glsl"
glsl-shaders = "~~/shaders/hooks_01.glsl;~~/shaders/hooks_02.glsl;~~/shaders/hooks_03.glsl"

##下接的逐个单项 --glsl-shaders-append (或 --glsl-shader ) 会依次排列在 --glsl-shaders 之后,当然你也可以不写 --glsl-shaders 只用前二者选项的队列
glsl-shaders-append = "~~/shaders/ddddd.glsl"
glsl-shaders-append = "~~/shaders/eeeee.glsl"
glsl-shaders-append = "~~/shaders/hooks_04.glsl"
glsl-shaders-append = "~~/shaders/hooks_05.glsl"



Expand Down Expand Up @@ -306,22 +308,21 @@
########
# 截图 #
########
##⇘⇘截图的输出质量设定的越高,处理效率越低

screenshot-format = jpg # <默认 jpg|(同前)jpeg|png|webp|jxl>
screenshot-format = jpg # <默认 jpg|(同前)jpeg|png|webp|jxl|avif>

##此处未列出全部条目,其它格式对应的关联选项参见官方手册
## https://mpv.io/manual/master/#options-screenshot-webp-lossless
## https://mpv.io/manual/master/#options-screenshot-avif-encoder
screenshot-jpeg-quality = 90 # <0-100> JPEG的质量,默认 90
screenshot-jpeg-source-chroma = yes # 用与源视频相同的色度半采样写入JPEG,默认 yes
screenshot-png-compression = 7 # <0-9> PNG压缩等级,过高的等级影响性能,默认 7
screenshot-png-filter = 5 # <0-5> PNG的压缩过滤器。默认值 5 即可实现最佳压缩率
screenshot-webp-lossless = no # 是否使用无损WEBP,默认 no
screenshot-webp-quality = 75 # <0-100> [当 --screenshot-webp-lossless=no 时生效] 有损WEBP的质量,默认 75
screenshot-webp-compression = 4 # <0-6> WEBP压缩等级,使用有损WEBP时进一步降低图片质量,默认 4
screenshot-jxl-distance = 1 # <0-15> JXL的视觉模型距离,0为质量无损,0.1为视觉无损,默认值 1 相当于JPEG的90质量
screenshot-jxl-effort = 4 # <1-9> JXL压缩等级,过高的等级影响性能,默认 4

screenshot-tag-colorspace = yes # 使用适当的色彩空间标记屏幕截图(并非所有格式受支持)默认 yes
screenshot-high-bit-depth = yes # 主要影响PNG/JXL,尽可能使用和视频输出时近似的位深,默认 yes
screenshot-high-bit-depth = yes # 尽可能使用高位深作截屏,可能导致巨大的文件体积(并非所有格式受支持),默认 yes
screenshot-template = "mpv-shot%n"
# 截图命名模板: https://mpv.io/manual/master/#options-screenshot-template
# 示例即默认值。可额外选填路径,例值 "~~desktop/MPV-%P-N%n"
Expand Down
51 changes: 30 additions & 21 deletions portable_config/scripts/load_plus.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--[[
SOURCE_ https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua
COMMIT_ 7b09bf7ffc1a927e4d45eb0407ec7024bff2f4d5
COMMIT_ 3ba446d0b065f867ca262a2e05e4e8d24c7c0783
SOURCE_ https://github.com/rossy/mpv-open-file-dialog/blob/master/open-file-dialog.lua
COMMIT_ 04fe818fc703d8c5dcc3a6aabe1caeed8286bdbb
文档_ https://github.com/hooke007/MPV_lazy/discussions/106
Expand Down Expand Up @@ -116,12 +116,11 @@ if opt.video then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_VIDEO) end
if opt.audio then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_AUDIO) end
if opt.image then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_IMAGE) end

function add_files_at(index, files)
index = index - 1
function add_files(files)
local oldcount = mp.get_property_number("playlist-count", 1)
for i = 1, #files do
mp.commandv("loadfile", files[i], "append")
mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
mp.commandv("loadfile", files[i][1], "append")
mp.commandv("playlist-move", oldcount + i - 1, files[i][2])
end
end

Expand Down Expand Up @@ -162,11 +161,10 @@ function alphanumsort(filenames)
return filenames
end

function get_playlist_filenames()
function get_playlist_filenames(playlist)
local filenames = {}
for n = 0, pl_count - 1, 1 do
local filename = mp.get_property("playlist/"..n.."/filename")
local _, file = utils.split_path(filename)
for i = 1, #playlist do
local _, file = utils.split_path(playlist[i].filename)
filenames[file] = true
end
return filenames
Expand Down Expand Up @@ -244,32 +242,43 @@ function find_and_add_entries()
msg.trace("自动队列:当前文件所处序列 "..current)

local append = {[-1] = {}, [1] = {}}
local filenames = get_playlist_filenames()
local filenames = get_playlist_filenames(pl)
for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
for i = 1, opt.max_entries do
local file = files[current + i * direction]
local pos = current + i * direction
local file = files[pos]
if file == nil or file[1] == "." then
break
end

local filepath = dir .. file
-- skip files already in playlist
if filenames[file] then break end

if direction == -1 then
if pl_current == 1 then -- never add additional entries in the middle
if not filenames[file] then
if direction == -1 then
msg.info("自动队列 追加(前)" .. file)
table.insert(append[-1], 1, filepath)
table.insert(append[-1], 1, {filepath, pos - 1})
else
msg.info("自动队列 追加(后)" .. file)
if pl_count > 1 then
table.insert(append[1], {filepath, pos - 1})
else
mp.commandv("loadfile", filepath, "append")
end
end
else
msg.info("自动队列 追加(后)" .. file)
table.insert(append[1], filepath)
end
end
if pl_count == 1 and direction == -1 and #append[-1] > 0 then
for i = 1, #append[-1] do
mp.commandv("loadfile", append[-1][i][1], "append")
end
mp.commandv("playlist-move", 0, current)
end
end

add_files_at(pl_current + 1, append[1])
add_files_at(pl_current, append[-1])
if pl_count > 1 then
add_files(append[1])
add_files(append[-1])
end
end


Expand Down

0 comments on commit 179f177

Please sign in to comment.