feat: auto replace

This commit is contained in:
Rogee
2025-03-31 15:15:58 +08:00
parent f52eab00b0
commit d016934d83
2 changed files with 3 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ tidy:
.PHONY: release
release:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=${flags} -o bin/release/{{.ProjectName}} .
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=${flags} -o bin/release/app .
@cp config.toml bin/release/
.PHONY: test

View File

@@ -264,9 +264,9 @@ func compressVideo(srcPath, dstPath string) error {
log.Infof("video size: %dx%d", width, height)
// cmd := exec.Command("ffmpeg", "-i", srcPath, "-c:v", "libx264", "-crf", "23", "-r", "25", "-c:a", "copy", fmt.Sprintf("'%s'", dstPath))
cmd := exec.Command("sh", "-c", fmt.Sprintf("ffmpeg -i '%s' -c:v libx264 -crf 23 -r 25 -c:a copy '%s'", srcPath, dstPath))
cmd := exec.Command("sh", "-c", fmt.Sprintf("ffmpeg -i '%s' -y -c:v libx264 -crf 23 -r 25 -c:a copy '%s'", srcPath, dstPath))
if width > 1920 || height > 1080 {
cmd = exec.Command("sh", "-c", fmt.Sprintf("ffmpeg -i '%s' -c:v libx264 -crf 23 -r 25 -c:a copy -vf scale=1920:1080 '%s'", srcPath, dstPath))
cmd = exec.Command("sh", "-c", fmt.Sprintf("ffmpeg -i '%s' -y -c:v libx264 -crf 23 -r 25 -c:a copy -vf scale=1920:1080 '%s'", srcPath, dstPath))
}
var stderr bytes.Buffer
cmd.Stderr = &stderr