Pulse audio It is a streaming server that allows the audio streaming from a Linux computer to be transmitted to Chromecast or DLNA/UPNP devices on the same network via PulseAudio.
This article describes how to install and obtain pulseaudio-dlna to transfer audio from Ubuntu 20.10, Pop_OS! 20.10, and other Linux distributions based on this Ubuntu version, and used in Chromecast devices.
The latest pulseaudio-dlna version uses Python 2, which is no longer available in many Linux distributions, which means it can no longer be used in modern Linux distributions. However, you can use a Python 3 branch, but it still cannot be maintained after a while, and there are some problems, for example, it is not compatible with the latest pychromecast 7. * (this is a feature of Ubuntu 20.10 repository).
Ubuntu 20.10 (and Linux distributions based on it, such as Pop!_OS 20.10) do include pulseaudio-dlna in the repository, but this package does not work properly, at least not on Chromecast devices (I can’t do it on DLNA devices) Test-it might apply to those). And because Ubuntu 20.10 has pychromecast 7 in the repository, if you want to use the Python 3 branch, this will make things a little more complicated.
But I can use it, this article explains how to make pulseaudio-dlna on Ubuntu 20.10/Pop with Chromecast device! _OS 20.10 works (it should also work with DLNA devices, but like I said, I haven’t tried it).
It is worth noting that there is no pulseaudio-dlna in the repository of Ubuntu 20.04, and using the same Python 3 branch will not work on this Ubuntu version.
Also, I did not add instructions for other Linux distributions, because this does not seem to work in a virtual machine (even if it is on the same network), so it cannot be tested correctly.There are third-party software packages Fedora with Arch Linux (Use the same Python 3 branch and patch as in the instructions below), so if you use these Linux distributions, you can try these packages.
You might like articles related to Chromecast:
- Transfer videos, music and pictures from Gnome to Chromecast and cast to TV extension
- How to use Cast to TV to cast GNOME Shell desktop to Chromecast (with audio, Wayland/X11 support)
- Command line Chromecast Player CATT
How to in Ubuntu 20.10 / Pop! Install Python3 pulseaudio-dlna (patched) branch on _OS 20.10
1. Install pulseaudio-dlna Python 3 dependencies (minus pychromecast, in the steps):
sudo apt install python3-setuptools python3-pip python3-docopt python3-chardet python3-gi python3-dbus python3-docopt python3-requests python3-setproctitle python3-protobuf python3-lxml python3-netifaces python3-zeroconf python3-urllib3 python3-psutil python3-pyroute2 python3-notify2 python3-distutils sox vorbis-tools lame flac opus-tools ffmpeg
2. If python3-pychromecast and pulseaudio-dlna are installed from the Ubuntu repository, delete them:
sudo apt remove python3-pychromecast pulseaudio-dlna
3. Install pychromecast 6.0.1
The pulseaudio-dlna Python 3 branch is not available for pychromecast 7, which is available in the Ubuntu 20.10 repository. Therefore, we must install pychromecast 6.
To simplify the installation, I uploaded a python3-pychromecast 6.0.1 DEB is here. In Ubuntu 20.10 / Pop! Download and install the software package on the _OS 20.10 computer.You can also install it on some another way If you wish.
You also need to “keep” this python3-pychromecast package version, so it has not been upgraded yet. This can be done with the following command:
sudo apt-mark hold python3-pychromecast
If you want to upgrade this package later, use the same command, but use “unhold” instead of “hold”.
4. Install pulseaudio-dlna Python 3 branch
For the following installation instructions, we will use wget and git, so make sure they are installed:
sudo apt install wget git
Now you can clone the pulseaudio-dlna Python 3 branch, patch Fixed the problem of waiting for the Chromecast device to be ready and installed:
git clone https://github.com/masmu/pulseaudio-dlna
git checkout python3
patch -p1 -i d46f419abd5105e48342ee45219cbf557d342af4.patch
sudo python3 setup.py install --record=installed_files.txt
Make sure to save
installed_files.txt Created by the last command above (should be created in the pulseaudio-dlna folder), because you can use this command to uninstall pulseaudio-dlna later.To remove pulseaudio-dlna installed according to the above instructions, run
sudo rm $(cat installed_files.txt) In folder
installed_files.txt Be placed.
How to use pulseaudio-dlna
To start pulseaudio-dlna, open a terminal and enter:
Next, open system settings, go to sound settings, and change
Output Device To your Chromecast/DLNA/UPNP device.This is how my Chromecast appears on
Output Device Sound settings part:
It is important to note that pulseaudio-dlna will have a considerable delay, so it may take a while to start playing sound on your Chromecast/DLNA device.
This will stream all sounds from the computer to the remote device.If you only want to stream sound from a specific application, please install
sudo apt install pavucontrol
pavucontrol (By typing
pavucontrol In terminal or launch
PulseAudio Volume Control (In the application menu), and then on the playback tab, you can change the stream separately for each application.
For example, in the screenshot above, VLC is set to stream to my Chromecast, while Chromium does not.
pulseaudio-dlna has many options. For example, you can make it use another port (port 8080 is used by default) as follows:
pulseaudio-dlna --port <PORT>
PORT Is the port to be used for pulseaudio-dlna.
You can also specify the codec to use:
pulseaudio-dlna --codec <CODEC>
aac And more.
You can also specify other encoder backends (a generic encoder is used by default), for example
ffmpeg, By running pulseaudio-dlna like this:
pulseaudio-dlna --encoder-backend ffmpeg
If multiple devices are found, you can use the following command to specify the device to be used:
pulseaudio-dlna --filter-device '<Device name>'
For more options, check the application help:
You may also like: How to enable echo/noise cancellation of microphone input on Linux desktop (PulseAudio)