Replies: 1 comment 2 replies
-
在滥用openai的产品之前,我的建议是首先熟悉mpv的基本用法。这种简单需求只是写两个profile的事情 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
平时看动漫,大多是1080p,也设置好合适的profile加载好滤镜染色器,但是偶尔看4k,性能就不太够,稍有点卡,时常忘记调回来。因此想根据横向分辨率是否大于1920选择不同profile。
求助于chatgpt,但是不行,以下是它给的代码,lua文件,放进script文件夹里。
请问该如何写这个脚本呢?或者根据不同文件夹选择脚本,也另外是个思路
-- 根据分辨率选择配置文件
-- 获取视频的横向分辨率
function getVideoWidth()
local video_params = mp.get_property_native("video-out-params")
return video_params and video_params["w"] or 0
end
-- 根据分辨率选择配置文件
function selectProfile()
local width = getVideoWidth()
if width > 1920 then
mp.commandv("apply-profile", "sub-SRT")
else
mp.commandv("apply-profile", "AMK自动")
end
end
-- 监听视频加载事件,并在加载时选择配置文件
mp.register_event("file-loaded", selectProfile)
Beta Was this translation helpful? Give feedback.
All reactions