Difference between revisions of "Ezstream on linux"
From The RadioReference Wiki
(Only significant change is to the lame command line params, reflecting that Radioreference prefers a 22050Hz sample rate for its streams) |
|||
Line 25: | Line 25: | ||
<format>MP3</format> | <format>MP3</format> | ||
<filename>stdin</filename> | <filename>stdin</filename> | ||
− | <svrinfoname>STREAM NAME</svrinfoname> | + | <svrinfoname>INSERT OFFICIAL STREAM NAME HERE</svrinfoname> |
<svrinfourl>http://www.radioreference.com</svrinfourl> | <svrinfourl>http://www.radioreference.com</svrinfourl> | ||
<svrinfogenre>Scanner</svrinfogenre> | <svrinfogenre>Scanner</svrinfogenre> | ||
Line 38: | Line 38: | ||
/usr/local/bin/startstream: | /usr/local/bin/startstream: | ||
/usr/bin/sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | \ | /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/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 | /usr/local/bin/ezstream -qvc /etc/ezstream.xml | ||
Line 64: | Line 64: | ||
− | Use "crontab -e" to add the checkstream script to your crontab | + | 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 | */1 * * * * /usr/local/bin/checkstream | ||
[[Category:Live Audio Broadcasting]] | [[Category:Live Audio Broadcasting]] |
Revision as of 15:31, 11 June 2011
This page is under construction!
Some notes on using ezstream under Linux to feed a live stream to radioreference.com
Prereqs:
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.
- Ezstream needs to be fed an encoded stream, which can be accomplished with LAME.
- 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).
- 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.
- 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.
- 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>INSERT OFFICIAL STREAM NAME HERE</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 --cbr --resample 22.050 --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. 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