• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Can *any* RaspPi-based streamer handle gapless AAC?

charleski

Major Contributor
Joined
Dec 15, 2019
Messages
1,098
Likes
2,240
Location
Manchester UK
It appears that streamers based on open-source mpd/ffmpeg code are unable to implement gapless playback of aac files, probably because they aren't correctly handling the metadata tags. I've tested this on the latest builds of both moode and Volumio, and both skip between tracks.

I've uploaded a bunch of test tracks that you can find here:

There are two metadata methods by which gapless aac playback can be implemented, the original Apple scheme using itunsMPB tags, and the ISO method using elst/sdst tags. The files that I've uploaded use two different encoders (qaac and dBPoweramp/FDK), both of which allow the tagging method to be specified ('gm' refers to encoding via qaac using the --gapless-mode option as specified in its docs). No matter which encoder I use or which gapless mode tagging is implemented, they all fail, with an audible tick between tracks because ffmpeg isn't skipping the priming samples.

Looking at mpd's log I see ffmpeg throwing a "ffmpeg/aac: Could not update timestamps for skipped samples" warning, but only when playing the files encoded by qaac. This is thrown at this point in the ffmpeg code. ffprobe seems to show that ffmpeg is recognising both the itunsMPB and ISO tags, so I don't know if this is an ffmpeg issue or because mpd isn't properly setting the pkt_timebase. Since the files encoded with dBPoweramp/FDK don't result in this warning but still skip between tracks I'm not sure of the relevance of this warning.

All these files play with perfect gapless performance in foobar2k, and I never had this problem with Audirvana when I was using a Mac. I've included a set of files encoded with mp3 and ogg, both of which are perfectly gapless on moode (as are flacs of course), so this is just a problem with aac files.

I know there are lots of other music players for the Raspberry Pi, like picoreplayer and RopieeXL, so if you are using one of those I'd really appreciate it if you could test the files I linked above and let me know if your player can handle them gaplessly. This would save me flashing and setting them up.
 
OP
charleski

charleski

Major Contributor
Joined
Dec 15, 2019
Messages
1,098
Likes
2,240
Location
Manchester UK
Thanks. Frankly it beggars belief that a major open source program like ffmpeg still can’t properly play a major audio codec in 2023.
 

somebodyelse

Major Contributor
Joined
Dec 5, 2018
Messages
3,741
Likes
3,026
Given how little support there is for gapless in general I'm not entirely surprised. It takes a developer who's interested enough to implement it, or a company that needs it enough to pay someone to do it. I didn't dig deeply enough into the bug reports to see if anyone had tried addressing it but not had it accepted for whatever reason.
 
OP
charleski

charleski

Major Contributor
Joined
Dec 15, 2019
Messages
1,098
Likes
2,240
Location
Manchester UK
Well, I've finally found the answer:
piCorePlayer seems to be the only RaspPi setup that can do gapless aac, but it only handles itunsMPB tags (i.e ignores the ISO 'standard' method). It looks like any player that's based on mpd/ffmpeg (mOode, Volumio, etc) is totally broken as far as gapless aac is concerned: ffmpeg has several open tickets about its failure to handle this which date back many years (and frankly, that's a disgrace).

Of course getting proper DSP on piCorePlayer is a whole 'nother adventure. Using server-side EQ by piping through sox with a custom_convert.conf file introduces latency that breaks gapless playback, but I finally got camilladsp working with the hacked alsa_cdsp squeezelite and am happy to say it seems fine.

[Edit] I strongly suspect that the above applies to any system running LMS/Squeezelite as long as the LMS build has not enabled ffmpeg (which I see is an option). You want to make sure aac is decoded using faad.
 
Last edited:
  • Like
Reactions: MCH
Top Bottom