Ezstream on linux

From The RadioReference Wiki

Some notes on using ezstream under Linux to feed a live stream to


Newbies, please note: Ezstream, LAME, etc., have prerequisites of their own. If in doubt, unpack the archives you downloaded and read the README or INSTALL files. You'll also need to make sure you have a compiler installed. Easy way to do that under CentOS: yum groupinstall 'Development Tools'

I initially used CentOS 4.8 (minimal install), LAME 3.98.4, Sox 12.17.5, Ezstream 0.5.6. I ended up moving to CentOS 5.6, installing Sox from yum, and compiled LAME and Ezstream manually.

  1. Ezstream needs to be fed an encoded stream, which can be accomplished with LAME.
  2. I used sox to take in a feed from /dev/dsp. There might be better ways to do this, but this one worked, and doesn't seem to waste significant cycles (<=1% CPU on a 800MHz C3 CPU).
  3. You might need to use something like alsamixer (yum users, it's part of alsa-utils) to make sure the hardware mixer is set to the appropriate input.
  4. I use screen to run the encoding operation in the background, yet give me the ability to resume that terminal and check out the (albeit minimal) stats from ezstream.
  5. Below are the config files and hastily written scripts I use to get the show going and keep it going. Edit the ezstream.xml file to include your mount point and password.


    <svrinfoname>INSERT OFFICIAL STREAM NAME HERE</svrinfoname>
    <svrinfodescription>SHORT DESCRIPTION</svrinfodescription>


/usr/bin/sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | \
/usr/local/bin/lame -r -a -m mono -b 16 --cbr --resample 22.050 --lowpass 4 - - 2> /tmp/startstream.status | \
/usr/local/bin/ezstream -qvc /etc/ezstream.xml


screen -d -m /usr/local/bin/startstream
echo "Screenstream started startstream at `date`" > /tmp/status.screenstream



if ([ "$(/sbin/pidof ezstream)" = "" ]) || \
([ "$(/sbin/pidof lame)" = "" ]) || \
([ "$(/sbin/pidof sox)" = "" ]); then
        killall ezstream > /dev/null 2>&1
        killall lame > /dev/null 2>&1
        killall sox > /dev/null 2>&1
        /usr/local/bin/screenstream > /dev/null 2>&1
        mail -s "[ezstream] Something fishy, restarting..." \
        ALERT@YOUREMAIL.COM < /dev/null > /dev/null
        echo "Checked ezstream at `date`" > /tmp/status.checkstream

Use "crontab -e" to add the checkstream script to your crontab. I don't start anything in rc.local or another startup location, but with cron running checkstream once a minute, the script will run within a minute of crond starting up at boot.

*/1 * * * * /usr/local/bin/checkstream