You bought a Chromecast (v1) for your non-smart tv but refuse to use Chrome/Chromium for security reasons.

Here's how to easily convert all those .m4v videos into a Chromecast-friendly .mp4 container that you can stream directly from the command line on GNU Linux (Ubuntu 16.04 LTS) using stream2chromecast.

Chromecast on Linux can work!


Ok we admit it. We got suckered in the Chromecast craze in 2013 and its been a frustrating experience ever since due to the finickey nature of the SoC codec requirements; VP8 and H.264. So many times we've downloaded a video, pumped it through Handbrake, pushed it to our Chromecast and loading...and loading...and loading...and loading...blood flowed and people died.

Hopefully the nightly builds of VLC with Chromecast Renderer will get it all working (as it should have from day one) but what about right now?

The state of Chromecast is much like any other proprietary system; closed by design and we-don't-give-a-rats-ass-about-you attitude from the vendor. Normally we'd keep away from close-sourced hardware like this because of never-ending revelations on privacy abuses and constitutional infringements by both governments and corporations but having some pseudo-smart features on an older, high quality non-smart/dumb tv is the less of two evils.

We must restate: why not use Chrome? Its spyware.

What about Chromium and the Videostream for Google Chromecast extension? Its less spyware but more broken! We used it quite a bit during the Ubuntu 14.04 days but fate has decided it has another idea in mind. One cannot simply install the Chrome extension anymore to actually use Videostream in Chromium for local files.

Using the CLI is the key to maximize the streaming power with minimum overhead - on Linux!

In the past we loved using Castnow for video streaming from our local Ubuntu desktop on our wireless network to our Chromecast but after upgrading to 16.04.2 LTS x86_64 things are in a broken state and the developer has been asking for a new maintainer for a few years. One of the coolest things about Castnow was the ability to convert the video on the fly as it was streaming. Lower end hardware struggled with this feature even when it was a viable alternative.

In order to properly use stream2chromecast you'll have to install another open-source savior; Avidemux. This program is well known and has many features similar to Handbrake but does one thing magically; it will change the m4v container (and many others) into the proper mp4 container your Chromecast loves without much configuration or checkbox clicking of the former.

UbuntuHandbook's guide on How to Install Avidemux 2.6.13 in Ubuntu 16.04 can be used to easily get you going. Hopefully there will be a viable GTK version in the Tung Nguyen PPA as noted in Ji's article. The QT version however works just fine in Ubuntu MATE and most likely all flavors. Here are the commands verbatim:

sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu xenial-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'

wget -q -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -

sudo apt update && sudo apt install avidemux2.6-qt

Once you get Avidemux up and running you'll want open your m4v video file and change the following options in Avidemux:

    Video Output: Mpeg4 AVC (x264)
    Audio Output: AAC (Faac)
    Output Format: MP4 Muxer

 

After Avidemux has processed the video file, you can rename it to something thats easy to type (e.g., video1) and drop it directly into your stream2chromecast folder.

Open a terminal and cd /home/YOURUSER/Downloads/stream2chromecast/ folder. Then just drag and drop the stream2chromecast.py into the terminal, type the first few letters of your video, hit Tab for autocomplete and press enter. Stream2chromecast will search for your local network Chromecast, connect, process the video. The video will begin to play wherever your Chromecast is plugged. Joy!

Projects both big and small and can have a huge impact on your quality of life at home or in the business space. gripfastistech.com is here to help you through the power of libre/free and open source software. Contact us or comment below and we'll start something great!

About the Writer
Chris Lessley
Author: Chris Lessley
A server admin, dev ops warrior and website designer since 2002, Chris is a lover of all things Linux and open-source! Each blog topic has been tested by fire in the real world and shared with the hope to help others. Need more help? Hire me! Chris' other interests include fine art and the humanities in the classical tradition and can be found writing for our friends over at gripfastart.works. If you like this content, kindly consider donating to keep this website free to all, without ads.

Comments powered by CComment

Member of The Internet Defense LeagueOpen Source Initiative