Using MPlayer (or any player) to listen to online radio.

welinton-paulista

New Member
Credits
80
Hello. I do intent to use MPlayer (or any other player if Mplayer shows troubles) to listen to online radio. I read somewhere that you have to locate the audio file in the webpage's source code, however I was not able to do so. The I am currently using this webpage to listen to the online radio: http://streema.com/radios/play/Transamerica_Pop. I could not locate anything that resembles a audio stream on it.

The oficial website of the radio station it is: http://www.radiotransamerica.com.br/play/sao-paulo. Again, I could not locate anything in the page's source code.
 


JasKinasis

Well-Known Member
Credits
4,341
you need URL with .m3u or .pls, if I'm not mistaken.
Not necessarily - very often in a web-based player the source will just be a http://, or https:// url for the live stream.

Hello. I do intent to use MPlayer (or any other player if Mplayer shows troubles) to listen to online radio. I read somewhere that you have to locate the audio file in the webpage's source code, however I was not able to do so. The I am currently using this webpage to listen to the online radio: http://streema.com/radios/play/Transamerica_Pop. I could not locate anything that resembles a audio stream on it.

The oficial website of the radio station it is: http://www.radiotransamerica.com.br/play/sao-paulo. Again, I could not locate anything in the page's source code.
From looking at the page-source for the first link you've posted, the url for the live-stream is:
http://transamerica.crossradio.com.br:9100/stream/;

Open that URL up in any media player and it should just start streaming!
Works for me in VLC and cmus. It should also work in mplayer.

The image below shows the URL for the stream in the page's source code:
StreamURL.png


Simple!
 

welinton-paulista

New Member
Credits
80
Thanks for all the answers. I was able to locate the stream with the help. Unfortunately it did not work with Mplayer, but I will send a message to Mplayer's mailing list with Mplayer's messages and hopefully someone there will know some trick for it. Thanks
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
7,673
G'day @welinton-paulista and welcome to linux.org :)

Can you tell me what Linux Distro you are using, including version and desktop environment?

Cheers

Chris Turner
wizardfromoz
 

welinton-paulista

New Member
Credits
80
Damn! No answer from Mplayer mailing list. However, I believe the reason it did not work, was because I did not activated anything when compiling it. Will try again, reading what configure tells me this time!

Thanks for the link Darry. WizardyFromMoss, I installed from source, so I do not think the distro has importance in this case.

***EDITED***: Tried again, and once more, it did not work. Both Mplayer versions says the same:

Code:
MPlayer 1.3.0-4.4.3 (C) 2000-2016 MPlayer Team

Playing https://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/.
libavformat version 57.25.100 (internal)
https protocol not found, recompile FFmpeg with openssl, gnutls,
or securetransport enabled.
Failed to open https://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/.


Exiting... (End of file)
I compiled and installed Openssl, however I never do it in the System standard directories. I had create symbolic links to two of the its libraries on /usr/local/lib. It was enough to Wget, but not for Mplayer, likely because I did not create links to the header files, simply because there are too many of them. I would use something like PKG_CONFIG_PATH or something specific to openssl, but apparently Mplayer does not define anything like that on its configure file. Only thing it does define is a "--extra-cflags=", however when I set it, configure does not find the standard c libraries in
Code:
Checking for working compiler ...
 
Last edited:

JasKinasis

Well-Known Member
Credits
4,341
Thanks for all the answers. I was able to locate the stream with the help. Unfortunately it did not work with Mplayer, but I will send a message to Mplayer's mailing list with Mplayer's messages and hopefully someone there will know some trick for it. Thanks
Thats very unusual!
mplayer can definitely play simple audio streams. I've used it in the past to stream TV programs, live-streams and streaming internet radio.

mplayer can even connect to streams on the BBC's iplayer website.

To make sure, I'm not going crazy - I've just tried the command:
Code:
mplayer http://transamerica.crossradio.com.br:9100/stream/
And it works flawlessly for me.

Proof in the screenshot below:
2020-09-11@15-55-25_1366x768.png


NOTE: The stream only works on http, it fails if you try https.

As per my previous post - you could perhaps try using a different media player, like VLC or cmus.
They can definitely play the radio stream.

Otherwise, I'm running Debian 10 Stable. So perhaps installing Debian might be a consideration? The version of mplayer on Debian works flawlessly with streaming audio and video.
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
7,673
NOTE: The stream only works on http, it fails if you try https.
I do not know if this assists in troubleshooting, as this is not my area of expertise (do I have one?).

I installed mplayer on LM 19.3 Tricia Xfce, same version as the OP's.

Ran the same command as him, same, negative result.

Then reissued using http instead of https and got the following:

Code:
[email protected]:~$ mplayer http://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/
MPlayer 1.3.0 (Debian), built with gcc-7 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/.
Resolving linux.org for AF_INET6...
Connecting to server linux.org[2606:4700:3031::681b:a6db]: 80...

connect error: Network is unreachable
Resolving linux.org for AF_INET...
Connecting to server linux.org[172.67.153.210]: 80...

Unsupported http 301 redirect to https protocol
STREAM_ASF, URL: http://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/
Resolving linux.org for AF_INET6...
Connecting to server linux.org[2606:4700:3031::681b:a6db]: 80...

connect error: Network is unreachable
Resolving linux.org for AF_INET...
Connecting to server linux.org[172.67.153.210]: 80...

Server returned 301:Moved Permanently
Failed to parse header.
Failed, exiting.
Resolving linux.org for AF_INET6...
Connecting to server linux.org[2606:4700:3031::681b:a6db]: 80...

connect error: Network is unreachable
Resolving linux.org for AF_INET...
Connecting to server linux.org[172.67.153.210]: 80...

Unsupported http 301 redirect to https protocol
No stream found to handle url http://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/


Exiting... (End of file)
HTH and cheers

Chris Turner
wizardfromoz

Avagudweegend
 

JasKinasis

Well-Known Member
Credits
4,341
Chris, that’s because the link you used in your command was incorrect....
You used this:
Bash:
http://linux.org/view-source%3Ahttp%3A//transamerica.crossradio.com.br:9100/stream/
AFAIK Linux.org doesn’t have an Internet radio stream!!

The correct link is:
Bash:
http://transamerica.crossradio.com.br:9100/stream/
Again, the http link above works.
I was just informing the op that it doesn’t work if you try connecting using https. Because https isn’t set up on the server that is broadcasting the stream. But it works over plain http, as per the link I posted!
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
7,673
Sorry Jas, I worded that badly.

I took the command you issued and did it with https (did not work, as expected) and then with http (as per you) and it worked fine, bopping away to music :)

I then took the command the OP used and tried it with and without the "s" secure feature.

With https I got the same as him.

With http, I got a negative result also, but as described in the code limiters above.

Better?

On my 4th coffee for my Saturday morning so starting to get more human now (maybe not so good for a Wizard? ;))

Chris
 


Staff online

Members online


Top