Stream Local Media from the Command Line to ChromeCast with Stream2chromecast

How to Stream Local Media From the Command Line to ChromeCast with Stream2chromecast

Chromecasts are insanely popular. Recently, Google let it be known that they’ve sold over 29 million of them. However, since the inception of this device, few programs have existed that make it possible to stream local media files, instead focusing on services.

That’s why Stream2chromecast was created. It allows you to stream all sorts of content, even transcode or stream it from the Internet, directly to your Chromecast. And this all can be done on the Linux command line.

So, how do you get it working?

Installing Stream2chromecast on Ubuntu

This software makes use of codecs. There are two choices when it comes to this. You can either install the ever-popular FFMPEG, or Avconv. Either will work, but we highly suggest using FFMPEG.

Note: though this guide covers dependencies needed for Ubuntu, that does not mean that it will not work on other Linux distributions. Install the software dependencies listed with your package manager and follow the instructions afterwards.


You’ll need python on your system, as this tool is built with Python. Don’t worry, if you’re on Ubuntu chances are it’s already installed. If, for some reason, it isn’t there, just open your package manager, look for python2 (or something similar), and install it.


This can be installed onto Ubuntu by adding a PPA to your system and installing it. Doing this will give you the latest version of the software.

sudo add-apt-repository ppa:mc3man/trusty-media

Now that the personal package archive has been added, you’ll need to update your software sources.

sudo apt-get update

Now that the software has been updated, just install FFMPEG.

apt-get install ffmpeg


Avconv resides in the Ubuntu official software repositories. Install it by simply entering the following:

sudo apt-get install libav-tools

Now that codecs have been installed, it’s time to get the actual software. Start out by installing git if you don’t have it already.

sudo apt-get install git

With git installed, we can pull the software.


git clone

Using Stream2chromecast

Everything should run right away, as there’s not really any sort of compiling needed here. To get started, just enter the directory.

cd stream2chromecast


Once you’re in the directory, it’s time to run the program. Since this is a python script, you’ll need to run it with python.

It doesn’t need any compiling, and it’ll easily run by just entering the following command:


However, just because you ran these commands doesn’t mean that the Chromecast will broadcast anything. For that to work you’ll need to go through the options and figure out exactly how you want to stream to the Chromecast. Here’s how to do that.


This command here will send a video file to your Chromecast. file.mp4

However, you won’t always have an MP4 file at your disposal. This is why we installed a transcoder before. Run this command and your content will be converted to a supported format and streamed. -transcode videofile.filetype

Various useful commands


This tool has perhaps a laundry list of different things you can do to your Chromecast, and right from the command line, too! Here are the most useful commands. For a complete list, head here.

Controlling playback

Let’s start off with controlling playback. If you wish to pause a playing file, just run:

python2 -pause

To resume the same file, do:

python2 -continue

To stop playback, try:

python2 -stop

Volume control

If you’re familiar with most Chromecast-enabled apps, you’ll no doubt notice how they let you control the output of volume for playback. Here’s how to do this with Stream2chromecast:

Turn it up by 0.1 decible with the -volup switch

python2 -volup

Turn it down by 0.1 decible with the -voldown switch

python2 -voldown

You’ll also be able to mute it with the -mute switch and use the -setvol switch to set an exact volume.

Stream from a URL

Did you know you could stream a remote media file from the command line to your Chromecast? Use this:

python2 -playurl

Specify Device

If you’re looking to figure out exactly what Chromecast to stream to because you have multiple devices on your network, run this command to figure out what the device name is. -devicelist

Once you’ve found the device name, play media on it like this: -devicename mediafile.mp4


Streaming local media has always been a thing ever since Chromecast was created. You have AllCast, Videostream, etc. Still, those solutions are either dependent on Android or browser applications and websites.

These are fine, but as Linux users, we should strive for a better, faster, and simpler solution. That’s what Stream2chromecast brings – a simple, easy to use command line setup that anyone can figure out and even automate if they know python.

Do you like to stream local media on your Chromecast? Tell us why or why not below!

Image Credit: Wikimedia commons

Derrik Diener
Derrik Diener

Derrik Diener is a freelance technology blogger.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox