How to send video files from your computer to a Chromecast
The Chromecast is an affordable, easy way to play streaming video on your television. Normally, you control your Chromecast using the Google Home mobile app, or with the Chromecast button in streaming video apps, like YouTube or Netflix.
However, the Chromecast can also be controlled from your computer's command line. You can cast video files directly from your computer to the Chromecast over your home network. You can also cast video from streaming services, or display websites on your TV.
Using Python and the open-source utility CATT (Cast All The Things), you can cast video files directly from your computer. Follow these instructions to install and use CATT on your Windows, macOS, or Linux computer.
Install Python 3
CATT requires Python 3.5 or above. Follow these instructions to install Python. If Python 3.5+ is already installed on your system, you can skip to the next section and install CATT.
Install Python 3 on Windows
Python for Windows can be downloaded from https://www.python.org/downloads/windows/. In these examples, we are using a 64-bit Intel/AMD computer (also known as x86-64 or AMD64), so we download the Python 3.7.2 Windows x86-64 executable installer.
To install Python, run the installer and follow the on-screen instructions.
Note: During installation, we recommend you choose the option Add Python 3.7 to PATH. This option will ensure that you can easily run all necessary commands from the Windows Command Prompt.
When Python is installed, proceed to the next section and install CATT.
Install Python 3 on macOS
Python comes installed on macOS by default, but you may need to install a newer version of Python 3. Python 3 for macOS can be downloaded from https://www.python.org/downloads/mac-osx/.
Install Python 3 on Linux
If you're running Linux, Python 3 should already be installed. To check your Python 3 version, open a terminal and run python3 --version. If it is at least version 3.5, you do not need to install Python. However, you may need to install pip, the Python 3 package manager. For instance, on Ubuntu, run sudo apt update && sudo apt install python3-pip to install pip for Python 3.
CATT can be installed using the pip package manager.
Install CATT on Windows
First, make sure pip is up-to-date. Open a Command Prompt window and run the following command.
py -m pip install --upgrade pip
Note: If the command fails with the error message "py is not recognized as an internal or external command," then you don't have the default python launcher (py.exe) installed. Either reinstall Python with the "install launcher" option checked, or replace py with python in the commands in this section.
Next, use pip to install CATT.
py -m pip install catt
Verify that CATT is in your PATH by running where catt.
Install CATT on macOS
Open a macOS Terminal (in your Applications → Utilities folder). At the command prompt, run the following command.
python3 -m pip install catt
Install CATT on Linux
In a Linux terminal, run the following command.
python3 -m pip install catt
How to use CATT
To control your Chromecast with CATT, the general command is catt cast resource, where resource is a URL or the location of a video file on your computer. If the resource exists, CATT will automatically scan your local network, connect to the first Chromecast it finds, and tell it to play the video.
Note: If you have more than one Chromecast device, you can specify it by name with the -d name option, where name is your Chromecast's device name in double quotes. For example, catt -d "Living Room TV" cast resource.
Cast video from websites
Tip: Some URLs contain special characters used by the command prompt, so it's a good idea to enclose the URL in double quotes.
For instance, the following command plays a YouTube video on the Chromecast.
catt cast "https://www.youtube.com/watch?v=z2Whj_nL-x8"
Similarly, the following command plays a video hosted on Vimeo.
catt cast "https://vimeo.com/127605643"
Cast video from your computer
For instance, to download a video from YouTube, you can use YouTube-dl, which can be installed with pip.
python -m pip install youtube-dl
To download a video, run the command youtube-dl url, where url is the location of a YouTube video on the web.
To cast this video to your Chromecast, use catt cast with the video file name, enclosed in double quotes.
catt cast "Claude Shannon - Father of the Information Age-z2Whj_nL-x8.webm"
Control video playback
While a streaming video is playing on your Chromecast, you can use the command catt pause to pause it. To resume the video, use catt play. To stop, use catt stop. To adjust volume on the Chromecast, use catt volumeup, catt volumedown, or catt volume level, where level is an integer between 0 and 100. For a complete list of commands, run catt --help.
Cast a website
To cast any website to your TV, run catt cast_site url. You can't interact with the site, but it will appear just as it would in the Chrome web browser.