Feb 17, 2017

How To Use Plex To Cast Local Videos To Chromecast (From Your Desktop w/ Optional Mobile App)

This is a long overdue article and I decided to post it so I can simply send it to all those who ask me about the best way to play local videos on a Chromecast.

Some may prefer other ways of playing local videos on Chromecast, including using a command line tool such as stream2chromecast, pulseaudio-dlna to  play music from a computer to a Chromecast, as well as the VideoStream Chromecast extension (which I hear is unreliable lately).

Plex Ubuntu

Plex is, however, the complete solution for all local media streaming to Chromecast needs, and is fairly easy to set up, despite my long article.

It can be used to stream local videos (and can transcode videos not supported by Chromecast), music, and photos, both in your local network as well as remotely, e.g. to a hotel or a friend's house.

Furthermore, Plex Media Server is cross-platform, so it can be installed on an a Linux, FreeBSD, Windows or Mac computer, as well as on NAS.

I should also mention that while Plex is freemium, using it to cast local media to a Chromecast doesn't require any paid features, for either Plex Media Server, or the mobile applications.

Plex can be used with a lot of players, like smart TV and game console apps, it's DLNA compliant, etc., but I focus on using it with a Chromecast.

This article includes an short introduction to Plex for those who are not familiar with it, installing and running Plex for the first time, some configuration tips and using Plex with a Chromecast (from a desktop, by using the Plex web app, or from an Android or iOS device, by using the Plex mobile app, which can be used to cast, as well as a remote).


Quick Plex introduction


Plex is a freemium client-server media player which consists on two components.

The first is the server component, Plex Media Server, which needs to be installed on a Computer (running Linux, Mac, Windows, FreeBDS) or a NAS, and is used to index, organize, stream the the local content, and optionally transcode it.

The second component is the player, used to stream the content from the Plex Media Server on other devices. There are Plex applications available for mobile devices, smart TVs, and more, as well as a web UI which comes by default with Plex Media Server.

I should also note that Plex Home Theater, a GUI desktop player for Plex, was discontinued. There's another desktop app, called Plex Media Player, which uses mpv under the hood, but sadly, there are no Linux binaries and building it from source requires quite a bit of work.

One such player is the Plex mobile app (available for Android and iOS), which can be used to play media from your Plex Media Server on your mobile device (but this feature is not free), or to cast to a Chromecast device (feature which is free) and control the playback.

Plex Android

If you're interested in what are the limitation / free functionality of the Android and iOS apps, visit the following links:

I won't get into details about all the features supported by Plex here. Instead, see its features page - make sure to also check out the free vs premium feature list. Don't worry though, pretty much any feature you'd need for using Plex with a Chromecast is available for free.

I do have to mention that one of the most important Plex features, which is its addons support. Plex addons are called "channels", and include video websites, news apps, and much more.

Plex Media Server channels

There are both official and third-party Plex channels. There are even unofficial channels that allow streaming Torrents, similar to the famous PopcornTime app (some may be illegal in your country!).

You can read more about Plex channels HERE.

I also want to mention a couple of features that are pretty important for using Plex to stream local content to a Chromecast.

One such feature is the ability to transcode videos that aren't supported by Chromecast. This is very important because by default, Chromecast devices have limited media support.

Another important feature, at least for non-native English speakers, is subtitles support. Plex not only supports local subtitles, but it can also automatically download subtitles from OpenSubtitles. Furthermore, it can even download subtitles for multiple languages.


Download / install Plex Media Server (and mobile apps)


Before proceeding, it's important to mention that Plex has a couple of requirements

The first is that you'll need to create a Plex account (free)

And the second, which is pretty important, is that Plex Media Server needs to run on a decent PC for transcoding (Intel Core i3 or fast is listed as a minimum requirement). Without transcoding, some videos won't be playable on your Chromecast.

That said, let's proceed.


1. Create a free Plex account

2. Download Plex Plex Media Server (for your computer / NAS)

The Plex downloads page offers binaries for Linux, Windows, Mac, NAS, as well as Linux (Ubuntu, Fedora, CentOS), and it's very easy to install.

I do have a note there though. If you use Ubuntu, you can add the Plex official repository, which is useful to get automatic updates without having to download the packages manually. To add the Plex Ubuntu repository, use the following commands:
echo "deb http://ift.tt/2gfePfY public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
wget http://ift.tt/2gDa6bO -O - | sudo apt-key add -
sudo apt update

Optionally, you can skip downloading the Plex Media Center binary manually and simply install it from the newly added repository:
sudo apt install plexmediaserver

There's also a CentOS and Fedora repository which you'll find HERE.

3. (Optional) Download the Plex Android or iOS app


Running Plex and some optional configuration tips


Plex can pretty much be used immediately after setting up your local library, but there are a few things to note.

Once installed, Plex should start automatically on Linux (start it from the menu on Windows). To access the Plex hosted web app, visit https://plex.tv/web and using your Plex account login.

You can also launch the local Plex web app, by visiting http://localhost:32400/web in a web browser. This is useful for managing the server without an Internet connection.

An Internet connection is required to stream from Plex to a Chromecast device though - in fact, Chromecast doesn't work without an Internet connection anyway.

The first time you visit this URL, you'll need to complete the initial setup, which asks you to enter a name to your new Plex server, enable or disable an option to allow accessing your Plex Media Server remotely, and add your media library.

Here are a few server settings I recommend changing after completing the initial setup:

1. Enable library auto-updating.

By default, the library is not updated when new files are added. I suggest you change this. Go to Settings > Server > Library and enable "Update my library automatically" and "Run a partial scan when changes are detected":

Plex library update settings

On Linux, you'll also see an option to include music libraries in automatic updates (you need to click "Show Advanced" in the top right-hand side to access this option), but that may cause issues if you have a large music library.

2. Enable subtitles.

To enable automatic subtitle downloading from opensubtitles.org, head to Settings > Server > Agents and:

- for Movies, click on the "Movies" tab. Then on the the "Plex Movie" or "The Movie Database" sub-tabs (yes, that's a bit confusing) - depending which one you choose for your collection (or you can just do this for both) -, check the box next to "OpenSubtitles.org:

Plex subtitle settings

- for TV shows, click on the "Shows" tab, then on the "TheTVDB" or "The Movie Database" subtabs (or both), and enable "OpenSubtitles.org":

Plex subtitle settings

You may also want to configure the OpenSubtitles.org agent - to do this, click on the gear icon on the right. This allows logging in to your OpenSubtitles.org account and selecting the subtitle language. It even allows selecting multiple languages:

Plex subtitle settings

For local subtitles, in the same places (Movies/Shows tabs), enable "Local Media Assets":

Plex subtitle settings


To set the preferred subtitle language and mode, see the Settings > Server > Languages page:

Plex subtitle settings


For more subtitle options, including extra subtitle providers, I recommend the Sub-Zero Plex addon (available in the Official Plex Channel Directory). 

For changing subtitles automatically to UTF-8, so they are displayed properly on Plex, you may want to check out the SRT2UTF-8 addon (unofficial).


3. Transcoding configuration.

By default, Plex transcodes only media that's not supported by the device that tries to play it. That should be ok for most users, but depending on your computer, you can change this to prefer higher speed encoding, higher quality encoding, along with an option to "make my CPU hurt".

These options are available in the Server settings, under "Transcoder":

Plex subtitle settings


Using Plex (web app / mobile app) to stream to a Chromecast


To cast from a browser / desktop, you'll need Google Chrome (the Cast extension is no longer required, and it has been discontinued).

Note that the Plex Web App streams content directly to the Chromecast (to the Plex Chromecast app). It does not cast the tab! That means you can even close the web browser after starting casting, and Plex will continue to cast.

To cast from Google Chrome, you need to click on the Plex cast icon (not the browser cast icon!), select "Cast...", then select your Chromecast device:

Plex Chrome Chromecast stream


Plex Chrome Chromecast stream

That's it. You can now simply click on some video, or other media, and it should be streamed to your Chromecast:


Streaming from Android or iOS is the same as for any other mobile application with Chromecast support. Simply click the Cast icon and select the Chromecast:


Sometimes the Plex Android app doesn't find any Chromecast device for me, but that's solved by clicking on the refresh icon from the Cast menu.

What's important to mention here is that if you started casting from your desktop, using Google Chrome, you can then control the playback using the Plex mobile application. The other way around works as well.

For more about using Plex, check out its documentation.


via Web Upd8 - Ubuntu / Linux blog http://ift.tt/2kQW3wE