Make ffmpeg version parsing more resilient

This commit is contained in:
Ingo Oppermann 2026-02-06 17:20:16 +01:00
parent 5dc8fc5ff1
commit 7349b8f2e3
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -310,7 +310,7 @@ func version(binary string) (ffmpeg, error) {
func parseVersion(data []byte) ffmpeg {
f := ffmpeg{}
reVersion := regexp.MustCompile(`^ffmpeg version ([0-9]+\.[0-9]+(\.[0-9]+)?)`)
reVersion := regexp.MustCompile(`(?m)^ffmpeg version ([0-9]+\.[0-9]+(\.[0-9]+)?)`)
reCompiler := regexp.MustCompile(`(?m)^\s*built with (.*)$`)
reConfiguration := regexp.MustCompile(`(?m)^\s*configuration: (.*)$`)
reLibrary := regexp.MustCompile(`(?m)^\s*(lib(?:[a-z]+))\s+([0-9]+\.\s*[0-9]+\.\s*[0-9]+) /\s+([0-9]+\.\s*[0-9]+\.\s*[0-9]+)`)