Internet radio with mpd + ncmpcpp / Mplayer (and Bonus)

This would be my first post of the year and it's not a big deal ... just a tip from those who like to listen to radio through the internet, if you are a user of mpdIt is one of the best ways to use the streaming service of many stations without having to start more programs except the same mpd daemon, which works wonderfully (and because it is more geek than using VLC or similar xD).

There are several formats for streaming audio over the network, but the most common are .pls y .m3u, if the radio you want to listen to distributes m3u files, congratulations! You just have to copy them to your directory .playlists according to your mpd configuration.

For files pls you have to do an extra action. As an example we will try a station that I really like, WFMU, an independent radio station in New Jersey, on their page we find the .pls format, which I have downloaded and its content is like this:

> cat wfmu.pls numberofentries = 1 Title1 = WFMU - Freeform File1 = http: //stream0.wfmu.org/freeform-128k

The important line is the direction http, which we copy and save in a text file with the extension .m3u e our directory of playlists from mpd and voila!

…… the post is a bit short, right ?, well, how filling a bonus !!!

Using Mplayer

We can listen to streaming easily with mplayer and the files .m3u :

mplayer -playlist.m3u file

with the files .pls we will change its extension to .txt , and then we execute:

mplayer -playlist file.txt

and ready! we are listening to radio via internet with the wonderful mplayer!

If for some reason you want to record the streaming to, for example, listen to it later, we can use this command:

mplayer -playlist mi_stream.m3u -ao pcm: file = mi_stream.wav -vc dummy -vo null

We won't hear anything but the audio will be saved in my_stream.wav which would be the final audio file that we could later convert to mp3 ú ogg or the format of our liking.

mp3 (we need paralytic installed)

lick my_stream.wav my_stream.mp3

ogg (we need vorbis-tools installed)

oggenc -q 10 my_stream.wav

And so this little post ends, I hope it is useful and greetings to all the loyal readers of the blog. We read later!


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Stif said

    Sooo good!

    I am always listening to electronic radios

  2.   diegoelsurfer said

    Look, a friend programmed this -> https://github.com/quijot/radio

    It is a very simple python script to listen to the radio with mplayer.

    1.    helena_ryuu said

      I had already seen it, I wanted to use mpd directly: D, even so the script can also be a good option,

  3.   giskard said

    I stay with RadioTray.

    1.    David said

      we are 2

  4.   altobelli said

    One question: If streaming is only offered through jwplayer, could you do something to listen to it with mplayer? As in this station: emisora.univalle.edu.co.

    1.    Antonio said

      Have you managed to play the jwplayer radio on an android? I can't find an application to listen to it.

    2.    switcher said

      Since JWplayer is just a player and the webmaster is the one who tells it where the streaming is to be obtained from, it is something that depends a lot on each particular site, although in the case of that page, the transmission is done through the RTMP protocol, for which you first have to install RTMPDump (with sudo apt-get install rtmpdump or find the corresponding package for each distribution) and then you can play the radio with the following command
      rtmpdump -r rtmp://livezone02.netdna.com/live/64880/uvstereo.mp3 | mplayer -
      In case the link stops working, then just check the source code of the page where JWplayer is (Control + U) and look for what file says: 'rtmp: //path/del/streaming.mp3' to get the current direction of the streaming (obviously you just have to take what is in quotes).
      To do the same in other players, it would be necessary to find out how to reproduce RTMP with that program.

  5.   fabianpa said

    very good post is one of the programs that consumes less resources to reproduce and record, I used moc and ffmpeg

  6.   wada said

    Uhh! great Helena 😀 a good tip I will write down

  7.   msx said

    @helena_ryu I am your fan, know it.

    There is only one thing that I do not entirely agree with what you wrote:
    "That works wonderfully (and because it is more geek than using VLC or similar xD)."
    In my case the console rulez for a simple matter:
    1. Convenience, it is easy to use.
    2. lightness: uses minimal and essential resources.
    Although it is true that you can use VLC, Amarok, Clementine or whatever application you want to listen to streaming online, the resource consumption is not even close to that of mpd / mplayer from a tmux console.
    Good post!

    1.    Helena said

      haha thanks (I'm becoming a celebrity?) hahaha well, I was saying it as a joke about the VLC (I have to improve my sense of humor) anyway, I also think that the best in many cases are terminal-oriented applications , in addition to being light, they are more agile and perform better than graphic applications, but not everyone shares that criterion, this post is nothing more because I wanted to listen to the radio but did not want to install anything else, and as you say, the mpd is not compared none!

      1.    Helena said

        and again excuse the windoze flag…. I'm not on my pc -__-

        1.    taregon said

          It happens to all of us = p

  8.   taregon said

    Excellent! I like the concept 😀

  9.   kuk said

    what I was looking for!! 🙂

  10.   moony said

    … .Ehhh, excuse me but with vlc it's the same and it also comes out cheap, I say because they barde my vlc and everything rots!

    $cvlc http://el.fuking.ip.delrario:puerto

    ((((- music—-))))