Ubuntu / Linux news and application reviews.

pulseaudio-dlna is a lightweight streaming server that makes it easy to stream audio from a Linux computer that uses PulseAudio, to a DLNA / UPnP or Chromecast device in the same network.

The tool discovers all UPnP / DLNA / Chromecast renderers in the network and adds them as sinks to PulseAudio. You can then either select the sinks from the sound settings, or use pavucontrol to control which applications can stream to the UPnP / DLNA or Chromecast device. 

Let's get started with installing and using pulseaudio-dlna.

For Ubuntu 16.04, 15.10 and 14.04, Linux Mint 17.x and derivatives, pulseaudio-dlna can be installed from a PPA. To add the PPA and install pluseaudio-dlna, use the following commands:
sudo add-apt-repository ppa:qos/pulseaudio-dlna
sudo apt-get update
sudo apt-get install pulseaudio-dlna

For how to install it in other Linux distributions, see the pulseaudio-dnla instructions.

Now, to run it, type the following in a terminal:
pulseaudio-dlna

On the other end, make sure the DLNA / UPnP or Chromecast device is powered on.

Next, open the system sound settings. In Ubuntu (Unity), from the Sound Menu, select Sound Settings and your DLNA / UPnP and/or Chromecast device should show up in the output list:


Select the device you want to stream to and... that's it (well, for DLNA / UPnP devices, you may need to accept the connection - a popup should be displayed on the device screen; Chromecast should start streaming immediately).

In my test under Ubuntu 16.04, the sound was perfect while using the default pulseaudio-dlna settings however, the sound was distorted when streaming to a Chromecast. To get it to work properly, I ran pulseaudio-dlna with mp3 as the codec and ffmpeg as the encoder backend:
pulseaudio-dlna --codec mp3 --encoder-backend=ffmpeg

Of course, this was the case for me, and it might not be needed in other cases. Update: pulseaudio-dlna was updated and mp3 is now prioritized over flac for Chromecasts.

Note: to be able to use ffmpeg as the encoder backend, you'll need to install it. It's available in the official Ubuntu 15.10 and 16.04 repositories (so to install it, use: "sudo apt-get install ffmpeg") however, it's not for Ubuntu 14.04.

For Ubuntu 14.04, you can search for a PPA that provides ffmpeg (use e.g. Y PPA Manager to search in Launchpad PPAs) - here's one that has ffmpeg backported from a newer Ubuntu version, but note that I didn't test it -, or install it from source.

pulseaudio-dlna allows changing the server port, force auto reconnect, set the cover mode (what's displayed on the DLNA / Chromecast device) and much more. To see all the available pulseaudio-dlna options, type:
pulseaudio-dlna --help

If you want to send single audio streams to the device, you can use pavucontrol. To install it in Ubuntu, use the following command:
sudo apt-get install pavucontrol

Then launch pavucontrol (it shows up as PulseAudio Volume Control in the menu / Dash) and on the Playback tab, change the stream to the DNLA / Chromecast device, only for the apps you want to use for streaming. As an example, here's Audacious set to stream to a Chromecast device:


For more information about pulseaudio-dlna, bug reports, etc., see its GitHub page.