54

I am using Ubuntu 12.04.

While seeing around here i have gone through this But it didnt seems to be work with me . Here is my trail .

raja@badfox:~$ mplayer www.live365.com
MPlayer svn r34540 (Ubuntu), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing www.live365.com.
File not found: 'www.live365.com'
Failed to open www.live365.com.


Exiting... (End of file)

Its looks like some background work needed .

10 Answers 10

45

mplayer

Try this.

mplayer http://80.237.154.83:8120

The IP-address of an online radio station can be found over at Xat radio search.

My result :

enter image description here

mplayer in IPv4 networks

If your router only works with IPv4, you will need to add the option -prefer-ipv4. More recent mplayer versions require this.

mplayer -prefer-ipv4 http://80.237.154.83:8120
10
  • 1
    Awesome man , may i have list of good radios ?
    – Raja G
    Sep 27, 2012 at 16:46
  • I donno man. I like english slow rock, oldies 80's 90's. Dont have idea whit yours ;) Btw try look at this site ipmusic.rad.io
    – penreturns
    Sep 27, 2012 at 16:54
  • 1
    @Sigur : I've never try this before but you can have a look at this : askubuntu.com/questions/291910/…
    – penreturns
    Nov 21, 2014 at 1:18
  • 1
    works for 16.04, too.
    – kmonsoor
    Feb 24, 2017 at 9:33
  • 1
    MPlayer 1.1-4.8 (C) 2000-2012 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing http://-----.net:80/live. Resolving ------.net for AF_INET... Connecting to server -----.net[---.---.---.---]: 80... Resolving -----.net for AF_INET... Connecting to server -----.net[---.---.---.---]: 80... Cache size set to 320 KBytes Cache fill: 8.74% (28631 bytes) libavformat version 54.20.4 (external) Mismatching header version 54.20.3
    – aderchox
    Aug 23, 2020 at 9:20
24

Using VLC from the command line

As usual, VLC does it all. Use cvlc to run VLC on the command line.

cvlc http://80.237.154.83:8120
cvlc us.darkmatter.aac.48k.m3u 

VLC can also be invoked with a ncurses interface, as follows:

$ nvlc http://provisioning.streamtheworld.com/pls/CKFRAM.pls

or

$ vlc -I curses http://provisioning.streamtheworld.com/pls/CKFRAM.pls

Hit the H key for the much needed help.

Here is a screenshot of nvlc with a music playlist:

nvlc

mplayer in IPv4 networks

If your router only works with IPv4, you will need to add the option -prefer-ipv4. More recent mplayer versions require this.

mplayer -prefer-ipv4 http://80.237.154.83:8120

See below to read how to use mplayer with .m3u and .pls streams.

cmus also opens .m3u and .pls streams

Unlike mplayer, cmus also knows to open .m3u and .pls streams. This means less digging or "background work" to extract the stream URL from those files.

Furthermore, cmus looks nice and offers several views, a file browser and many configuration settings. cmus is available from the standard Ubuntu repositories. To get up to speed with cmus, first read the tutorial by typing the following command:

$ man cmus-tutorial

cmus

Open .m3u and .pls streams anyhow with mplayer

If you do not like cmus, or it is unavailable, mplayer can be made to do the same. For that purpose, I wrote the following mplay script:

#!/usr/bin/env bash
URL=$(grep -m 1 --null http "$1" |sed s/^.*http/http/ |tr -d '\r')
mplayer -prefer-ipv4 "$URL"

To navigate between directories of .m3u and .pls files, one could use the CLI file browser ranger, configured to call the above script for these file types. The struggle of setting this up pays itself back by being the fastest access method. This is what I personally use in a daily setting.

ranger

pyradio

Here is a nice write-up describing pyradio

Note that pyradio can also be installed and found as follows:

$ pip3 install pyradio
$ sudo find / -iname pyradio
$ ~/.local/bin/pyradio

moc

Then there is also moc. MOC (music on console) is a full-screen ncurses based console audio player.

MOC

Select a file from some directory using a menu similar to Midnight Commander, and MOC will start playing all files in this directory beginning from the chosen file. There is no need to create any playlists, even though MOC handles these as well.

mp3blaster

More details about yet another CLI music player, mp3blaster can be found here

$ sudo apt install mp3blaster

mp3blaster

4
  • 1
    cmus worked great for me. I just had to do :add [your stream link] once in the interface.
    – james-see
    Aug 21, 2016 at 3:22
  • VLC's ncurses interface can display an object tree; presss (x).
    – noobninja
    Jan 4, 2020 at 15:12
  • Listening to radio, this works so far, but nothing else: vlc -I curses http://provisioning.streamtheworld.com/pls/CKFRAM.pls
    – Timo
    Sep 1, 2020 at 10:31
  • mp3blaster and moc are not for radio which is the topic here.
    – Timo
    Sep 1, 2020 at 10:31
8

There is indeed some "background work" to be done.

First of all, you will need to get hold of a URL that points to a real stream and not just a site that offers internet radio listening. This is probably the hardest part. You can search the station's website or google if there are any streams for that particular station. The stream URL is not the URL of a player on the station's website.

A URL might look like this: http://bbc.co.uk/radio/listen/live/r1.asx (BBC Radio 1) or http://www.bbc.co.uk/radio/listen/live/r1_aaclca.pls (BBC Radio 1, but a different URL) or http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop5.m3u (N-Joy); it will (very likely) not look like www.live365.com.

All of the above may be played back easily using mplayer -playlist "<your url>", if that does not work with your stream, you can try mplayer "<your url>".

1
  • yeah seems like this is the hidden tricky
    – Raja G
    Sep 27, 2012 at 17:20
6

You can try moc. MOC (music on console) is a console audio player for LINUX/UNIX designed to be powerful and easy to use.

1
  • 2
    Can you give an example with a url?
    – Timo
    Jul 1, 2018 at 20:44
5

First, if you do not include "http://", then mplayer will try to open a file called "www.live365.com".

mplayer http://www.live365.com

This, however, will fail as well, since http://www.live365.com is not an address of a stream that mplayer could play, but of a web page. With a flash player.

Short answer -- open the website in firefox or another browser and click on "play".

3
  • 1
    Thanks man but its not worked pastebin.com/x2jE3RQB
    – Raja G
    Sep 27, 2012 at 16:46
  • 3
    Yes. I wrote "This, however, will fail as well". mplayer can read audio and video streams, not web pages -- see the answer above.
    – January
    Sep 27, 2012 at 16:48
  • Yes January :p , you said true . i read half only .
    – Raja G
    Sep 27, 2012 at 16:49
3

Tera

I'm the author of Tera, an interactive terminal music radio player.

  • 27780+ radio stations powered by Radio Browser API.
  • MPV, a free, open-source, and cross-platform media player.
  • CRUD favorite lists.
  • Play from a list
  • Search radio station by tag, name, language, country code, state.
  • Save a station to a list after playing.
  • Delete a radio station from a list.
  • I feel lucky menu.
  • Gist upload.

Installation

Either you clone the repo, use HomeBrew, install via deb package, or you can use Awesome package manager.

Usage

After installing Tera, you just need to run tera to run the program.

screenshot

screenshot

You can find more details here. Other options here.

1

I had the same problem. What I've done to get access to streams via command line is use the 'view source' to get the url of the stream.

For example, http://www.francebleu.fr/player opens in a browser and has buttons to play and stop etc. Then I right-click and select 'view source' and another page opens. I searched for mp3, (or you can search for "http://"), somewhere in there you'll find the link that is actually being used. In the example here, it turned out to be sort of hidden...

{"mp3":"http://mp3.live.tv-radio.com/fbidf/all/fbidfhautdebit.mp3"}

But from that I got the link by removing the forward slashes. Thus finally, from the command line I execute "mplayer http://mp3.live.tv-radio.com/fbidf/all/fbidfhautdebit.mp3" and mplayer can process that stream.

Hope that helps.

1

Today I as looking for the same thing as the OP, and found an option I cannot believe is not listed here. If you're interested in a music player server which can run on the background and receive commands from any of many compatible clients, you could be interested in

mpd

With an incredibly generic name, Music Player Daemon (mpd) is a server (so it runs in the background) that takes commands from client applications like the analogously named mpc. Both mpd and mpc are exclusively command line applications, but if you like a little GUI to go with your CLI, you can use clients for mpd such as Ario.

Personally, I host an instance of MPD on a Raspberry Pi on my LAN, I connect a speaker to it, and I can SSH into it to control my music or use a client like Ario from my PC to control it (also remotely).

I only discovered this today so pardon if this answer lacks depth. The Arch Wiki page I linked will do a much better job than me in answering your questions about mpd though.

0

www.live365.com is not the correct address of the radio stream, it is just an website address.

www.live365.com doesn't provide such addresses, radios there are meant to be played in the internet browser.

There are different ways to get the proper radio stream address. - Some radios stations list them themselves - like FIP.

But once you have chosen your preferred radio you need to get its streaming address. How to do that cannot be answered but on a per-case basis. There are websites that list radio stations and provide their streaming address, sometimes as a playlist file, for example http://www.listenlive.eu/. The playlist file contains links to the actual stream. More info here.

(I am trying to get more info in terminal on the playing song - so I have posted this.)


Mpv also works, as a replacement of mplayer.

In terminal:

mpv http://etcetcetc...

2
  • @DavidFoerster - I guess the proper title of the above question is ""How to get the correct radio stream address in order to play it in terminal with mplayer?"
    – user47206
    Jul 22, 2018 at 16:20
  • @DavidFoerster - can't you remove your delete vote?
    – user47206
    Jul 22, 2018 at 16:39
0

mpv

mpv is a video player based on MPlayer/mplayer2.

Installation

apt-get install mpv

(tested on Ubuntu 20.04)

Usage

See the manpage and play a webradio stream like:

mpv https://www.ndr.de/resources/metadaten/audio/aac/ndrblue.m3u

It shows icy/shoutcast headers like (artist and title):

Playing: https://www.ndr.de/resources/metadaten/audio/aac/ndrblue.m3u
 (+) Audio --aid=1 (aac 2ch 48000Hz)
AO: [coreaudio] 48000Hz stereo 2ch floatp
A: 00:00:01 / 00:00:12 (16%) Cache: 10s/197KB
File tags:
 icy-title: Matt Simons - In Case You Missed It
A: 00:00:51 / 00:01:02 (82%) Cache: 10s/211KB

Not the answer you're looking for? Browse other questions tagged or ask your own question.