How to setup a streaming multimedia server (internet radio station)

djemos

Dimitris Tzemos

Posted on August 10, 2019

How to setup a streaming multimedia server (internet radio station)

This is for slackel linux.
Same settings can be used in any linux distribution. You have to install icecast, mpd and gmpc (optional) in your linux distribution.

what is Icecast

Icecast is free server software for streaming multimedia. Icecast, is a program that streams audio data to listeners.

what is mpd

mpd is a music player daemon - a daemon for playing music

what is gmpc

Gnome Music Player Client (gmpc) is a gui front-end for mpd

Let begin:

  • Obtain a dns domain

"Obtain a DNS domain" and create one with a dynamic dns provider (e.g. https://www.noip.com )
Port forward tcp, udp port 8000 using your router interface
i hope you know how to do this. e.g. if your laptop has internal ip 192.168.2.4 for example you have to set router port forwarding 192.168.2.4 to 8000 port so users can reach you from outside to 192.168.2.4 internal ip

  • Getting and Installing icecast mpd and its gui front-end gmpc

     sudo slapt-get -u
     sudo slapt-get -i icecast mpd gmpc
    
  • Setting up icecast config file

Open file /etc/icecast.xml and change some settings:

<source-password>hackme</source-password> to whatever you like
<relay-password>hackme</relay-password> to whatever you like
<admin-user>admin</admin-user> to whatever you like
<admin-password>hackme</admin-password> to whatever you like
<shoutcast-mount>/live</shoutcast-mount> to whatever you like, if it is not set then default /stream will be used e.g. set it to live

<hostname>localhost</hostname> to your dynamic domain name e.g. mediaserver.noip.me

 <!-- add this if you want your station listing on icecast directory, so people all over the world can find you -->
 <directory>
    <yp-url-timeout>15</yp-url-timeout>
    <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    <public>1</public>
 </directory>
 <security>
  <chroot>0</chroot>
   <changeowner>
     <user>nobody</user>
     <group>nogroup</group>
   </changeowner>
  </security>  
Enter fullscreen mode Exit fullscreen mode

Save file /etc/icecast.xml

  • prepare your mp3 files directory

put your mp3 files under a directory e.g. ~/Desktop/mp3

  • create your .mpdconf
    run

     mpd-initial.sh
    

a file ~/.mpdconf will be created in your home directory

  • Edit this file and change it as follows

    music_directory     "~/Desktop/mp3"
    playlist_directory      "~/.mpd/playlists"
    log_file            "~/.mpd/log"
    pid_file            "~/.mpd/pid"
    state_file          "~/.mpd/state"
    bind_to_address "localhost"
    port                "6600"
    input {
        plugin "curl"
     }
    audio_output {
    type        "shout"
    encoding    "mp3"           # optional
    name        "Ariadni Greek Radio"
    host        "localhost"
    port        "8000"
    mount       "/live" # same as above in icecast.xml
    password    "hackme" # password_same_as icecast_server_password_above"
    bitrate     "128"
    format      "44100:16:2"
    description "Watever you like e.g Rock" # optional
    url  "http://mediaserver.noip.me"   # optional but same as above in icecast.xml
    genre   "your genre e.g. Greek"     # optional
    public  "yes"     # optional
    mixer_type    "software"  # optional
    }
    # Need this so that mpd still works if icecast is not running
    audio_output {
    type "alsa"
    name "fake out"
    driver "null"
    mixer_type      "software"
    }
    # Character Encoding
    # If file or directory names do not display correctly for your locale then you 
    # may need to modify this setting.
    #
    filesystem_charset "UTF-8"
    #
    # This setting controls the encoding that ID3v1 tags should be converted from.
    #
    id3v1_encoding  "ISO-8859-1"
    #
    
  • create a playlist

    find ~/Desktop/mp3/*.mp3 > ~/.mpd/playlists/myplaylist.m3u
    
  • run icecast and mpd

    sudo icecast -c /etc/icecast.xml -b
    mpd ~/.mpdconf
    
  • run gmpc from menus and stop or play the songs you like.
    check "Repeat mode" and "Random mode" under Control menu

tip:
can create a file ~/icecast.sh including the lines

    sudo icecast -c /etc/icecast.xml -b
    mpd ~/.mpdconf
Enter fullscreen mode Exit fullscreen mode

and run it to not have to type again every time want to run your media server. Just type

    sh ~/icecast.sh
Enter fullscreen mode Exit fullscreen mode

You and your listeners can listen to your internet radio by typing in a browser or vlc or clementine or smplayer the url
http://mediaserver.noip.me:8000/live

In slackel.gr site the ariadni radio http://ariadni.noip.me:8000/live has been set up as above and streaming from my laptop.

💖 💪 🙅 🚩
djemos
Dimitris Tzemos

Posted on August 10, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related