From d016934d830b59929005557f239f80f233464c37 Mon Sep 17 00:00:00 2001 From: Rogee Date: Mon, 31 Mar 2025 15:15:58 +0800 Subject: [PATCH] feat: auto replace --- backend/Makefile | 2 +- backend/app/service/commands/compress.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/Makefile b/backend/Makefile index ce1fed2..80291a6 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -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 diff --git a/backend/app/service/commands/compress.go b/backend/app/service/commands/compress.go index 0bdc74c..ad29c65 100644 --- a/backend/app/service/commands/compress.go +++ b/backend/app/service/commands/compress.go @@ -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