From f269f92527e9b9b6e4beb3c6bff76b1b01b3a49a Mon Sep 17 00:00:00 2001 From: AI Engineer Date: Mon, 18 May 2026 19:51:37 +0800 Subject: [PATCH] chore: infrastructure alignment and doc sync (by codervall) --- preview.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/preview.go b/preview.go index d3a60eb..6b7d589 100644 --- a/preview.go +++ b/preview.go @@ -114,8 +114,8 @@ func GenerateVideoPreview(videoPath, outPath string, width, height int, frameInt return err } for i, t := range times { - framePath := filepath.Join(outPath, fmt.Sprintf("%d.webp", i+1)) - cmd := exec.Command(v.FFmpegPath, "-ss", fmt.Sprintf("%f", t), "-i", videoPath, "-frames:v", "1", "-vf", vf, "-c:v", "libwebp", "-quality", "80", "-y", framePath) + framePath := filepath.Join(outPath, fmt.Sprintf("%d.jpg", i+1)) + cmd := exec.Command(v.FFmpegPath, "-ss", fmt.Sprintf("%f", t), "-i", videoPath, "-frames:v", "1", "-vf", vf, "-q:v", "2", "-y", framePath) if err := cmd.Run(); err != nil { return err } @@ -140,8 +140,8 @@ func GenerateAudioPreview(mediaPath, outPath string) error { args := []string{"-i", mediaPath, "-vn", "-ar", "16000", "-ac", "1"} if ext == ".wav" { - // WAV 格式,保留 PCM - args = append(args, "-y", outPath) + // WAV 格式,保留 PCM,最长 180 秒避免 LLM OOM + args = append(args, "-t", "180", "-y", outPath) } else { // 默认或 .ogg 使用 libopus 极致压缩,最长 180 秒 args = append(args, "-c:a", "libopus", "-b:a", "12k", "-t", "180", "-y", outPath) @@ -160,3 +160,4 @@ func getVideoDuration(videoPath string) (float64, error) { _, err = fmt.Sscanf(strings.TrimSpace(string(out)), "%f", &duration) return duration, err } +