From 39aaeb02e27a80c4b9b289e910d706cdc12fe8f3 Mon Sep 17 00:00:00 2001 From: leson207 Date: Sun, 5 Apr 2026 22:06:27 +0700 Subject: [PATCH] fix: avoid ffmpeg no-frame error when seeking with nokey --- yazi-plugin/preset/plugins/video.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yazi-plugin/preset/plugins/video.lua b/yazi-plugin/preset/plugins/video.lua index 0d21581d..dc9aa06d 100644 --- a/yazi-plugin/preset/plugins/video.lua +++ b/yazi-plugin/preset/plugins/video.lua @@ -46,7 +46,7 @@ function M:preload(job) end local pic = M.has_pic(meta) - local percent = (pic and 0 or 5) + job.skip + local percent = (pic and 0 or 10) + job.skip if percent > 95 then ya.emit("peek", { pic and 95 or 90, only_if = job.file.url, upper_bound = true }) return false @@ -58,8 +58,12 @@ function M:preload(job) if percent ~= 0 then cmd:arg { "-ss", math.floor(meta.format.duration * percent / 100) } + else + cmd:arg { "-skip_frame", "nokey" } end - cmd:arg { "-skip_frame", "nokey", "-i", tostring(job.file.path) } + + cmd:arg { "-i", tostring(job.file.path) } + if percent == 0 then cmd:arg { "-map", "disp:attached_pic" } end