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:
Deluan Quintão
2026-03-11 09:26:32 -04:00
committed by GitHub
parent 51c48bcacd
commit d8bc41fbb1
8 changed files with 111 additions and 17 deletions
+1 -6
View File
@@ -283,7 +283,7 @@ var formatCodecMap = map[string]string{
var formatOutputMap = map[string]string{
"mp3": "mp3",
"opus": "opus",
"aac": "ipod",
"aac": "adts",
"flac": "flac",
}
@@ -339,11 +339,6 @@ func buildDynamicArgs(opts TranscodeOptions) []string {
args = append(args, "-f", outputFmt)
}
// For AAC in MP4 container, enable fragmented MP4 for pipe-safe streaming
if opts.Format == "aac" {
args = append(args, "-movflags", "frag_keyframe+empty_moov")
}
args = append(args, "-")
return args
}