From f9916207c8bbfc70ba4560092a171306f11542eb Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 11 Jan 2021 18:31:15 -0800 Subject: [PATCH] Add more checking around ffmpeg version validation. closes #619 --- config/verifyInstall.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/config/verifyInstall.go b/config/verifyInstall.go index 0e83c3549..1ae6c849f 100644 --- a/config/verifyInstall.go +++ b/config/verifyInstall.go @@ -7,6 +7,8 @@ import ( "os/exec" "strings" + log "github.com/sirupsen/logrus" + "golang.org/x/mod/semver" ) @@ -37,14 +39,26 @@ func verifyFFMpegPath(path string) error { response := string(out) if response == "" { - fmt.Println(err) return fmt.Errorf("unable to determine the version of your ffmpeg installation at %s. you may experience issues with video.", path) } responseComponents := strings.Split(response, " ") + if len(responseComponents) < 3 { + log.Debugf("unable to determine the version of your ffmpeg installation at %s. you may experience issues with video.", path) + return nil + } + fullVersionString := responseComponents[2] + versionString := "v" + strings.Split(fullVersionString, "-")[0] - if !semver.IsValid(versionString) || semver.Compare(versionString, FfmpegSuggestedVersion) == -1 { + + // Some builds of ffmpeg have wierd build numbers that we can't parse + if !semver.IsValid(versionString) { + log.Debugf("unable to determine if ffmpeg version %s is recent enough. if you experience issues with video you may want to look into updating", fullVersionString) + return nil + } + + if semver.Compare(versionString, FfmpegSuggestedVersion) == -1 { return fmt.Errorf("your %s version of ffmpeg at %s may be older than the suggested version of %s. you may experience issues with video.", versionString, path, FfmpegSuggestedVersion) }