Wednesday, July 31, 2019

How to stream Internet radio stations to your media-system via DLNA with Rygel on Ubuntu 18

My Yamaha RX-V473 recently stopped playing internet radio stations. Yamaha worked with vtuner for this but the vtuner people recently stopped their free service. The Yamaha update to fix this is only for their younger products so the RX-V473 has no new firmware or fix. Yamaha has no clue yet  about Open Source and the many benefits of Open Source so no one will ever be able to fix the problem changing the firmware.

Streaming files from the NAS

The Yamaha RX-V473 has the possibility to access DLNA servers and I had it hooked up to an Ubuntu 18.04.2 LTS with Rygel installed ( sudo apt install rygel ) and media sharing in Ubuntu Settings set to ON.

Rygel options in Ubuntu Settings

Playing your own MP3 files collection is working and easy but I want to listen to SomaFM on my stereo and this option is not (yet) present in the Sharing section of Ubuntu Settings.

Internet radio

To stream SomaFM over DLNA (Rygel) to your DLNA client (Yamaha receiver or any other player) you need to install rygel-gst-launch. Type in terminal:

 sudo apt install rygel-gst-launch

Next: edit rygel.conf. Not just any rygel.conf but the one in /home/$Username$/.config/rygel.conf. (Where $Username$ is your username.)

Go to the section [GstLaunch] and edit the changes as seen below.

I have added the complete relevant section of a working version here.


[GstLaunch]
enabled=true
launch-items=audiotestsrc;soma;drone

audiotestsrc-title=Audiotestsrc

audiotestsrc-mime=audio/x-wav
audiotestsrc-launch=audiotestsrc ! wavenc

soma-title=SomaFM SpaceStation

soma-mime=audio/mp4
soma-launch=souphttpsrc iradio-mode=false location=http://ice2.somafm.com/spacestation-128-aac

drone-title=SomaFM Dronezone

drone-mime=audio/mpeg
drone-launch=souphttpsrc iradio-mode=false location=http://ice2.somafm.com/dronezone-256-mp3


Now when the receiver or any other DLNA compatible client is going to search for DLNA servers under the server button it will see the media share from Rygel and GstLaunch.
Select GstLaunch and 3 radio stations appear:

  Audiotestsrc will produce a test tone for testing.
  SomaFM SpaceStation will play SomaFM Spacestation in 128 bit AAC
  and SomaFM Dronezone will play SomaFM Dronezone in 256 bit MP3

You can add as many internet radio stations as you want.
  • To check if the URL of the stream is working open VLC and go to Media  and then  Networkstream and enter the URL. If VLC starts producing music the URL is correct.
  • Every time you change rygel.conf you need to restart Rygel for the changes to take effect. Restart Rygel in the standard Ubuntu Settings with the Media sharing ON/OFF button.
  • Sometimes the client (The TV, stereo or any mediaplayer) needs to be reset to see changes in the Rygel configuration.
  • To check for error messages stop Rygel with the standard Ubuntu Settings and start Rygel in terminal using the command: 
rygel
        If there are any errors they will be displayed in the terminal. 
  • To install all Gstreamer plugins type in terminal:
sudo apt install gstreamer1.0-*

  • AAC streams have the mime type audio/mp4. MP3 streams have the mime type audio/mpeg.
  • There is no cover art with this setup.
  • Some players accept pls and m3u streams and others do not. I am still trying to figure out why here they do not play.
  • As from SomaFM FAQ "The 128k AAC streams are the best sounding. The 64k AAC-HE streams are a close second, followed by 128k MP3 streams." I do not know where 256 MP3 fits in but my guess is they are the best.
  • Another way of streaming radio to your Yamaha is with a fake vtuner website as I described here.