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

fix: ffmpeg runtime error

This commit is contained in:
Maiko Tan 2023-01-06 13:06:44 +08:00
parent 524debbfda
commit 008e139c27
No known key found for this signature in database
GPG Key ID: 0F3B49C721E5F453
2 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ func (bot *CQBot) uploadLocalImage(target message.Source, img *LocalImageElement
} }
if mt == "image/webp" && base.ConvertWebpImage { if mt == "image/webp" && base.ConvertWebpImage {
newname := img.File + ".png" newname := img.File + ".png"
err := global.ConvertImagePng(img.File, newname) err := global.ConvertImage(img.File, newname)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "convert webp image error") return nil, errors.Wrap(err, "convert webp image error")
} }

View File

@ -47,7 +47,7 @@ func ExtractCover(src string, target string) error {
return errors.Wrap(cmd.Run(), "extract video cover failed") return errors.Wrap(cmd.Run(), "extract video cover failed")
} }
func ConvertImagePng(src string, target string) error { func ConvertImage(src string, target string) error {
cmd := exec.Command("ffmpeg", "-i", src, "-y", "-f", "png", target) cmd := exec.Command("ffmpeg", "-i", src, "-y", target)
return errors.Wrap(cmd.Run(), "convert image to png failed") return errors.Wrap(cmd.Run(), "convert image to png failed")
} }