Actions

Ezstream on linux

From The RadioReference Wiki

Revision as of 19:40, 24 April 2011 by Jaded (talk | contribs) (Created page with "This page is under construction! Some notes on using ezstream under Linux to feed a live stream to radioreference.com Prereqs: * [http://www.icecast.org/ezstream.php ezstream] ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is under construction!

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

Prereqs:


I used Centos 4.8 (minimal install),

  1. Ezstream needs to be fed an already 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. Create these files. Edit the ezstream.xml file to include your mount point and password.

/etc/ezstream.xml:

<ezstream>
    <url>http://audio6.radioreference.com:80/XXXXXXXXX</url>
    <sourcepassword>XXXXXXXXX</sourcepassword>
    <format>MP3</format>
    <filename>stdin</filename>
    <svrinfoname>STREAM NAME</svrinfoname>
    <svrinfourl>http://www.radioreference.com</svrinfourl>
    <svrinfogenre>Scanner</svrinfogenre>
    <svrinfodescription>SHORT DESCRIPTION</svrinfodescription>
    <svrinfobitrate>16</svrinfobitrate>
    <svrinfochannels>1</svrinfochannels>
    <svrinfosamplerate>22050</svrinfosamplerate>
    <svrinfopublic>1</svrinfopublic>
</ezstream>


/usr/local/bin/startstream:

/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 --lowpass 4 - - 2> /tmp/startstream.status | /usr/local/bin/ezstream -qvc /etc/ezstream.xml


/usr/local/bin/screenstream:

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


/usr/local/bin/checkstream

#!/bin/sh

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
else
        echo "Checked ezstream at `date`" > /tmp/status.checkstream
fi

Use "crontab -e" to add the checkstream script to your crontab, to be run once a minute. I don't start anything in rc.local or another startup location, but you might want to if that feels smoother to you.

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