Stream Videos, Music And Pictures From Gnome To Chromecast With Cast To TV Extension (v6 And v7 Released)

Cast to Chromecast Gnome Shell extension

If you own a Chromecast device and you're using Gnome Shell, you should give Cast to TV a try. This Gnome Shell extension adds a new entry in the system menu which allows casting local files to Chromecast or other devices over the local network.

Cast to TV features:

  • Cast videos, music and pictures from your Linux desktop (Gnome Shell) to Chromecast and other devices on the local network
  • Videos can be streamed using subtitles - it supports both external and built-in subtitles
  • Videos not supported by the Chromecast can be transcoded on the fly
  • Allows selecting multiple files to be streamed
  • Adds a Chromecast remote controller on the Gnome Shell top bar
  • VAAPI video encoding support
  • Can show a music visualizer on the TV while casting music

The extension had 2 releases over the past 5 days.

The first (v6) added some important new features like support for Chromecast subtitles without video transcoding, an option for setting the subtitles character encoding, and the ability to select and cast multiple files to Chromecast.

Other smaller improvements in the v6 release include showing the music cover when playing music for both Chromecast and webplayer, a position slider for the top bar remote control widget, and the ability to skip tracks using skip buttons.

The v6 release had a bug I stumbled upon while trying the extension on my Ubuntu 18.10 desktop (which uses Gnome 3.30.1), that made it unusable on Gnome 3.30 or newer.

To fix this, a new Cast to TV v7 version was released, which also added WebSockets functionality. Thanks to this new feature, users can turn any device with a web browser into a Chromecast (sort of...), and use Cast to TV to stream videos, music or pictures to it.

To use this new WebSockets functionality, open the Cast to TV settings and change the Receiver type from Chromecast to Other device. Next, select a file to stream from the Cast to TV menu. Now you can open a web browser on a device on your local network and in the address bar, use the IP of the desktop running Cast to TV, followed by 4000 as the port (http://IP:4000). You can now start playing the video in the web browser. The next time you select a new file in Cast to TV, the web browser tab that has the http://IP:4000 address open will automatically refresh, and start playing whatever you've selected.

As pointed out by the Cast to TV page, this can be useful to connect your smartphone (which has the http://IP:4000 page open) to some speakers to turn them into wireless speakers, streaming music from your Linux desktop. On Android you can even use this with the screen turned off.

It's worth noting that the extension doesn't yet support casting to multiple Chromecast devices (it doesn't let you choose to which Chromecast it should cast).

Chromecast-related articles you might like:


Using Cast to TV to stream videos, music or pictures to Chromecast. With the extension enabled and all required dependencies installed, Cast to TV creates a new Cast Media entry in the Gnome system menu. From here you can select the type of media you want to stream to Chromecast: video, music or pictures. In the media select dialog, you can hold the Control key to select multiple files (or Shift to select a range):


For videos you'll find a Transcode Video checkbox in the bottom left-hand side corner of the video select dialog, which you can enable to transcode videos not directly supported by Chromecast. You'll also find an extra Add Subtitles button in this video select dialog, so you can add subtitles to the videos you're streaming to Chromecast:

Cast to TV select video dialog

Some settings, like enabling hardware encoding, changing the listening port or FFmpeg path, Chromecast remote position on the top panel, enabling the music visualizer, or changing the subtitles encoding can be done from the Cast to TV settings, available in the same menu.

How to install Cast to TV extension for Gnome Shell


Cast to TV is available via the Gnome Shell extensions repository, so it can be installed from extensions.gnome.org or using Gnome Software. But the current version published there is v2 (while the latest version at the time I'm writing this article is v7), which is old, buggy and misses some features, so the instructions below explain how to install Cast to TV by downloading its latest release from its project page, and installing it manually.

As a side note, even when installed from extensions.gnome.org, Cast to TV requires some extra steps to get it to work (steps 2-4 in the instructions that follow below).

1. Download Cast to TV and install it.

Download the latest Cast to TV source from the GitHub releases page and extract it in your home folder.

To install it, open a terminal, navigate to the Cast to TV folder (that was extracted from the archive), and run make install to install it to ~/.local/share/gnome-shell/extensions. These steps can be done using a terminal as follows:

cd gnome-shell-extension-cast-to-tv-*
make install

2. Install Cast to TV dependencies.

Cast to TV requires ffmpeg, npm and nodejs. We'll later use npm to install some additional dependencies. libglib2.0-bin is also required on Debian / Ubuntu for the glib-compile-schemas executable, which is used when running make install to compile the extension schemas.

On Debian or Ubuntu, you can install ffmpeg, npm, nodejs and libglib2.0-bin using:

sudo apt install ffmpeg npm nodejs

On Fedora you need to enable the RPM Fusion repository to install ffmpeg. Enable this repository and install ffmpeg, nodejs and npm using:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

sudo dnf install ffmpeg npm nodejs

On other Linux distributions, these packages are most probably available in the repositories so install them from there. For Node.js and npm you may want to check out the installation instructions on its website.

3. Install npm dependencies.

Now you'll need to navigate to the extension installation folder and run npm install there:

cd ~/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com
npm install

4. Enable the Cast to TV Gnome Shell extension.

Gnome Tweaks Cast to TV extension enabled

When installed from source, Gnome Shell extensions are disabled by default. To enable it, start by restarting Gnome Shell (using Xorg: press Alt + F2, type r, and press Enter, or logout/login if you're using Wayland) and the extension should show up in the Tweaks application. Use Tweaks to enable it and you're done.

The extension menu will now be available in the system menu on the top bar (top right-hand side corner). When casting some files to your Chromecast, a remote control will show up on the top bar, in the position set in the Cast to TV settings.

No comments: