PDA

View Full Version : AAC to SqueezeBox via FAAD2 on Linux?



Andrew W. Donoho
2004-02-16, 21:22
Folks,

Since disks are so cheap, I am consolidating the family's music
collection on one server and on our individual machines. We have a
mixture of MP3 and AAC (no DRM) in our iTunes libraries.

I've now installed both LAME and FAAD2 on my RH9 box. I have not been
able to get Slimserver to stream AAC files. FAAD2 can correctly decode
the AAC files into WAV files. Slimserver can serve up these decoded
files but I am having problems streaming from FAAD2. FAAD2 can stream
to the console. As a result, here is start of the stream.:

"RIFF$WAVEfmt D??data???"

In other words, it appears to decode and stream the .m4a file. But,
when streaming, all I get out of the Squeezebox is static. Here are the
appropriate lines from convert.conf (I commented out the mov aif lines.
They are included for comparison.):

## you can comment this out if you want to use LAME to transcode
AAC/MOV files to MP3.
#mov aif squeezebox *
# $mov123$ $FILE$

mov wav squeezebox *
$faad$ -w $FILE$

Below are the results of FAAD2 parsing the AAC file header and the
command line usage for FAAD2.

Any ideas and suggestions on how to get this working are welcome.

Andrew

____________________________________
Andrew W. Donoho
awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
+1 (512) 453-6652 (o), +1 (512) 750-7596 (m)

Here is header info read by FAAD2 from the AAC file:
01 Nick Of Time.m4a file info:

LC AAC 232.692 secs, 2 ch, 44100 Hz

title: Nick Of Time
artist: Bonnie Raitt
writer: Bonnie Raitt
album: Nick Of Time
genre: Rock
track: 1
totaltracks: 11
date: 1989
compilation:
tempo: 00000 BPM
tool: iTunes v4.0.1, QuickTime 6.3
iTunNORM: 00000128 00000132 0000109B 0000103C 01919C80 01919C80
00006293 000062F1 01917D40 018F3350
iTunes_CDDB_IDs: 11+68BE442DA647DE13E35CBD1569B85758+903533

---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------


Here is the usage instruction for FAAD2:
faad [options] infile.aac
Options:
-h Shows this help screen.
-i Shows info about the input file.
-a X Write MPEG-4 AAC ADTS output file.
-t Assume old ADTS format.
-o X Set output filename.
-f X Set output format. Valid values for X are:
1: Microsoft WAV format (default).
2: RAW PCM data.
-b X Set output sample format. Valid values for X are:
1: 16 bit PCM data (default).
2: 24 bit PCM data.
3: 32 bit PCM data.
4: 32 bit floating point data.
5: 64 bit floating point data.
-s X Force the samplerate to X (for RAW files).
-l X Set object type. Supported object types:
1: Main object type.
2: LC (Low Complexity) object type.
4: LTP (Long Term Prediction) object type.
23: LD (Low Delay) object type.
-d Down matrix 5.1 to 2 channels
-w Write output to stdio instead of a file.
-g Disable gapless decoding.
Example:
faad infile.aac
faad infile.mp4
faad -o outfile.wav infile.aac
faad -w infile.aac > outfile.wav
faad -a outfile.aac infile.aac

dean
2004-02-17, 08:55
Hi Andrew,

Try using -f 2 as an option, which should just send out the PCM data
(without the RIFF header.)

I'm not sure if, when spitting out raw PCM data, faad uses big-endian
or little-endian. You may need to change:

mov wav squeezebox *
$faad$ -f 2 -w $FILE$

to

mov aif squeezebox *
$faad$ -f 2 -w $FILE$

Let us know how it works and I'd love to add this as a standard
configuration in a future release.

-dean


On Feb 16, 2004, at 8:22 PM, Andrew W. Donoho wrote:

> Folks,
>
> Since disks are so cheap, I am consolidating the family's music
> collection on one server and on our individual machines. We have a
> mixture of MP3 and AAC (no DRM) in our iTunes libraries.
>
> I've now installed both LAME and FAAD2 on my RH9 box. I have not been
> able to get Slimserver to stream AAC files. FAAD2 can correctly decode
> the AAC files into WAV files. Slimserver can serve up these decoded
> files but I am having problems streaming from FAAD2. FAAD2 can stream
> to the console. As a result, here is start of the stream.:
>
> "RIFF$WAVEfmt D??data???"
>
> In other words, it appears to decode and stream the .m4a file. But,
> when streaming, all I get out of the Squeezebox is static. Here are
> the appropriate lines from convert.conf (I commented out the mov aif
> lines. They are included for comparison.):
>
> ## you can comment this out if you want to use LAME to transcode
> AAC/MOV files to MP3.
> #mov aif squeezebox *
> # $mov123$ $FILE$
>
> mov wav squeezebox *
> $faad$ -w $FILE$
>
> Below are the results of FAAD2 parsing the AAC file header and the
> command line usage for FAAD2.
>
> Any ideas and suggestions on how to get this working are welcome.
>
> Andrew
>
> ____________________________________
> Andrew W. Donoho
> awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
> +1 (512) 453-6652 (o), +1 (512) 750-7596 (m)
>
> Here is header info read by FAAD2 from the AAC file:
> 01 Nick Of Time.m4a file info:
>
> LC AAC 232.692 secs, 2 ch, 44100 Hz
>
> title: Nick Of Time
> artist: Bonnie Raitt
> writer: Bonnie Raitt
> album: Nick Of Time
> genre: Rock
> track: 1
> totaltracks: 11
> date: 1989
> compilation:
> tempo: 00000 BPM
> tool: iTunes v4.0.1, QuickTime 6.3
> iTunNORM: 00000128 00000132 0000109B 0000103C 01919C80 01919C80
> 00006293 000062F1 01917D40 018F3350
> iTunes_CDDB_IDs: 11+68BE442DA647DE13E35CBD1569B85758+903533
>
> ---------------------
> | Config: 2 Ch |
> ---------------------
> | Ch | Position |
> ---------------------
> | 00 | Left front |
> | 01 | Right front |
> ---------------------
>
>
> Here is the usage instruction for FAAD2:
> faad [options] infile.aac
> Options:
> -h Shows this help screen.
> -i Shows info about the input file.
> -a X Write MPEG-4 AAC ADTS output file.
> -t Assume old ADTS format.
> -o X Set output filename.
> -f X Set output format. Valid values for X are:
> 1: Microsoft WAV format (default).
> 2: RAW PCM data.
> -b X Set output sample format. Valid values for X are:
> 1: 16 bit PCM data (default).
> 2: 24 bit PCM data.
> 3: 32 bit PCM data.
> 4: 32 bit floating point data.
> 5: 64 bit floating point data.
> -s X Force the samplerate to X (for RAW files).
> -l X Set object type. Supported object types:
> 1: Main object type.
> 2: LC (Low Complexity) object type.
> 4: LTP (Long Term Prediction) object type.
> 23: LD (Low Delay) object type.
> -d Down matrix 5.1 to 2 channels
> -w Write output to stdio instead of a file.
> -g Disable gapless decoding.
> Example:
> faad infile.aac
> faad infile.mp4
> faad -o outfile.wav infile.aac
> faad -w infile.aac > outfile.wav
> faad -a outfile.aac infile.aac
>

Andrew W. Donoho
2004-02-17, 12:18
On Feb 17, 2004, at 09:55, dean blackketter wrote:
> mov aif squeezebox *
> $faad$ -f 2 -w $FILE$


Dean,

The above is the winning combination of random characters that make
audio media work in Linux . ;-)

Since we do our ripping on big endian machines (Macs), is this a
universal answer or would AAC files ripped on little endian machines
(x86) need to use the wav form of the above mapping?

FAAD2 can be downloaded from AudioCoding.com. There is a problem with
the makefile with the RPM definitions. I just deleted them and went
forward. Here is my installation sequence:

download & expand FAAD2
../bootstrap
../configure

Edit the RPM stuff out of the end of the resulting Makefile

make
make install

add to convert.conf near the bottom (in the SqueezeBox specific section)

mov aif squeezebox *
$faad$ -f 2 -w $FILE$

restart slimserver

This worked for me. (Of course, I now get the problem with static for
the second song played. Stopping and restarting makes the static go
away. This is repeatable.)

Andrew

____________________________________
Andrew W. Donoho
awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
+1 (512) 453-6652 (o), +1 (512) 750-7596 (m)

dean
2004-02-18, 10:38
Hi Andrew,

On Feb 17, 2004, at 11:18 AM, Andrew W. Donoho wrote:
> On Feb 17, 2004, at 09:55, dean blackketter wrote:
>> mov aif squeezebox *
>> $faad$ -f 2 -w $FILE$
>
>
> The above is the winning combination of random characters that make
> audio media work in Linux . ;-)
Great!

> Since we do our ripping on big endian machines (Macs), is this a
> universal answer or would AAC files ripped on little endian machines
> (x86) need to use the wav form of the above mapping?
The ripping shouldn't matter. The issue was that faad was outputting
big-endian data, and we needed to deal with this in the config.
Changing the wav to aif did this.

> FAAD2 can be downloaded from AudioCoding.com. There is a problem with
> the makefile with the RPM definitions. I just deleted them and went
> forward. Here is my installation sequence:
>
> download & expand FAAD2
> ./bootstrap
> ./configure
>
> Edit the RPM stuff out of the end of the resulting Makefile
>
> make
> make install
>
> add to convert.conf near the bottom (in the SqueezeBox specific
> section)
>
> mov aif squeezebox *
> $faad$ -f 2 -w $FILE$
>
> restart slimserver
>
> This worked for me. (Of course, I now get the problem with static for
> the second song played. Stopping and restarting makes the static go
> away. This is repeatable.)
This issue is troublesome. Can you post some more details?
-dean

Andrew W. Donoho
2004-02-20, 15:47
On Feb 18, 2004, at 11:38, dean blackketter wrote:
>> This worked for me. (Of course, I now get the problem with static for
>> the second song played. Stopping and restarting makes the static go
>> away. This is repeatable.)
> This issue is troublesome. Can you post some more details?


Dean,

Sorry to take so long to get back to you - day job and all that....

I've installed the nightly build of slimserver of a few days ago and
updated the SqueezeBox's flash.

I then choose an album, for example, Bonnie Raitt's "Nick of Time". It
was ripped by iTunes 4.01 on my Mac to AAC (.m4a) about a year ago.
(Yeah, I know that I am so "out of it" with this music stuff but
SqueezeBox is getting me enthused about music again.) I am not using
any playlists or other fancy features. I just browser the music folder
and select the album. The first song plays fine. The second is static
with maybe a hint of the tune at very low gain. Stopping the server and
restarting the second track fixes the problem. When that track ends,
the third track starts up with static. Stopping it and restarting the
track fixes the problem again. That is as far as I've tested things.

Would you like me to turn on debugging? And, if so, what should I be
setting for debugging variables (d_*)?

Andrew


____________________________________
Andrew W. Donoho
awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
+1 (512) 453-6652 (o), +1 (512) 750-7596 (m)

dean
2004-02-20, 16:49
Hi Andrew,

I'd like to see the output from the d_source option.

What's happening is that the output from faad seems to be including
some extraneous bytes (a odd number) that's causing the player get out
of sync with the data and decode swapped low and high bytes.

Is it possible that faad is sending an extraneous carriage return at
the end of its output?

-dean


On Feb 20, 2004, at 2:47 PM, Andrew W. Donoho wrote:

>
> On Feb 18, 2004, at 11:38, dean blackketter wrote:
>>> This worked for me. (Of course, I now get the problem with static
>>> for the second song played. Stopping and restarting makes the static
>>> go away. This is repeatable.)
>> This issue is troublesome. Can you post some more details?
>
>
> Dean,
>
> Sorry to take so long to get back to you - day job and all that....
>
> I've installed the nightly build of slimserver of a few days ago and
> updated the SqueezeBox's flash.
>
> I then choose an album, for example, Bonnie Raitt's "Nick of Time".
> It was ripped by iTunes 4.01 on my Mac to AAC (.m4a) about a year ago.
> (Yeah, I know that I am so "out of it" with this music stuff but
> SqueezeBox is getting me enthused about music again.) I am not using
> any playlists or other fancy features. I just browser the music folder
> and select the album. The first song plays fine. The second is static
> with maybe a hint of the tune at very low gain. Stopping the server
> and restarting the second track fixes the problem. When that track
> ends, the third track starts up with static. Stopping it and
> restarting the track fixes the problem again. That is as far as I've
> tested things.
>
> Would you like me to turn on debugging? And, if so, what should I be
> setting for debugging variables (d_*)?
>
> Andrew
>
>
> ____________________________________
> Andrew W. Donoho
> awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
> +1 (512) 453-6652 (o), +1 (512) 750-7596 (m)
>
>
>

Andrew W. Donoho
2004-02-21, 07:48
Dean,

With some more experimentation this morning, I found the following to
work:

mov mp3 squeezebox *
$faad$ -f 2 -w $FILE$ | $lame$ --silent -b $BITRATE$ -r -s 44.1
-m s - -

It does not suffer from the second track static problem. Also for you
wireless folks, it also uses less bandwidth.

Andrew

____________________________________
Andrew W. Donoho
awd (AT) DDG (DOT) com, PGP Key ID: 0x81D0F250
+1 (512) 453-6652 (o), +1 (512) 750-7596 (m)