From cc670975945ffcfb4fb39c9613fdaae193ca1fcb Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Mon, 25 Nov 2024 22:05:54 -0500 Subject: [PATCH] Swapped default aac encoder with libfdk_aac in transcoded audio tracks. --- Dockerfile | 6 +++++- core/transcoder/transcoder.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ffd7beed..3c1f2985f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,11 @@ RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags "-extldflag # Create the image by copying the result of the build into a new alpine image FROM alpine:3.20.3 -RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates +RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates + +# Import a copy of ffmpeg with libfdk_aac included from a separate image +COPY --from=my-ffmpeg-static:latest /ffmpeg /usr/bin/ +COPY --from=my-ffmpeg-static:latest /ffprobe /usr/bin/ RUN addgroup -g 101 -S owncast && adduser -u 101 -S owncast -G owncast diff --git a/core/transcoder/transcoder.go b/core/transcoder/transcoder.go index 36a5587a7..b2a0095d8 100644 --- a/core/transcoder/transcoder.go +++ b/core/transcoder/transcoder.go @@ -415,8 +415,8 @@ func (v *HLSVariant) getAudioQualityString() string { return fmt.Sprintf("-map a:0? -c:a:%d copy", v.index) } - // libfdk_aac is not a part of every ffmpeg install, so use "aac" instead - encoderCodec := "aac" + // libfdk_aac is part of my ffmpeg install, so use it instead of "aac" + encoderCodec := "libfdk_aac" return fmt.Sprintf("-map a:0? -c:a:%d %s -b:a:%d %s", v.index, encoderCodec, v.index, v.audioBitrate) }