55

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 .

Raja G
  • 102,391
  • 106
  • 255
  • 328

10 Answers10

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
penreturns
  • 5,950
  • 1
    Awesome man , may i have list of good radios ? – Raja G Sep 27 '12 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 http://ipmusic.rad.io/ – penreturns Sep 27 '12 at 16:54
  • Defcon Hacker Radio: http://sfstream1.somafm.com:6200/ – Jordan Arsenault Sep 25 '13 at 22:49
  • @penreturns Is it possible to play the radio and record it at the same time? – Sigur Nov 20 '14 at 16:00
  • 1
    @Sigur : I've never try this before but you can have a look at this : http://askubuntu.com/questions/291910/how-to-capture-desktop-sounds-pulse-audio-output-from-avconv – penreturns Nov 21 '14 at 01:18
  • Usually xatworld and radiopecs intern. work, but not now. There is a server error. Any alternatives? The links by moewe are neither working with mplayer. My upload bandwith is only 0,01 Mbit/s, maybe this is the cause. Error by Radio Pecs: ICY-Server return 'Service Forbidden' No stream found to handle url http://80.237.154.83:8120 – Timo Mar 10 '15 at 08:04
  • 1
    works for 16.04, too. – kmonsoor Feb 24 '17 at 09:33
  • Radio Pecs is not working anymore. – Timo Jun 15 '20 at 17:17
  • 1
    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 '20 at 09:20
  • @aderchox same failure here. – Timo Sep 01 '20 at 10:22
25

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

Serge Stroobandt
  • 5,268
  • 1
  • 48
  • 59
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>".

moewe
  • 529
  • 3
  • 8
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.

Minda
  • 99
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".

January
  • 35,952
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.

Pablo Bianchi
  • 15,657
shin
  • 593
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.

Severo Raz
  • 5,971
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.

Niarfe
  • 11
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...

  • @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?" –  Jul 22 '18 at 16:20
  • @DavidFoerster - can't you remove your delete vote? –  Jul 22 '18 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
hc_dev
  • 229