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

Feb 16, 2017

Rclone Is Now Available As A Snap Package [Quick Update]

cloud storage

[Quick Update] Rclone is now available as a snap package, making it easy to install and update on a wide range of Linux distributions which support Snaps, like Ubuntu, Debian, Fedora, Gentoo, Arch Linux, openSUSe and more.

Rclone is a command line tool for synchronizing files and folders to multiple cloud storages (either from your machine or from one cloud storage to another). It supports Dropbox, Google Drive, Amazon S3, Amazon Drive, Microsoft One Drive, Yandex Disk, and more.

For more information about Rclone, as well as a GUI for it, see the following articles:

To install the Rclone (currently the snap provides a development version, 1.3.5-dev) snap package, use the following command:
sudo snap install rclone --classic

This should install the Rclone binary under /snap/bin/. The "--classic" argument is used because it puts the snap in classic mode and disables the security confinement. This is required for Rclone to work, or else it won't be able to access some user files.

Later on, if you want to update the Rclone snap, use:
sudo snap refresh rclone

You can update all the installed snaps using:
sudo snap refresh

For the "snap" command to work, you need the "snapd" package. This should be installed by default in recent Ubuntu versions, like 16.04 and 16.10 or 17.04. For Ubuntu 14.04, you can install it from the repositories:
sudo apt install snapd

For other Linux distributions, installing snapd is detailed on the Rclone installation page @ GitHub.

I should also mention that there's currently only one Rclone version - 1.35-dev -, available as a snap, no matter what channel you choose (stable / candidate / beta / etc/):
$ snap info rclone
name: rclone
summary: "\"rsync for cloud storage\" "
publisher: fireeye
description: |
"rsync for cloud storage" - Google Drive, Amazon Drive, S3, Dropbox, Backblaze
B2, One Drive, Swift, Hubic, Cloudfiles, Google Cloud Storage, Yandex Files
commands:
- rclone
tracking: stable
installed: 1.35 (55) 5MB -
refreshed: 2017-02-15 22:00:31 +0200 EET
channels:
stable: 1.35 (55) 5MB -
candidate: 1.35 (55) 5MB -
beta: 1.35 (55) 5MB -
edge: 1.35 (55) 5MB -


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

Alternative Global Menu For MATE And Xfce: Vala Panel AppMenu [PPA]

A while back I wrote about TopMenu, a panel plugin that provides global menu (AppMenu) support for MATE, then also included support for Xfce and LXDE.

The problem with TopMenu is that it only partially supports GTK3, it doesn't support LibreOffice, and with Ubuntu 16.04, it doesn't support Qt (4 or 5) applications.

Here's where Vala Panel AppMenu comes in.

Vala Panel AppMenu is a global menu panel applet for Xfce, MATE and Vala panels, which uses unity-gtk-module as its backend, and it works with all the applications supported by Unity's AppMenu.

Global Menu Linux Mint Vala Panel AppMenu

As a result, Vala Panel AppMenu provides global menu support for GTK2, GTK3, Qt4 and Qt5 applications, as well as applications like Firefox, Thunderbird, Google Chrome / Chromium, and LibreOffice.

For MATE, Vala Panel AppMenu requires MATE Panel built with GTK3 (so for Ubuntu, it requires Ubuntu MATE 16.10 and newer). Its README also mentions that to build Vala Panel AppMenu, you'll need GTK 3.12 or newer, GLib 2.40 or newer, valac 0.24 or newer and libbamf 0.5.0 or newer.

Here's Vala Panel AppMenu in action with Chromium, Firefox, Gedit (GTK3), LibreOffice, VLC (Qt5), and Thunar (GTK2): 

Global Menu Xubuntu Xfce Vala Panel AppMenu

Global Menu Xubuntu Xfce Vala Panel AppMenu

Global Menu Xubuntu Xfce Vala Panel AppMenu

Global Menu Xubuntu Xfce Vala Panel AppMenu

Global Menu Xubuntu Xfce Vala Panel AppMenu

Global Menu Xubuntu Xfce Vala Panel AppMenu

Here's an Ubuntu MATE 16.10 screenshot as well:

Global Menu Ubuntu MATE Vala Panel AppMenu

Vala Panel AppMenu is not perfect though, and I did encounter a few issues in my test:
  • when no window is focused / the desktop is empty, a menu containing "Desktop" and "Files" is displayed by the Vala AppMenu applet. These menu items don't work, at least in Ubuntu, and using them can cause the Xfce / MATE panel to crash;
  • Qt5 supports the AppMenu feature by default, without using any additional packages (I'm not sure which version introduced this feature), however, there's a bug with this and Vala AppMenu which causes the global menu for Qt5 applications to be displayed for a few seconds after the app is closed. This doesn't occur if the appmenu-qt5 package is installed though;
  • MATE only: GTK2 applications have the menu displayed on both the panel and in the application window. If someone can find a way to solve this, please let us know in the comments!;
  • MATE only: there's no easy way of moving the applet to the desired position, but it can be done using Dconf Editor;
  • there's no way of changing the global menu font color, and that can be problematic with some themes. For example, the menu font is dark on a dark panel background using the default Xubuntu 16.04 theme (Greybird). This doesn't occur with Numix GTK theme (which is installed by default in Xubuntu) or Greybird in Xubuntu 16.10.

You may also want to check out the Vala Panel AppMenu issues page on GitHub.


Install and set up Vala AppMenu in Ubuntu (MATE/Xubuntu) or Linux Mint (Xfce) via PPA


If you don't use Ubuntu or Linux Mint, you can grab the Vala Panel AppMenu source from GitHub.

Arch Linux users can install Vala Panel AppMenu via AUR.

For Ubuntu or Linux Mint, see the instructions below.


1. Install Vala AppMenu.

Vala AppMenu is available in the WebUpd8 MATE and Xfce PPA.

For Ubuntu MATE, the plugin is only available for Ubuntu 16.10, because it requires MATE Panel built with GTK3, and that is only the case for Ubuntu 16.10 and newer.

For Xfce, the Vala AppMenu plugin is available for Xubuntu 16.10 and 16.04, as well as Linux Mint Xfce 18.x.

To add the WebUpd8 MATE and Xfce PPA and update the software sources, use the following commands:
sudo add-apt-repository ppa:webupd8team/mate
sudo apt update

Then, install the Vala AppMenu plugin / applet:

- for Xfce (Xubuntu 16.10, 16.04 / Linux Mint Xfce 18.x):
sudo apt install xfce4-vala-appmenu-plugin unity-gtk3-module unity-gtk2-module appmenu-qt appmenu-qt5

- for MATE (Ubuntu MATE 16.10):
sudo apt install mate-applet-vala-appmenu unity-gtk3-module unity-gtk2-module appmenu-qt appmenu-qt5

2. Disable the menu from being displayed in application windows (so it's only displayed on the panel; without this, you'll get double menus, in both the panel and application windows).

2.A. for Xfce, simply run the command below:
xfconf-query -c xsettings -p /Gtk/ShellShowsMenubar -n -t bool -s true
xfconf-query -c xsettings -p /Gtk/ShellShowsAppmenu -n -t bool -s true

2.B. for MATE, you'll need to edit the ~/.config/gtk-3.0/settings.ini file (if this file doesn't exist, create it) and in this file, add the following under "[Settings]":
gtk-shell-shows-app-menu=true
gtk-shell-shows-menubar=true
Here are step by step instructions for doing this. Firstly, create the ~/.config/gtk-3.0/ folder in case it doesn't exist, by using the following command:
mkdir -p ~/.config/gtk-3.0/
Then open ~/.config/gtk-3.0/settings.ini with Pluma text editor:
pluma ~/.config/gtk-3.0/settings.ini
If this file has a "[Settings]" section, paste under it the following:
gtk-shell-shows-app-menu=true
gtk-shell-shows-menubar=true
If the file is empty, paste the following in this file:
[Settings]
gtk-shell-shows-app-menu=true
gtk-shell-shows-menubar=true
... and save the file.

Unfortunately, for MATE, this will not disable the menu from being displayed in app windows for GTK2 (I mentioned this in the issues section above).

3. Restart the session (logout, then log back in).

4. Add the Vala AppMenu applet to the panel (and how to change its position on the MATE panel).

4.A. For Xfce, right click the panel on which you want to add Vala AppMenu to, and select Panel > Panel Preferences (I prefer this to directly adding the applet to the panel, because it also allows moving it to the desired position), and on the Items tab, click "+" and add "AppMenu Plugin" to the panel:


You can move Vala AppMenu to the desired position on the panel via the Items tab from the Xfce4 Panel Preferences.

If you have TopMenu installed, make sure you don't mix the two!

4.B. For MATE, right click the panel, select "Add to panel", then search for "Global Application Menu" and click "Add":


Unfortunately there's no easy way of moving the applet to the desired position on the panel. That's because the Vala Panel AppMenu responds in the same way to both left and right click, and there's no area to access its context menu.

To change the global menu position on the MATE panel, you'll need Dconf Editor, which can be installed using the following command:
sudo apt install dconf-editor

Next, launch Dconf Editor, navigate to org > mate > panel > objects and in the "objects" tree, you should see some items called "object-1", "object-2" and so on. Start from the last object and see which has the "applet-iid" value set to "AppMenuAppletFactory:AppMenuApplet".

Note: you may have multiple applets ("object-1", "object-2", etc.) with the "applet-iid" value of "AppMenuApplet..." - in that case you'll need to change the settings for the last one (the higher number).

The "position" value represents the number of pixels between the left-hand side of the panel and the applet position. So once you find the right applet, change its position value to suit your needs (try to approximate it, if the other applets are locked, a lower value than the actual position will work in some cases).

In my case, I have a menu, a Firefox launcher, and a separator and I want to move the global menu next to them, so I set the "position" value to "100":

Global Menu Ubuntu MATE Vala Panel AppMenu

After you change the position, you'll need to restart the MATE panel to apply the changes (or logout/login). To do this, open a terminal and type:
mate-panel --replace &

5. Optional: enable Vala Appmenu (global menu) for Firefox and Thunderbird.

By default, Vala AppMenu will only display the Thunderbird and Firefox Unity actions (quicklists) on the panel. To enable the full Firefox and Thunderbird menu on the panel, you must launch Firefox and Thunderbird with "UBUNTU_MENUPROXY=0".

You can do this automatically (by copying the Firefox and Thunderbird .desktop files from /usr/share/applications to ~/.local/share/applications/ so they are not overwritten when they receive updates, and modify the .desktop files there) for both Firefox and Thunderbird, by using the commands below:
mkdir -p ~/.local/share/applications/
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/
sed -i 's/^Exec=/Exec=env UBUNTU_MENUPROXY=0 firefox %u/' ~/.local/share/applications/firefox.desktop
cp /usr/share/applications/thunderbird.desktop ~/.local/share/applications/
sed -i 's/^Exec=/Exec=env UBUNTU_MENUPROXY=0 thunderbird %u/' ~/.local/share/applications/thunderbird.desktop


Undo the changes


Below you'll find the exact steps required to undo the changes made by following the instructions mentioned above.

1. Remove Vala AppMenu:
sudo apt purge xfce4-vala-appmenu-plugin mate-applet-vala-appmenu

If you are sure (Important! don't remove these packages if you also use Unity) that the Unity GTK module and AppMenu packages are not used by any other packages on your system, also purge them by using the following command:
sudo apt purge unity-gtk3-module unity-gtk2-module appmenu-qt appmenu-qt5

2. Undo the MATE/Xfce menu disable settings

2.A. For Xfce, use the following commands:
xfconf-query -c xsettings -p /Gtk/ShellShowsMenubar -n -t bool -s false
xfconf-query -c xsettings -p /Gtk/ShellShowsAppmenu -n -t bool -s false

2.B. For MATE, open ~/.config/gtk-3.0/settings.ini with a text editor - the command below uses Pluma to open this file:
pluma ~/.config/gtk-3.0/settings.ini
And from this file, remove the following two lines:
gtk-shell-shows-app-menu=true
gtk-shell-shows-menubar=true
If this file was created by following the instructions in this article (was empty or it didn't exist before), you can simply remove it by using the following command:
rm ~/.config/gtk-3.0/settings.ini

3. Restart the session (logout, then log back in)

4. If you applied the optional Thunderbird and Firefox tweaks mentioned above, you can undo this step by simply removing their .desktop files from ~/.local/share/applications/. To do this from a terminal, use the following commands:
rm ~/.local/share/applications/firefox.desktop
rm ~/.local/share/applications/thunderbird.desktop

Thanks to WebUupd8 reader omg2090 for the tip and information (check out his comment for how to build this from source and an extra tweak).


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