support for homebrew ffmpeg on macos (#561)

* support for homebrew ffmpeg on macos

* Add build instructions

* Revise README

---------

Co-authored-by: afkarxyz <mzamzamafkarhadiq@gmail.com>
This commit is contained in:
sh4tteredd
2026-03-10 12:39:01 +01:00
committed by GitHub
parent 00d3fb9212
commit c21d08f050
2 changed files with 48 additions and 4 deletions
+44
View File
@@ -81,6 +81,28 @@ func GetFFmpegPath() (string, error) {
return localPath, nil
}
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
homebrewPath := "/opt/homebrew/bin/" + ffmpegName
if _, err := os.Stat(homebrewPath); err == nil {
return homebrewPath, nil
}
} else if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
homebrewPath := "/usr/local/bin/" + ffmpegName
if _, err := os.Stat(homebrewPath); err == nil {
return homebrewPath, nil
}
}
if runtime.GOOS != "windows" {
path, err := exec.Command("which", ffmpegName).Output()
if err == nil {
trimmed := strings.TrimSpace(string(path))
if trimmed != "" {
return trimmed, nil
}
}
}
path, err := exec.LookPath(ffmpegName)
if err == nil {
return path, nil
@@ -105,6 +127,28 @@ func GetFFprobePath() (string, error) {
return localPath, nil
}
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
homebrewPath := "/opt/homebrew/bin/" + ffprobeName
if _, err := os.Stat(homebrewPath); err == nil {
return homebrewPath, nil
}
} else if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
homebrewPath := "/usr/local/bin/" + ffprobeName
if _, err := os.Stat(homebrewPath); err == nil {
return homebrewPath, nil
}
}
if runtime.GOOS != "windows" {
path, err := exec.Command("which", ffprobeName).Output()
if err == nil {
trimmed := strings.TrimSpace(string(path))
if trimmed != "" {
return trimmed, nil
}
}
}
path, err := exec.LookPath(ffprobeName)
if err == nil {
return path, nil