diff --git a/backend/app/service/commands/compress.go b/backend/app/service/commands/compress.go index 7689b65..f1b3a23 100644 --- a/backend/app/service/commands/compress.go +++ b/backend/app/service/commands/compress.go @@ -1,6 +1,7 @@ package commands import ( + "bytes" "crypto/md5" "encoding/json" "fmt" @@ -262,13 +263,16 @@ 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("%q", dstPath)) + cmd := exec.Command("ffmpeg", "-i", srcPath, "-c:v", "libx264", "-crf", "23", "-r", "25", "-c:a", "copy", fmt.Sprintf("'%s'", dstPath)) if width > 1920 || height > 1080 { - cmd = exec.Command("ffmpeg", "-i", fmt.Sprintf("%q", srcPath), "-c:v", "libx264", "-crf", "23", "-r", "25", "-c:a", "copy", "-vf", "scale=1920:1080", fmt.Sprintf("%q", dstPath)) + cmd = exec.Command("ffmpeg", "-i", fmt.Sprintf("'%s'", srcPath), "-c:v", "libx264", "-crf", "23", "-r", "25", "-c:a", "copy", "-vf", "scale=1920:1080", fmt.Sprintf("'%s'", dstPath)) } + var stderr bytes.Buffer + cmd.Stderr = &stderr log.Infof("executing command: %s", cmd.String()) if err := cmd.Run(); err != nil { + log.Errorf("stderr: %s", stderr.String()) return errors.Wrapf(err, "failed to execute compress command: %s", cmd.String()) } @@ -276,9 +280,12 @@ func compressVideo(srcPath, dstPath string) error { } func getVideoSize(filePath string) (int, int, error) { - cmd := exec.Command("ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=height,width", "-of", "default=noprint_wrappers=1:nokey=1", fmt.Sprintf("%q", filePath)) + var stderr bytes.Buffer + cmd := exec.Command("ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=height,width", "-of", "default=noprint_wrappers=1:nokey=1", fmt.Sprintf("'%s'", filePath)) + cmd.Stderr = &stderr out, err := cmd.Output() if err != nil { + log.Errorf("stderr: %s", stderr.String()) return 0, 0, errors.Wrapf(err, "failed to execute command: %s", cmd.String()) } lines := strings.Split(string(out), "\n") diff --git a/quyun.code-workspace b/quyun.code-workspace index 416430e..a4bd356 100644 --- a/quyun.code-workspace +++ b/quyun.code-workspace @@ -1,10 +1,19 @@ { "folders": [ { - "path": "backend" + "path": "backend", + "name": "Backend", }, { - "path": "frontend/admin" - }, - ] + "path": "frontend/admin", + "name": "Admin" + } + ], + "settings": { + "github.copilot.chat.codeGeneration.instructions": [ + { + "file": "./.vscode/daisyui.md" + } + ] + } } \ No newline at end of file