Listening to SHOUTcast Streams with mpg123 under Linux

It seems like it should be easy to do things with Linux, since a very motivated and competent group of people create, maintain and extend it, but sometimes it is just not obvious how to use Linux to attain a specific goal.

For example: Many years ago I wrote a script (Bourne shell script) to play MP3's - and Radio Station streams. I had discovered trplayer - a program intended to enable blind computer users to access Real Media content - and I used it for years to play music from my favorite radio stations with the script.

Gradually, however, the stations began to "disappear." They were not really gone, they had switched streaming protocols! Many of then switched to SHOUTcast and trplayer is not able to play that protocol. So I went without.

Finally, in September of 2006, I had had enough. I spent a few hours on Google searching for the magic combination of keywords to discover how SHOUTcast streams could be played from the command line in Linux. And finally, in a single forum post, I found the answer: mpg123

mpg123 is a relatively simple program that has many, many audio capabilities. It specifically has the one I wanted: I can play SHOUTcast steams from the command line now, and I am able to hear online music from around the world. Fantastic! And don't think mpg123 is an exotic program that has been recently introduced. It was on my SuSE 7.2 system (SuSE is now up to version 10.1) and it worked. I just had no idea that it would - until I read that one magic post.

Here are some sample command lines I am using to listen through a modem:

mpg123 -C -b 4096 http://scfire-ntc0l-2.stream.aol.com:80/stream/1020
mpg123 -C -b 4096 -@ "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=445103&file=filename.pls"
mpg123 -C -b 4096 http://212.23.5.99:8004

And where did I get the names of the streams? In a web browser I simply "right clicked" on the "Tune In" icon in the SHOUTcast database, and copied the location. If the location is a "*.pls" file, it's a playlist, and the "-@" syntax seen above is required.

Good luck! Happy listening!


Back To: [ David Butcher's Personal Page ]
This page is hosted by The WEBworks * Copyright 2006, All Rights Reserved