diff --git a/backend/ffmpeg.go b/backend/ffmpeg.go index 034c434..c356e17 100644 --- a/backend/ffmpeg.go +++ b/backend/ffmpeg.go @@ -91,7 +91,17 @@ func GetFFmpegPath() (string, error) { ffmpegName = "ffmpeg.exe" } - return filepath.Join(ffmpegDir, ffmpegName), nil + localPath := filepath.Join(ffmpegDir, ffmpegName) + if _, err := os.Stat(localPath); err == nil { + return localPath, nil + } + + path, err := exec.LookPath(ffmpegName) + if err == nil { + return path, nil + } + + return localPath, nil } func GetFFprobePath() (string, error) { @@ -105,12 +115,17 @@ func GetFFprobePath() (string, error) { ffprobeName = "ffprobe.exe" } - ffprobePath := filepath.Join(ffmpegDir, ffprobeName) - if _, err := os.Stat(ffprobePath); err == nil { - return ffprobePath, nil + localPath := filepath.Join(ffmpegDir, ffprobeName) + if _, err := os.Stat(localPath); err == nil { + return localPath, nil } - return "", fmt.Errorf("ffprobe not found in app directory") + path, err := exec.LookPath(ffprobeName) + if err == nil { + return path, nil + } + + return localPath, fmt.Errorf("ffprobe not found in app directory or system path") } func IsFFprobeInstalled() (bool, error) {