7 Lab 1: Simple streaming with Icecast

Server

  1. Check if Icecast is avaiable.
     
    # Ubuntu  
    service --status-all  
     
    # Arch  
    systemctl list-unit-files | grep icecast

  2. If not, install the Icecast (master) server.
     
    # Ubuntu  
    sudo apt-get update # Optional  
    sudo apt-get install icecast2  
    # Probably, a configurator will ask you for configuring Icecast2.  
    # Say "<No>." We will configure the server after, modifiying the configuration file.  
     
    # Arch  
    sudo pacman -Sy # Optional  
    sudo pacman -S icecast

  3. Test if the server is running by executing:
     
    firefox http://localhost:8000 &

    Try also:

    # Ubuntu  
    service --status-all  
    # Search an entry labeled "icecast2"  
     
    # Arch  
    sudo systemctl status icecast

    Also works:

    # Ubuntu  
    sudo netstat -tulpn | grep icecast  
     
    # Arch  
    sudo ss -tulpn | grep icecast  
     
    # An entry labeled with "icecast" should appear

    One more thing:

    telnet localhost 8000  
    # If we can connect to the server, probably it is running and listening to port 8000.  
    # Push <Ctrl><Alt Gr><]> simultaneously, then push <q> and next <Enter>.

    Finally, check the log file:

    # Ubuntu  
    cat /var/log/icecast2/error.log  
    # The file should exist  
     
    # Arch  
    cat /var/log/icecast/error.log  
    # The file should exist

  4. If not, try:
     
    # Ubuntu  
    sudo service icecast2 start  
    sudo update-rc.d icecast2 enable # Ensures service after re-start  
     
    # Arch  
    sudo systemctl start icecast  
    sudo systemctl enable icecast    # Ensures service after re-start

    or (only if the previous commands fail):

    # Ubuntu  
    sudo icecast -b -c /etc/icecast2/icecast.xml &  
     
    # Arch  
    sudo icecast -b -c /etc/icecast.xml &

    Notice that these commands are ephemeral.

  5. As root, “tune” the Icecast configuration file.
     
    # Ubuntu  
    sudo apt-get install joe  
    sudo joe /etc/icecast2/icecast.xml  
     
    # Arch  
    sudo pacman -S joe  
    sudo joe /etc/icecast.xml

    1. (Optional) Change the location of the server defined in <location>Earth</location> with <location>Hacklab Ejido</location>.
    2. (Optional) Modify the adminstrator name defined in <admin>icemaster@localhost</admin> with <admin>icemaster@hacklab</admin>.
    3. Set a password for the source clients. Replace <source-password>hackme</source-password> with <source-password>1qaz</source-password>.
    4. Set a password for the relay clients. Replace <source-password>hackme</source-password> with <source-password>2wsx</source-password>.
    5. Set a password for the server administrator (”admin”). Replace <admin-password>hackme</admin-password> with <admin-password>3edc</admin-password>.
  6. Remember to re-start Icecast after a modification of the configuration file.
     
    # Ubuntu  
    sudo service icecast2 restart  
     
    # Arch  
    sudo systemctl restart icecast

Source (Webcam)

  1. Download the Bash script:
     
    wget https://raw.githubusercontent.com/Sistemas-Multimedia/live-streaming/master/Source_scripts/Live_media/Linux/VLC/theora-vorbis.sh

  2. Run it (with default parameters):
     
    source theora-vorbis.sh

Player

firefox http://localhost:8000/test.ogg &  
 
# Also should work:  
vlc http://localhost:8000/test.ogg &