icecast streaming with ezstream

MegaXLR edited this page Oct 8, 2016 · 3 revisions

For all you Internet radio fans, here's a fun one: broadcasting the album.

First, you'll need a server running icecast2. I won't go into the details of configuring it, as there is such nice documentation online.

Let's assume for the time being:

  • you're running it on port 8000 of on your local network
  • you have your router properly configured to allow external traffic in to that port on that machine (e.g. with port forwarding)
  • you have some pointer on the web to it, say a dynamic dns like freedns or a page of the netcat website like
  • the name of your stream will be netcat
  • you are pointing to
  • you have the netcat kernel module compiled and inserted

Given that you can handle the server setup and netcat install, you need to install ezstream which, at least on Debian-based OSes is:

$ sudo apt-get update && sudo apt-get -y install ezstream

Next, you'll need a config file, let's say ~/netcat.xml:

    <stream_once>1</stream_once> <!-- must do for stdin -->
<!-- the rest are optional -->
    <svrinfodescription>nevermind the CD/DVDs, here's kernel modules!</svrinfodescription>
    <!-- the following taken from mplayer. not sure if it's right -->

Next, broadcast:

$ ezstream -c ~/netcat.xml < /dev/netcat

Now the whole world can hear you, e.g.:

$ mplayer -cache 2000 -playlist

NOTE: This isn't complete if you like to mix up the ogg and the mp3 (officially not supported by xiph, but listeners often don't do well with ogg, especially if running Windoze). To deal with that:

You'll need to add some software:

$ sudo apt-get update && sudo apt-get -y install madplay lame

Add this to your to your ~/netcat.xml:

        <decode>madplay -b 16 -R 44100 -S -o raw:- "@T@"</decode>
        <encode>lame --preset cbr 128 -r -s 44.1 --bitwidth 16 - -</encode>
        <decode>oggdec -R -b 16 -e 0 -s 1 -o - "@T@"</decode>
        <encode>oggenc -r -B 16 -C 2 -R 44100 --raw-endianness 0 -q 1.5 -t "@M@" -</encode>
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.