Skip to content

Commit

Permalink
Cheeck if AAC encoder is available on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
KillerX committed Nov 29, 2024
1 parent 62872ee commit 2aca1ca
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
"os/exec"
"reflect"
"runtime"
"strconv"
Expand Down Expand Up @@ -80,6 +81,23 @@ func main() {
panic(err)
}

if environment.GetQueue() == environment.QueueAudio {
// Test if the libfdk_aac encoder is available
cmd := exec.Command("ffmpeg", "-xerror",
"-f", "lavfi", "-xerror",
"-i", "sine=frequency=1000:duration=0.1",
"-c:a", "libfdk_aac",
"-f", "null", "-")

err := cmd.Run()
if err != nil {
panic(err)
}

if cmd.ProcessState.ExitCode() != 0 {
panic("audio worker must support ffmpeg with libfdk_aac")
}
}
workerOptions := worker.Options{
DeadlockDetectionTimeout: time.Hour * 3,
DisableRegistrationAliasing: true, // Recommended according to readme, default false for backwards compatibility
Expand Down

0 comments on commit 2aca1ca

Please sign in to comment.