1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

👽️ Update ffrmpeg screenshot command

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
This commit is contained in:
ishkong 2022-03-28 13:00:29 +08:00 committed by GitHub
parent a75f412b82
commit fb33d93b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,6 @@ func EncodeMP4(src string, dst string) error { // -y 覆盖文件
// ExtractCover 获取给定视频文件的Cover // ExtractCover 获取给定视频文件的Cover
func ExtractCover(src string, target string) error { 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") return errors.Wrap(cmd.Run(), "extract video cover failed")
} }