fix: use ADTS for AAC transcoding, temporarily exclude AAC from transcode decisions (#5167)
* fix: use ADTS format for AAC transcoding to avoid silent output on ffmpeg 8.0+ The fragmented MP4 muxer (`-f ipod -movflags frag_keyframe+empty_moov`) produces corrupt/silent audio when ffmpeg pipes to stdout, confirmed on ffmpeg 8.0+. The moof atom offset values are zeroed out in pipe mode, causing AAC decoder errors. Switch to `-f adts` (raw AAC framing) which works reliably via pipe and is widely supported by clients including UPnP/Sonos devices. * fix: exclude AAC from transcode decision, as it is not working for Sonos. Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -80,6 +80,11 @@ func matchesCodec(codec string, codecs []string) bool {
|
||||
return matchesWithAliases(codec, codecs, codecAliasGroups)
|
||||
}
|
||||
|
||||
// IsAACCodec returns true if the given codec or container name resolves to AAC.
|
||||
func IsAACCodec(name string) bool {
|
||||
return matchesCodec(name, []string{"aac"}) || matchesContainer(name, []string{"aac"})
|
||||
}
|
||||
|
||||
func containsIgnoreCase(slice []string, s string) bool {
|
||||
return slices.ContainsFunc(slice, func(item string) bool {
|
||||
return strings.EqualFold(item, s)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package stream
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Aliases", func() {
|
||||
Describe("IsAACCodec", func() {
|
||||
It("returns true for AAC and its aliases", func() {
|
||||
Expect(IsAACCodec("aac")).To(BeTrue())
|
||||
Expect(IsAACCodec("AAC")).To(BeTrue())
|
||||
Expect(IsAACCodec("adts")).To(BeTrue())
|
||||
Expect(IsAACCodec("m4a")).To(BeTrue())
|
||||
Expect(IsAACCodec("mp4")).To(BeTrue())
|
||||
Expect(IsAACCodec("m4b")).To(BeTrue())
|
||||
})
|
||||
|
||||
It("returns false for non-AAC formats", func() {
|
||||
Expect(IsAACCodec("mp3")).To(BeFalse())
|
||||
Expect(IsAACCodec("opus")).To(BeFalse())
|
||||
Expect(IsAACCodec("flac")).To(BeFalse())
|
||||
Expect(IsAACCodec("ogg")).To(BeFalse())
|
||||
})
|
||||
|
||||
It("returns false for empty string", func() {
|
||||
Expect(IsAACCodec("")).To(BeFalse())
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user