Actions

Ezstream on linux

From The RadioReference Wiki

Revision as of 14:52, 25 April 2011 by W9RXR (talk | contribs)

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), LAME 3.98.4, Sox 12.17.5, Ezstream 0.5.6.

  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. 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.
  4. 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.


/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