Streaming audio from Ubuntu Linux to a DLNA player without Rygel

Recently, I became the proud owner of Onkyo TX-NR515 receiver. This device is DLNA MediaRenderer as upnp-inspector says. The A/V receiver is from the 2012 devices family (TX-NR414/TX-NR515/TX-NR616).

Streaming the sound from PC to my DLNA device over wlan was a tough task, but I managed to solve it the way I’ll describe below. The main idea is to pass the alsa/pulseaudio output stream over LAN to DLNA device. There are 2 ways of doing it: with DLNA server or without.

The rygel way worked on my Ubuntu 12.04 with 4-12 sec delay. I’m ok with such delay when listening to music. For video I used mplayer audio-video delay settings that easily allowed me to solve audio syncing problems. After upgrade to Ubuntu 12.10 the way with pulseaudio and rygel did not work for me.

The way I have it now: I pass the pulseaudio stream over HTTP, setup a ‘Favourite’ link on Onkyo receiver then play it. It works a lot more stable without DLNA server.

  • Get the name of your pulseaudio sink:
    pacmd list-sources | grep name
    
  • Start the HTTP streaming of pulseaudio sink (use your sink name from list-sources) with some transcoding (more on transcoding and streaming: http://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples)
    cvlc -vvv pulse://alsa_output.pci-0000_00_1b.0.analog-stereo.monitor --sout \
    '#transcode{acodec=mpga,ab=128,channels=2}:standard{access=http,dst=0.0.0.0:8080/pc.mp3}'
    
  • Test playing the stream on some PC within your LAN, then go to Onkyo’s web interface and save to Favourites the link to stream:
    http://your.ip:8080/pc.mp3
  • Via Onkyo interface go to Favourites and play the stream

Such solution is very stable for my network and transcoding config can be easily tweaked. Though it has some drawbacks: firstly, there’s still a delay (depends on transcoding settings). Secondly, VLC is a sledge-hammer to crack nuts. Using ffmpeg/avconv instead of VLC would be a better solution.

Tagged , , , , , , , , , , , , , , , . Bookmark the permalink.

14 Responses to Streaming audio from Ubuntu Linux to a DLNA player without Rygel

  1. RX A3010 says:

    I appreciate, lead to I found just what I used to be taking a look for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye

  2. Dawid Ciężarkiewicz says:
  3. Christian says:

    For some reasons my Onkyo refuses to play the stream.

    I use my raspberry pi for playing this stream.

    Thanks,
    Christian

  4. Heri Cahyono says:

    Thanks.

    This is the simplest method i can find 🙂

  5. Stefano Bolli says:

    Thank you. Your solution works fine with my Onkyo 3009

  6. wilks says:

    The cvlc route worked for me with a couple of Sonos Play:1, I just had to change the acodec from mpga to mp3 (that and install the Sonos desktop controller in VirtualBox simply to add the url to my radio list, I mean surely, it should be possible to do that from the phone app, right? Grrrr… )
    Anyways, thanks for your post, very useful stuff!

  7. Pingback: Ubuntu 13.10 on a Dell XPS 13 | In The Armchair

  8. keydon says:

    hey thanks, this works great with my ubuntu 13 laptop and my raspberry running openelec connected to my hifi. but i did not manage to mute my laptop without muting the output to the raspberry. how can i achieve that? Since there is a slight delay its kinda annoying hearing the music from both devices ;O

  9. pitjow says:

    Thanks dmitry for this very simple but clean solution! Three points to mention:

    1) I had first to unmute the output monitor.

    $ pacmd
    Welcome to PulseAudio! Use “help” for usage information.
    >>> set-source-mute alsa_output.pci-0000_00_1b.0.analog-stereo.monitor false
    >>> exit

    2) Second, as wilks discribes, I had to change the acodec from mpga to mp3 as well.

    3) Third, there is still the muting-problem keydon describes.

    • pitjow says:

      @keydon: Found the solution the muting-problem: Muting with the normal mute-button muetes the master of the alsa mixer. But we only want to muete the speakers of the laptop. So we can execute this command:

      amixer -c 0 set Speaker playback 0%

  10. Bert says:

    Hey. This seems the perfect solution for me, but I don’t get it working. 🙁

  11. Agge says:

    Hi.

    Looks like precisely the solution I am looking for, just a question what kind of delay do you get with this solution?

    • root says:

      When I tested this option in 2012 I had (0.5-1)s delay over Ethernet and (2-4)s over 802.11n. I don’t use this way at the moment because of constant PulseAudio problems: missing sinks, lost network connections, etc. I believe PA with Ubuntu are more stable now. I also didn’t have time to test it with my 802.11ac. As an alternative I use the UBT-1 dongle. With Chinese Dongles I get (900-1000)ms delay, and (50-100)ms with Nexus 4, Nexus 7 from Google and Plantronics BackBeat Go 2.

  12. mike says:

    Perfect solution.
    I get a 10 second delay via LAN streaming but can happily live with this.
    Many thanks for sharing this.

Leave a Reply

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