For a quick way to stream audio from Linux to Chromecast check out the following nifty little tool.
Called Mkchromecast, this small python tool that will cast your PC audio to your Chromecast without needing to rely on individual apps add Google Cast support first.
The open-source app (which is also available for macOS) streams Linux desktop audio to your Chromecast using either ffmpeg or parac, and a choice of audio format (including mp3) at a sample rate of 44100Hz and an average bitrate of 192k.
These settings not your cup of tea? That’s not an issue; you can configure this cast-capable app to use lossy or lossless audio formats using ffmpeg, a higher bitrate or a different audio encoder. This is made easy thanks to an all-in-one
In all, mkchromecast (despite the awkward name) makes it easy to cast audio from your Linux desktop to your TV, Cast ready speakers, set-top box, etc. using Google Cast.
Just open Mkchromecast, select your Chromecast from the tray menu, and your audio is instantly ready for streaming!
You won’t see anything fancy on your TV while music is playing, but as this is an audio-only app I don’t consider that to be a massive drawback.
How To Install & Use Mkchromecast
You can install Mkchromecast on Ubuntu 16.04 LTS but it requires python-pychromecast, a library currently only available in Ubuntu 16.10 Yakkety Yak.
Thankfully, you can install the Yakkety package for this library on Xenial without issue. Hit the link below to grab it, and install itusing your preferred method (Gdebi, Dpkg, etc):
Next, download mkchromecast for Ubuntu from the project’s GitHub page. As before, install the app using your preferred method:
Although the vast bulk of mkchromecast’s dependencies should be installed alongside it (assuming you use the packages above) you may find that it doesn’t run. Don’t panic. Run the following command in the terminal after installing:
sudo apt -f install
Alternatively, you can install all of mkchromecast’s dependencies manually. To do so, enter the following command in the terminal:
sudo apt install python-pip python-flask python-psutil python-setuptools python-mutagen python-gi vorbis-tools sox lame flac faac opus-tools
You can also use the app entirely from the command line. Refer to the GitHub project wiki page for more details on this.
If you’d rather use the app with the tray applet and a GUI you need to install
python-pyqt5. Then, launch the app from the Unity Dash (or equivalent app launcher) and a Chromecast icon will appear in the system tray area:
From here things are straightforward:
- Click tray icon > ‘Search for Google Cast devices’
- Click tray icon > Click the name of Cast device you wish to stream to
That’s it. Your Linux desktop audio will be streamed to your TV.
Cast A Single App’s Audio
This might not be ideal; casting all of your desktop’s audio means you’ll also hear system sounds, audio from other apps, and more.
To send a specific application’s audio to Chromecast you will need to use an advanced sound control app, like PulseAudio Volume Control (pavucontrol). This allows you to select an audio application from a list and switch the sound output for it to ‘mkchromecast’.