Streaming internet radio on a Raspberry Pi

Streaming Internet Radio on a Raspberry Pi

Internet radio stations can be streamed on a Raspberry Pi using simple terminal commands and Mplayer. This post shows what is required and how.

Introduction to streaming internet radio on a Raspberry Pi

Internet radio stations can be streamed on a Raspberry Pi and the Raspberry Pi OS (formerly known as Raspbian). The terminal or Bash scripts will be used for the streaming commands. PuTTY can also be used.

This post will be using Radio Sonder Grense (RSG), as an example, but other radio stations can also be used. A few additional radio stations are also mentioned.

Mplayer will be used to play internet radio. While some media players may need PLS or M3U files, Raspbian’s Mplayer will need ‘direct stream links’ (a link to the actual streaming server) or ASX files (advance stream director files which store playlists).

Using PLS, ASX or M3U links is apparently the best, as these links are usually permanent and will not change. Direct stream links can vary based on individual server availability. The most up to date link will be required.

Streaming internet radio on a Raspberry Pi

Assumptions and requirements

A fully set up Raspberry Pi running the latest update of the Raspberry Pi OS (Raspbian) connected to the internet via Wi-Fi or an Ethernet cable. A keyboard and screen output or PuTTY can be used. Audible audio output to speakers or via HDMI is required.

The streaming services of RSG and Antfarm Internet Radio will be used, but similar radio station streaming services can be used.

Audio player software

For this project, we will be using MPlayer to stream internet radio on the Raspberry Pi. MPlayer is a free, open-source video and audio player for all major operating systems. It can play various file formats including .mp3 and audio streams.

The Raspberry Pi OS might not come with MPlayer pre-installed. The following apt-get terminal command can be used to install mplayer:

sudo apt-get install mplayer

Out of the box, MPlayer will work just fine for audio streaming. It works simply by using mplayer in the command line. Output can be tested by the following command:

mplayer /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav

This tells MPlayer to play the pathed .wav file through your default audio hardware settings. Like with some other ALSA-friendly audio players, the audio hardware can also be set by using the following:

mplayer -ao alsa:device=hw=0,0 /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav


mplayer -ao alsa:device=default /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav

On the RSG home page, the following links are available under different devices:

From this list, one can see that there are two direct stream links (.mp3 & .stream) and one ASX file. The .mp3 link worked for me. To use a stream link:



mplayer -ao alsa:device=hw=0,0;listen.mp3

to work with an ALSA device.

While the stream is playing, the p keyboard key can be used to pause, m to mute and q to quit the stream playback.

MPlayer can also be stopped externally from a logged-in device by using the sudo pkill -f mplayer terminal command.


MPlayer also has a nice playlist function. This post won’t go into any detail, but it might be needed if the normal commands do not work. MPlayer’s -playlist flag needs to be used for ASX files. If the playlist flag is used, the address becomes quoted:

mplayer -playlist ""

Although I personally could not get it to work, it seems like playlisting is also needed for ASP links — maybe you come across other internet radio links that might need it.

Other known radio station links



or see for their updated list.

Radio Landsberg International


or see for their website.

Classic FM

mplayer -playlist ""

or see for their website.


This post showed how to stream audio on a Raspberry Pi using Mplayer and terminal commands.

Please share your favourite radio station’s streaming address in the comment section below.



Addition: mplayer does seem to have problems with some streams. I found out you can also use VLC without GUI / interface by using cvlc so in the case of the above it would be something like:


Advantages? Playing tends to start quicker than mplayer and more formats of streams seem to be supported. Reminder: If you start a stream using SSH the stream stops if you break the SSH-connection so use VNC to start a stream then close VNC and it keeps playing fine. Again thanks for the idea / tips


I have been looking for this solution for a while to make an old Raspi-2B into a radiostream-player and it WORKS! Thank you so much for your explanation.

Renier Delport

At the time I wrote this post I had to personally email them for the latest URLs. If you do, please share them here =)


Antfarm no longer seems to support RSG. Any new ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *