Saturday, March 25, 2017

configure streaming media server using icecast2

1- install necessary packages
$ sudo apt-get install icecast2 dir2ogg oggfwd

2- the icecast2 config file /etc/icecast2/icecast.xml should look like below

        <!-- Sources log in with username 'source' -->
        <!-- Relays log in with username 'relay' -->

        <!-- Admin logs in with the username given below -->


    <!-- You may have multiple <listener> elements -->
        <!-- <bind-address></bind-address> -->
        <!-- <shoutcast-mount>/stream</shoutcast-mount> -->

        <header name="Access-Control-Allow-Origin" value="*" />


        <!-- basedir is only used if chroot is enabled -->


        <alias source="/" destination="/status.xsl"/>


        <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
        <logsize>10000</logsize> <!-- Max size of a logfile -->


with above configuration, we have administrator user is admin, password hackme, and password hackme to add mount point

3- restart icecast2 service
$ sudo /etc/init.d/icecast2 restart

4- for example you have a mp3 or more mp3 files in a directory call mp3, so to stream it we have to convert it to ogg format, so use the following command to convert all the file to ogg format
$ dir2ogg -d mp3

5- now we can use oggfwd to add the stream mount point with the following command
$  cat mp3/el-perdon.ogg | oggfwd localhost 8000 hackme /stream.ogg

6- after that we can see it in the mount point menu of icecast2 web admin interface

to play it we can access with browser such as firefox

or use below command to open with vlc
$ vlc

No comments:

Post a Comment