[Icecast] ezstream question

Geoff Shang geoff at QuiteLikely.com
Wed Feb 10 09:44:19 UTC 2016


On Tue, 9 Feb 2016, Larry Turnbull wrote:

> One of the streams is an old time radio stream and I use ezstream to run the
> prerecorded shows.
>
> Is there a package or some sort of way I can apply dynamic compression to
> the stream?

Ezstream really isn't designed for this.  It's primarily meant for 
streaming files as they are, which is a very light-weight operation, with 
the ability to reencode for the case where files aren't at the same 
bitrate/format.

Having said this, if you run it in reencode mode, it should be possible to 
pipe through a compressor like's sox's compand effect on the way to the 
encoder.

If you're running in reencode mode, you should have something like this 
example from the documentation in your config file:

         <encdec>
             <!--
                Support for MP3 decoding via madplay, and encoding via 
LAME:
              -->
             <format>MP3</format>
             <match>.mp3</match>
             <!-- Note: madplay uses host byte order for raw samples. -->
             <decode>madplay -b 16 -R 44100 -S -o raw:- "@T@"</decode>
             <encode>lame --preset cbr 128 -r -s 44.1 --bitwidth 16 - 
-</encode>
         </encdec>

You could change the encode line to read something like this:

<encode>sox -t raw -r 44100 -c 2 -b 16 -e signed - -t raw - compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 |lame --preset cbr 128 -r -s 44.1 --bitwidth 16 -</encdec>

Or the shorter version:

<encode>sox -t raw -r44.1k -c2 -b16 -e signed - -t raw - compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 |lame -r -</encdec>

For the shorter version, 128 kbps CBR is default MP3 output format, and 
raw input defaults to 44.1kHz 16-bit stereo signed, so can be omitted if 
you want to use these values but must be specified if you want something 
else.

If you hear loud static instead of the expected audio, you'll need to use 
the -x switch with either sox or lame, depending on which one isn't 
getting the bit order it expects.

Note that I just grabbed this compand example from the sox manpage, you 
may want to tweek it to get the sound you want.  I tried it on what I 
believe to be the stream in question and it did seem to make a difference 
without it being obvious, so maybe it will work nicely as is.

You will need to install the sox and libsox-fmt-mp3 packages, or at least 
that's what they're called in Debian.

finally, if you're not actually using reencode mode at the moment, this 
will consume significantly more CPU than your current setup.

It's never occured to me to do this, I'd be interested to know how well it 
works.

HTH,
Geoff.




More information about the Icecast mailing list