Skip to content

Commit

Permalink
Add audio encoder checker
Browse files Browse the repository at this point in the history
  • Loading branch information
vladaad committed Aug 22, 2023
1 parent 611058e commit f69e6b9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions settings/ffenccheck.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package settings

import (
"log"
"os"
"os/exec"
)

func CheckAEncoder(encoder string) bool {
var options []string

options = append(options, "-f", "lavfi", "-i", "anullsrc")
options = append(options, "-t", "10")
options = append(options, "-c:a", encoder)
options = append(options, "-f", "null", "-")

if Debug {
log.Println(options)
}

// Execution
cmd := exec.Command(General.FFmpegExecutable, options...)

if Debug {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
log.Println("Testing ", encoder)
}

err := cmd.Start()
if err != nil {
return false
}
err = cmd.Wait()
if err != nil {
return false
}

return true
}

0 comments on commit f69e6b9

Please sign in to comment.