Icecast Scripts
Here's how we do our
streaming audio webcasts:
- From 2001 to early 2006:
- There was a Linux machine inside DNA Lounge with an audio
encoder card (a SoundBlaster Live.) This machine got an audio feed
directly from the club's sound system.
- Scripts on that machine read raw audio from the card, converted
it to MP3 in realtime, and sent a single 128k MP3 stream up a T1 to a
server machine.
Since 2006:
- The machine inside DNA Lounge is a Macintosh Mini, running
Nicecast.
Same basic idea, but with much more reliable hardware and software.
Also we're on plain-old DSL now instead of a T1.
- The server machine is a
some random PC running Linux,
sitting in our ISP's colocation facility (so it has lots of
outgoing bandwidth.)
- That machine runs
Icecast, which serves
that 128k stream to the outside world.
- However, we also used to offer the audio streams at
lower bitrates, for people who have less bandwidth available to them.
We don't do that any more, but the way that used to work is, there
were some scripts running on the server machine that would:
- listen to the 128k stream;
- decode it;
- re-encode it at a lower bitrate;
- send that re-encoded stream back to the server for transmission.
- Finally, you click on the link to the MP3 stream on
our Audio Webcast page, which
instructs your browser to launch your favorite MP3 player and
connect to the stream on our server.
Here are the shell scripts that make all that work. Please let me
know if you find this useful, or make any improvements...
ice-downcoder.pl
|
This is the script that listens to one
icecast stream, and then rebroadcasts it as another,
after changing the bitrate. It uses
LAME
to decode and then re-encode the MP3 data.
This is also the script that reads from the local
sound card, converts it to an on-the-fly MP3 stream,
and feeds that to an Icecast server.
|
shout-archive.pl
|
When the club is open we broadcast live
audio; but when the club is closed, we used to re-broadcast
audio from our archive of past live performances. We don't
do that any more, but this is the script that did it. This
script rolls through the directory of archived MP3 files
and feeds them to the icecast server one after another,
from oldest to newest. When it runs out, it wraps around
and does it again.
|
shout-randomly.pl
|
Loops, feeding a directory tree of MP3s to an
Icecast server, randomized. This is how "DNA Lounge Radio" works.
|