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.
Install ices2. This is the program that will read your music files and supply it to icecast for streaming.
I like to create a user where to store music files. It's up to you if you wish to store somewhere else.
Then put some music into it
Create your playlist file
and put the following
create the playlist xml, that you will feed to ices2. this xml will point to the txt file above.
and put the following
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").
Ant put the following contents
And issue the following commands to do some magic. I'm not sure what they are for, but you need them.
Now you can run it
Now paste to your browser the url and enjoy the music:http://iport/jon.ogg
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
Code:
apt-get install ices2
Code:
adduser oggfiles
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
Code:
pico /home/oggfiles/playlist.txt
Code:
/home/oggfiles/sample1.ogg
/home/oggfiles/sample2.ogg
Code:
pico /home/oggfiles/playlist.xml
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>
Code:
pico /etc/init.d/ices2
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
Code:
sudo chmod 755 /etc/init.d/ices2
sudo update-rc.d ices2 defaults
Code:
service icecast2 start
service ices2 start
Last edited by a moderator: