How to stream music with cmus
Summary
cmus
is a lightweight terminal-based music player that supports streaming from services like Shoutcast. By adding .m3u
or .pls
playlist links, you can stream music directly in cmus
. This article explains how it's done.
Configuring cmus
for streaming #
C* Music Player, (cmus
), supports streaming music from sources that provide playlist files in formats like M3U (MP3 URL) or PLS (Playlist). These files contain links to audio streams.
To enable streaming support, ensure that the required dependencies are installed. Most Linux distributions include them by default, but if you encounter issues, install ffmpeg
or libavcodec
packages.
Finding and adding a stream #
Visit a streaming service like Shoutcast or Icecast (find their directories in the sources section) and locate a station that provides an m3u
or pls
playlist link (usually linked to the “play” button).
Direct play #
If you want to listen to a stream immediately, do the following:
- Copy the link address of the
m3u
orpls
file. - Open
cmus
and enter command mode by pressing:
. Add the stream using:
add <stream_url>
Replace
<stream_url>
with the actual playlist link, e.g.::add http://yp.shoutcast.com/sbin/tunein-station.pls?id=1728296
.- Press
Enter
to load the stream into your library.
Saving the playlist #
If you want to save the stream files for later, do the following:
- Download the
m3u
orpls
file of your selected stream. - Open
cmus
and enter command mode by pressing:
. Add load the stream using:
load /Downloads/<stream_file>.pls
Replace
/Downloads/<stream_file>.pls
with the actual path to the playlist file, e.g.::load /Downloads/tunein-station.pls
.- Press
Enter
to load the stream.
Saving favorite streams #
Alternatively, to save your favorite streams for later, you can manually add them to your cmus
configuration file:
echo <stream_url> >> ~/.config/cmus/streams
Then, load the saved streams by using:
cat ~/.config/cmus/streams | xargs -I {} cmus-remote -q "add {}"
Playlist files #
This is an example of how playlist files (.pls
) usually look like:
[playlist]
numberofentries=6
File1=http://185.33.21.112:80/reggae_mobile_aac
Title1=1.FM - ReggaeTrade (www.1.fm)
Length1=-1
File2=http://185.33.21.112:80/reggae_64a
Title2=1.FM - ReggaeTrade (www.1.fm)
Length2=-1
File3=http://185.33.21.112:80/reggae_32a
Title3=1.FM - ReggaeTrade (www.1.fm)
Length3=-1
File4=http://185.33.21.112:80/reggae_128
Title4=1.FM - ReggaeTrade (www.1.fm)
Length4=-1
File5=http://185.33.21.112:80/reggae_64
Title5=1.FM - ReggaeTrade (www.1.fm)
Length5=-1
File6=http://185.33.21.112:80/reggae_mobile_mp3
Title6=1.FM - ReggaeTrade (www.1.fm)
Length6=-1
Version=2
Of course you can even edit playlist files to always use one or a limited set of the entries.
Playing and managing streams #
Once the stream is added/loaded in cmus
, you can start playing it by selecting it in the library and pressing Enter
. Use the following controls to manage playback:
c
to play or pauseb
to skip to the next trackx
to stop playbackv
to toggle shuffle modes
to sort the playlist
Also see how to create cmus
playlists.
FAQ's #
Most common questions and brief, easy-to-understand answers on the topic:
Can I stream music using cmus
?
Yes, cmus
supports streaming from services like Shoutcast or Icecast by adding .m3u
or .pls
playlist links.
How do I add a streaming URL to cmus
?
To add a stream, enter command mode by pressing :
and use:add <stream_url>
Replace <stream_url>
with the actual playlist link.
How can I save my favorite streams in cmus
?
You can save favorite streams by adding them to your configuration file:echo <stream_url> >> ~/.config/cmus/streams
Then load them with:cat ~/.config/cmus/streams | xargs -I {} cmus-remote -q "add {}"
Can I play a downloaded playlist file in cmus
?
Yes, to load a local .m3u
or .pls
file, enter command mode with :
and run:load /path/to/playlist.pls
Further readings #
Sources and recommended, further resources on the topic:
- Cmus cheat sheet
- Managing Cmus playlists
- Cmus documentation
- Shoutcast stream directory
- Icecast stream directory
License
How to stream music with cmus
by Jonas Jared Jacek is licensed under CC BY-SA 4.0.
This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/how-to-stream-music-with-cmus">How to stream music with cmus
</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>
For more information see the Ditig legal page.