From fb33d93b311557d4115e22c216109fcb656d6873 Mon Sep 17 00:00:00 2001 From: ishkong <19740260+ishkong@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20Update=20ffrmpeg=20scre?= =?UTF-8?q?enshot=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video Force a screenshot of the 0th second of the video --- global/codec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global/codec.go b/global/codec.go index 223c533..6a5f088 100644 --- a/global/codec.go +++ b/global/codec.go @@ -43,6 +43,6 @@ func EncodeMP4(src string, dst string) error { // -y 覆盖文件 // ExtractCover 获取给定视频文件的Cover func ExtractCover(src string, target string) error { - cmd := exec.Command("ffmpeg", "-i", src, "-y", "-r", "1", "-f", "image2", target) + cmd := exec.Command("ffmpeg", "-i", src, "-y", "-ss", "0", "-frames:v", "1", target) return errors.Wrap(cmd.Run(), "extract video cover failed") }