How to stream audio over Chromecast or DLNA on Linux

ubuntu nice logo

Pulseudio-dlna on a thin streaming client that used to easily broadcast audio from a Linux computer using PulseAudio to other DLNA / UPnP or Chromecast devices on the same network.

Through this utility we can discover all the devices UPnP, DLNA or Chromecast that are able to reproduce the content within our network and link them with PulseAudio. In this way, you can select your audio sources or use pavucontrol to establish what to stream to that device.

Let's start with install pulseaudio-dlna application. On Ubuntu versions 16.04, 15.10 and 14.04, Linux Mint 17.x and its derivatives, pulseaudio-dlna can be installed from a PPA. To add it, we will only have to execute the following commands from the terminal:

sudo add-apt-repository ppa:qos/pulseaudio-dlna
sudo apt-get update
sudo apt-get install pulseaudio-dlna

If we have any other distribution, many tutorials are available online that we can follow, such as this. Next, we will execute the following command in the terminal:

pulseaudio-dlna

Once launched, we will make sure that the DLNA / UPnP or Chromecast device is turned on. The next step we must do is open the sound options from its menu and select our device as output element.

chromecast image

We will choose the device we want to stream to and we will be done. If you have chosen a DLNA / UPnP device know that you may have to accept the connection through a pop-up window that may appear to you. Chromecast, however, should start playing immediately.

In tests carried out under Ubuntu 16.04, the sound sent through pulseaudio-dlna has been satisfactory, however, in the case of Chromecast it was distorted on some occasions. To make it work properly we must set the ffmpeg codec as decoder de backend in pulseaudio-dlna using the following command:

pulseaudio-dlna --codec mp3 --encoder-backend=ffmpeg

If you are using the latest version of pulseaudio-dlna, you will know that it has been updated and flac codec is now prioritized for playback via Chromecast. In order to use it, you must first install it on your system with the following command:

sudo apt-get install ffmpeg

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.   Camilo said

    Is it possible to stream audio on Apple TV from Ubuntu?

    1.    Miguel Angel Santamaría Rogado said

      Hello camilo,

      It depends on the device, if it is old and uses AirPlay it should work (you may have to install the "pulseaudio-module-raop" package); if it is rather recent and uses AirPlay 2 I am sorry to say that you will have to stick with it quite a bit. If it is possible to make the Apple TV communicate using the DLNA protocol, you will have a better chance of making it work using the utility that Luis presents; I have used it together with a Raspberry running Volumio and it works perfectly.

      If you prefer to choose to use Air Play 2 (or the Apple TV does not support anything else) I leave you the link to the pulseaudio-raop2 project (https://hfujita.github.io/pulseaudio-raop2/) and this link to askubuntu (http://askubuntu.com/questions/544251/airplay-sink-no-longer-visible-in-pulseaudio) where they explain the problem in more detail.

      Greetings.

  2.   Aeneas Espinoza said

    Hello! Can I see the files with the subtitles in .srt format? Thanks!