amuck-landowner

Online Radio

jcaleb

New Member
Hello,

This is what I do when I want to play a list of songs (ogg format) and stream it to a client.

Install icecast2 which is the audio streaming server

apt-get install icecast2You may want to change the default configuration. I recommend to change: port, source-password, relay-password, admin-password. The port is just for obscurity.
Code:
pico /etc/icecast2/icecast.xml
Install ices2. This is the program that will read your music files and supply it to icecast for streaming.
Code:
apt-get install ices2
I like to create a user where to store music files. It's up to you if you wish to store somewhere else.
Code:
adduser oggfiles
Then put some music into it
Code:
wget http://upload.wikimedia.org/wikipedia/en/0/04/Rayman_2_music_sample.ogg -O /home/oggfiles/sample1.ogg
Code:
wget http://upload.wikimedia.org/wikipedia/en/0/06/Elliott_Smith_-_Son_of_Sam_(sample).ogg -O /home/oggfiles/sample2.ogg
Create your playlist file
Code:
pico /home/oggfiles/playlist.txt
and put the following
Code:
/home/oggfiles/sample1.ogg
/home/oggfiles/sample2.ogg
create the playlist xml, that you will feed to ices2. this xml will point to the txt file above.
Code:
pico /home/oggfiles/playlist.xml
and put the following
Code:
<?xml version="1.0"?>
<ices>
    <background>1</background>
    <logpath>/var/logs</logpath>
    <logfile>ices.log</logfile>
    <loglevel>4</loglevel>
    <consolelog>0</consolelog>
    <stream>
        <metadata>
            <name>Jon's Amazing Music</name>
            <genre>Pop</genre>
            <description>Playlist of Jon's favorite Britney Spears music.</description>
        </metadata>
        <input>
            <module>playlist</module>
            <param name="type">basic</param>
            <param name="file">/home/oggfiles/playlist.txt</param>
            <param name="random">0</param>
            <param name="restart-after-reread">1</param>
            <param name="once">0</param>
        </input>
        <instance>
            <hostname>localhost</hostname>
            <port>ICECAST_PORT_YOU_SET_ABOVE</port>
            <password>ICECAST_SOURCE_PASSWORD_YOU_SET_ABOVE</password>
            <mount>/jon.ogg</mount>
            <reconnectdelay>2</reconnectdelay>
            <reconnectattempts>5</reconnectattempts>
            <maxqueuelength>80</maxqueuelength>
            <encode>
                <nominal-bitrate>64000</nominal-bitrate>
                <samplerate>44100</samplerate>
                <channels>2</channels>
            </encode>
        </instance>
        </stream>
</ices>
Then create an ices2 daemon (please correct me if this is wrong term. I just mean the one where you can issue later "service ices2 start" or "service ices2 stop").
Code:
pico /etc/init.d/ices2
Ant put the following contents
Code:
#!/bin/bash

start() {
        echo "Starting ices2: "
        su - oggfiles -c "ices2 /home/oggfiles/playlist.xml"
        echo "done."
}
stop() {
        echo "Shutting down ices2: "
        kill -9 \`pidof ices2\`
        echo "done."
}
 
case "\$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 30
        start
        ;;
  *)
        echo "Usage: \$0 {start|stop|restart}"
esac
exit 0
And issue the following commands to do some magic. I'm not sure what they are for, but you need them.
Code:
sudo chmod 755 /etc/init.d/ices2
sudo update-rc.d ices2 defaults
Now you can run it
Code:
service icecast2 start
service ices2 start
Now paste to your browser the url and enjoy the music:http://ip:port/jon.ogg
 
Last edited by a moderator:

drmike

100% Tier-1 Gogent
Welcome @jacaleb!

Thanks for the tutorial.  This is one I'll be looking at long into the future.

Have you wrote up the changes for doing this with mp3 and ices?  Is it just a literal replacement of the programs and file extensions?
 

yomero

New Member
I have some ideas for this...

A question. if you change the playlist file, the server recognizes the changes on the fly? Or how it behaves?
 

jcaleb

New Member
Hi @buffalooed i guess the two are same, they just read different types of music file. I really dont know why they do it like this.
 

365Networks

New Member
Great guide, right to the point. Has anyone heard of using 'ezs' instead of 'ices' or 'ices2'? (ices-cc isn't a bad one either but doesn't play OGG)? I know it supports Icecast and it supports MP3 AND OGG...which is always nice.

2V6zR.png
 

jcaleb

New Member
what is ezs? is it opensource? I have tried a bloated one before, i forgot the name. one with gui and everything

edit: found it, its airtime!
 
Last edited by a moderator:

acd

New Member
For a quick and dirty implementation, ices/ices2 are sufficient, but if you really want to set up streaming, you should look into mpd (music player daemon, playlist support, manual queueing etc), liquidsoap (a very flexible audio programming framework), or one of the many linux radio automation packages (like airtime, though I've never tried these).
 

drmike

100% Tier-1 Gogent
Hi @buffalooed i guess the two are same, they just read different types of music file. I really dont know why they do it like this.
They do it so they don't have to pay the mp3 licensing extortion.  Early versions did mp3, then they pulled it and ogg (opensource codec) became what they supported.

Shoutcast has similar mp3 licensing thing.  Requires that $5(?) key purchase for broadcasters.   Unsure if that is fully compliant/legal per their contract or what.

I hate the paid software mess over codecs.
 

365Networks

New Member
Yes it is $5 one time fee so you can play MP3 based music with your AutoDJ SHOUTcast setup, this only applies to sc_trans v2, I do not believe it applies to sc_trans v1. I may be wrong though, I prefer ices-cc, sadly it does not with SHOUTcast DNASv2 yet.
 

signius

New Member
I run an icecast stream with ezstream backend, only thing i would say about ezstream is some of the syntax is totally ass about face & works the opposite way to what the wording on the config would suggest.

If you want a more heavy duty backend with many more options then take a look at liquidsoap i plan on migrating my stream to this for some of the options if offers http://savonet.sourceforge.net/doc-svn/quick_start.html

But for a simple backend to icecast i have found ezstream rock solid & i been running it for about 3 years.
 
Top
amuck-landowner