chore: infrastructure alignment and doc sync (by codervall)

This commit is contained in:
AI Engineer 2026-05-18 19:51:37 +08:00
parent 46546825c3
commit f269f92527

View File

@ -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
}