March 21, 2005

Playing AAC files on slimserver: faad2 problems

Cool gadgets | Linux

The Seagate Barracuda 200Gb hard-disk of my music system decided to die about a week ago. I'm going to send it out to the manufacturer for an exchange, but in the meantime I went out got a Maxtor 250Gb hard-disk instead.

As if this was not painful enough, reinstalling the slimserver software was not as easy as I had expected. After getting Linux and the slimserver software installed, playing AAC files would produce nothing but a disturbing hiss in the speakers. Searching on google for a fix revealed that there might be a problem with different endianess of the bytes being outputted by faad2, the AAC decoding software.

The proposed solution was not pretty: pipe faad2's wav output to lame, which would correctly re-encode the file as mp3. The problem with this solution is that the machine I'm using to serve the music is not beefy, it has only a meager 600MHz Via processor. So I wrote instead a very simple program to swap the order of bytes from stdin and print them out in the correct order at stdout.

Get the program from here, and compile it like this on your machine:

cc -o swab swab.c

Copy the resulting swab binary in /usr/local/bin, or some other location in your path. If you're on linux where mov123 does not exist, carefully comment out all the lines that refer to it in your slimserver's convert.conf file. Then add the following at the end of the file:

mov wav squeezebox *
    [faad] -w -f 2 $FILE$ | swab

The above did the trick for me, and I'm again a happy squeezebox user!

Posted by ovidiu at March 21, 2005 06:44 PM |
Comments

If you have a squeezebox, why are you re-encoding the files to mp3? Can you just decode the aac files to wav and send that to the squeezebox? I would understand if you have the slimp3, but the squeezebox can play wavs.

Posted by: Name on March 21, 2005 08:18 PM

I was trying to avoid re-encoding the AAC files as MP3. The solution I described above decodes the files using faad2 and swaps the output bytes for the wav output to sound correctly on my squeezebox. There is no MP3 encoding happening whatsoever.

Posted by: Ovidiu on March 22, 2005 06:16 AM

I was having the same problem, but discovered it was due to a bug in faad2: it erroneously sends a single extra character to stdout instead of stderr (frontend/main.c line 835).

The swab solution compensates for this, but I found it better to fix the bug.

Cheers.

Posted by: verement on March 29, 2005 11:59 PM

Thanks for the hint. In the meantime I discovered that in some cases, probably due to the same problem you mention, the output gets wrong after some time. I'll definitely apply the fix you suggest. Thanks!

Posted by: Ovidiu on March 30, 2005 09:56 AM

Sure enough, the change you mention fixes the faad bug with the hissing sound!

Posted by: Ovidiu on March 30, 2005 08:28 PM
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?



 
Copyright © 2002-2016 Ovidiu Predescu.