4 Lab 1: Simple streaming with Icecast

Server

  1. Check if Icecast is running.

    # Windows:  
    # In the "Command Prompt", run:  
    tasklist # And check whether "icecast.exe" is running.  
     
    # Ubuntu:  
    service --status-all # And search for "icecast2"  
    # or:  
    cat /var/log/icecast2/error.log  
    # The file should exist  
     
    # Arch:  
    systemctl list-unit-files | grep icecast  
    # or:  
    sudo systemctl status icecast  
    # or:  
    cat /var/log/icecast/error.log  
    # The file should exist  
     
    # All Unixes:  
    sudo netstat -tulpn  
    # An entry labeled with "icecast" should appear  

  2. If not, install and execute the Icecast (master) server.

    # Windows:  
    # 1. Navigate to "http://icecast.org/download".  
    # 2. Click on the "Icecast for Windows" link and save the file.  
    # 3. Run the installer (this does not run the server).  
    # 4. Goto: "start" -> "All Programs" -> Icecast -> "Run Icecast (Console)"  
     
    # Ubuntu:  
    sudo apt-get update                   # Update the index of packages.  
    sudo apt-get install icecast2         # This runs the server. 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                       # Update the index of packages.  
    sudo pacman -S icecast                # Install the server  
    sudo systemctl start icecast          # Start the server  
    # or:  
    sudo icecast -b -c /etc/icecast.xml & # Start the server  
    sudo systemctl enable icecast         # Ensures service after re-start

  3. Now, check if the server is running by executing:

    # Windows:  
    # Run chrome or firefox and visit "http://localhost:8888".  
     
    # All unixes:  
    firefox http://localhost:8000 &  
    # or:  
    chrome http://localhost:8000 &  
    # or:  
    telnet localhost 8000  
    # If we can connect to the server, probably it is running and listening to port 8000.  
    # Push <Ctrl><Alt Gr><]> simultaneously, push <q> and next <Enter>.

  4. If something went wrong, try:

    # Windows:  
    # Kill (close the Console window) and re-run "Icecast (Console)".  
     
    # Ubuntu:  
    sudo service icecast2 stop                     # Stop the server  
    sudo service icecast2 start                    # Start the server  
    # or:  
    sudo icecast -b -c /etc/icecast2/icecast.xml & # Start the server  
    sudo update-rc.d icecast2 enable               # Ensures service after re-start  
     
    # Arch:  
    sudo systemctl stop icecast                    # Start the server  
    sudo systemctl start icecast                   # Start the server  
    # or:  
    sudo icecast -b -c /etc/icecast.xml &          # Start the server  
    sudo systemctl enable icecast                  # Ensures service after re-start

  5. “Tune” (as master server) the Icecast configuration file.

    # Windows:  
    # Goto: Start -> All Programs -> Icecast -> Icecast Config.  
     
    # 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>Lab UMH</location>.
    2. (Optional) Modify the adminstrator name defined in <admin>icemaster@localhost</admin> with <admin>icemaster@icecast.umh</admin>.
    3. (Optional) Modify the hostname name defined in <hostname>localhost</hostname> with <hostname>icecast.umh</admin>.
    4. Set a password for the source clients. Replace <source-password>hackme</source-password> with <source-password>1qaz</source-password>.
    5. Set a password for the relay clients. Replace <source-password>hackme</source-password> with <source-password>2wsx</source-password>.
    6. Set a password for the administrator (”admin”). Replace <admin-password>hackme</admin-password> with <admin-password>3edc</admin-password>.
  6. Remember to re-start Icecast after modifiying the configuration file.

    # Windows:  
    # Kill (close the Console window) and re-run "Icecast (Console)".  
     
    # Ubuntu:  
    sudo service icecast2 restart  
     
    # Arch:  
    sudo systemctl restart icecast

Using the webcam as source

  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

Using a file as a source

# All OS’s:  
# 1. Download the video from "https://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv".  
# 2. Download and install VLC Media Player from "http://www.videolan.org/vlc/index.html".  
# 3. Run "VLC media player" and select: Media -> Stream -> Add (Select the Big_Buck_Bunny_small.ogv file) -> Stream -> Next -> Change "File" by "Icecast" -> Add (Address: "localhost", Mount Point: "test.ogg", Login:pass: "source:1qaz" -> Next -> Change "Video - H.264 + MP3 (MP4)" by "Video - Theora + Vorbis (OGG)" (Transcoding is not necessary) -> Next -> Stream.  
# 4. Remember to stream forever.

Player

# All OSs:  
# Run a new instance of "VLC media Player" and select: Media -> Open Network Stream -> Enter the URL: "http://localhost:8000/test.ogg". Chrome also should work.  
 
# Unixes:  
firefox http://localhost:8000/test.ogg &  
# or:  
vlc http://localhost:8000/test.ogg &