feat: Enhance GetFFmpegPath and GetFFprobePath to search the system PATH for executables. (#462)

This commit is contained in:
Yuval
2026-02-10 16:00:01 +02:00
committed by GitHub
parent 71bce5d33e
commit 36a77ad8d1
+20 -5
View File
@@ -91,7 +91,17 @@ func GetFFmpegPath() (string, error) {
ffmpegName = "ffmpeg.exe" 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) { func GetFFprobePath() (string, error) {
@@ -105,12 +115,17 @@ func GetFFprobePath() (string, error) {
ffprobeName = "ffprobe.exe" ffprobeName = "ffprobe.exe"
} }
ffprobePath := filepath.Join(ffmpegDir, ffprobeName) localPath := filepath.Join(ffmpegDir, ffprobeName)
if _, err := os.Stat(ffprobePath); err == nil { if _, err := os.Stat(localPath); err == nil {
return ffprobePath, 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) { func IsFFprobeInstalled() (bool, error) {