[Icecast] Ezstream and AAC+ ?

Geoff Shang Geoff at QuiteLikely.com
Thu Sep 20 10:36:18 UTC 2007


Peter Whisker wrote:

> I'm trying to make comparisons between live streams of OGG and AACplus at
> different bitrates. The only way I've found of streaming AAC+ so far from
> Linux is by running Winamp under wine and sending this to my Icecast2
> server. This sort of works, but is hardly optimal!
>
> Ezstream is my preferred way of doing this (hopefully using the Linux
> neroAacEnc coder) but there is no support as yet in the distributed version
> of ezstream. Has anyone managed to get anywhere in putting AAC+ (MPEG2
> container I guess) support into ezstream?

The beauty of Ezstream is that it shouldn't require built-in support for 
these sorts of things.  It uses external encoders and decoders to get the 
job done, which in theory should mean that it can support anything.

I'd not heard of this encoder, so took a look at it.  You'll need to do a 
few things to get it to work, but it should be able to.

first, Ezstream reads and writes data in raw PCM format.  The docs don't 
seem to say which format though.  I'm going to assume 44.1kHz 16-bit stereo 
for these examples.  You might also have issues with byte order, if you 
hear loud static then you'll need to swap it somewhere.

since neroAacEnc seems to only support reading in wav file formatted audio, 
we need to convert it on the way in.  sox can do this nicely.

sox -t raw -r 44100 -c 2 -s -w - -t wav -

We can write this in a slightly simpler way:

sox -t sw -r 44100 -c 1 - -t wav -

Then we can pipe it into neroAacEnc.  NeroAacEnc can be told to take audio 
from standard input, though curiously it can't be told to send it to 
standard output (we'll have to do that via /dev/stdout).

sox -t sw -r 44100 -c 2 - -t wav - |neroAacEnc <options> -ignorelength -if - -of /dev/stdout

As I mentioned, if you hear loud static then you'll need to swap the byte 
order.  This is done by using the -x option to sox on the input side.

You need to use -ignorelength because raw PCM data carries no length info 
so sox won't be able to supply a meaningful value for the length field in 
the wav header.

NOw you have the line for including in the encode section of your encdec 
stanza.  Decoding is a similar process - we'll need to decode to wav then 
convert to raw PCM.  But we won't need to specify sample rate or channels 
as these will be included in the wav header.  If you need to swap the byte 
order, it goes on the output side of the sox command.

I can't provide an exact line as the readme only provides usage for the 
encoder and the built-in help doesn't seem to work, at least for me.

Then all you need to do is create a stanza like the ones in the sample 
config, telling ezstream how to encode and decode your format.

The only reservation I have about all this is that the impression I get is 
that the audio will be in an MP4 container.  Is this what you want?  I'm 
not real up on all this new MPEG stuff so am not sure what the implications 
are of this.

Since you can plug in any kind of encoder/decoder, I'de thought that you'd 
be able to use something from the faac project.

> Of course Ezstream works great
> with OGG, but I'm not so happy with the OGG quality at q=-2 compared to AAC+
> at 32kbps as far as I've got in my tests so far. Music is not too bad but
> voice seems pretty rough and rings and echoes a lot. I'm using
> oggenc-aoTuVb5 with ezstream, however Winamp has only got aoTuVb4.

I've not tried it in a while, but have you tried downsampling to 32kHz?  It 
may improve things with little noticeable difference.



More information about the Icecast mailing list