Nuxified

FOSS technologies explained

  • Useful Articles
  • Blogs
  • Images
  • Tips
  • Archives

March 23, 2009

How to mirror an internet audio stream (using Icecast)

Sometimes you might run into an internet radio station or stream that you like, but which keeps dropping out because of too many people listening. So what can you do about it? You can create a mirror and post a link to it somewhere where listeners are watching or send it to the station or stream manager. Then some people can tune in to your mirror instead of the original stream reducing the load and increasing the stability of the stream for everyone.

So let’s see how to set this up. Ideally you would have a server online (VPS or dedicated), but this could be done at home too. I will cover a GNU/Linux set up with emphasis on Ubuntu or Debian since this is what most people are likely to be using. You will need to have a terminal open. If you use GNOME (Ubuntu’s default desktop environment) try gnome-terminal and if you’re using KDE (Kubuntu) try konsole.

1. Download and install Icecast2

Use your distribution’s package manager to install package “icecast2”. On Ubuntu or Debian you can run this in the terminal:

sudo apt-get install icecast2

On Fedora you can also use

yum install icecast2

yum install icecast2

2. Configure Icecast2

Open the configuration file /etc/icecast2/icecast.xml:

sudo nano /etc/icecast2/icecast.xml

sudo nano /etc/icecast2/icecast.xml

Go the the <authentication> section that should like this:

<authentication>
        <!-- Sources log in with username 'source' -->
        <source-password>hackme</source-password>
        <!-- Relays log in username 'relay' -->
        <relay-password>hackme</relay-password>

        <!-- Admin logs in with the username given below -->
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>

Change “hackme” into the passwords of your choice. You can use the same password for both sources log and the admin login. You can also change “admin” user name to something else.

Now scroll to the end of the file and just above the last closing tag add the following:

<relay>
  <server>xx.xx.xx.xx</server>
  <port>8000</port>
  <mount>/</mount>
  <local-mount>/mirror</local-mount>
</relay>

Replace xx.xx.xx.xx above with the address of the original stream you’re mirroring (don’t use http://) and also replace 8000 with the port of the original stream. Also replace “mirror” with the desired name of the mirror.

You can now save this file and edit /etc/default/icecast2:

sudo nano /etc/default/icecast2

sudo nano /etc/default/icecast2

Just modify the last line from ENABLE=false to ENABLE=true. Then save and start the Icecast server like this:

sudo /etc/init.d/icecast2 start

sudo /etc/init.d/icecast2 start

3. Log in to pick up your new mirror stream

Go to your mirror address (xx.xx.xx.xx:8000) and enter the admin username and password you set up in the authentication section above. You should then see the stream there, looking something like this:


Stream
You can click on the M3U or XSPF links to tune in. These are also the links you can publish for your stream. In case there are no these links (some servers might be using older Ubuntu or Debian packages of Icecast) you can just append the stream name to your address like this xx.xx.xx.xx:8000/streamname and use that as a link.

Note that if you are setting this up at home you need a public IP address of your computer which you can see here and you’ll need to set up port forwarding for the port of your mirror stream in your router. Consult the manual of your router for this. Of course, if your connection drops out your IP will change. To prevent that you can use a free Dynamic DNS service to get a permanent hostname. Modern routers should have a facility for setting this up with the Dynamic DNS service as well.

Here is my example stream mirror of an excellent ambient radio station called “Cryosleep”:http://memenode.com:8000/cryosleep.m3u

Have fun.

This tutorial is based on one available at Howtoforge which is about setting up an icecast radio station of your own rather than just mirroring.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Article by libervisco / Useful Articles

Learn Unix

I run Unix Tutorial website and help anyone interested to pick up Unix skills. If you have questions or just want to share your ideas – please join the Unix Tutorial on Facebook.

Tech Stack Solutions

Tech Stack Solutions is my company that provides Unix support. Sign up or simply get in touch to find out how I can help!

Search this Website

You May Also Like

Recent Posts

  • Advice on using SUDO
  • FFmpeg 4.0
  • KDE Plasma 5.9.0 Release
  • How to Install Ubuntu Linux without a DVD or USB
  • How to Securely Save All Your Passwords with Keepass
  • 9 Signs You Should Use Linux on Your Computer
  • The Easiest Way to Optimize Your MySQL Database Performance
  • Setting up a Linux Web Development Environment in Windows
  • Hunting Down Disk Space Hogs on Linux Command Line
  • 6 Simple Android Apps for Monitoring and Managing Your Linux Server

Archives

Categories

  • Community Blogs
  • Images and Screenshots
  • News
  • Technical Topics
  • Useful Articles

Basic Unix Commands

Basic Unix Commands
  • ls command
  • mkdir command
  • man command in unix
  • cd command - change directory
  • uname command

Advanced Unix Commands

Advanced Unix Commands
  • ln command - symlinks
  • tune2fs unix command - filesystem parameters
  • du command - disk usage
  • lsb_release command
  • find unix command

Unix Reference

Unix Reference
  • SSH port forwarding
  • unix commands
  • visudo tutorial
  • mtime unix
  • lrwxrwxrwx
  • Unix Tutorial digest

Unix Books

Unix Tutorials

Unix How-Tos
  • check raspbian version
  • autostart in KVM
  • List files in Ubuntu package
  • check CentOS version
  • create bootable USB in MacOS
  • Useful Articles
  • Blogs
  • Images
  • Tips
  • Archives

Copyright © 2021 · Education Pro Theme on Genesis Framework · WordPress · Log in