Command Line Chromecast Player CATT Gets Support For Subtitles And Website Casting

CATT, or Cast All The Things, a command line tool to send videos from many online sources as well as local files to your Chromecast, was updated to version 0.7.0, getting 2 major new features: cast file with local or remote subtitles, and cast a website to Chromecast.

With these additions, CATT's feature list becomes pretty impressive:
  • Cast videos to your Chromecast from all the websites supported by youtube-dl. This includes YouTube, 8tracks, BaiduVideo, BBC, BuzzFeed, CCTV, DailyMotion, Discovery, Dropbox, Flickr, Fox, Gyfcat, Imgur, Jamendo, LiveLeak, Mixcloud, MTV, NBC, PBS, and more than 1000 other websites
  • Cast local files, like videos, photos and music. Note that Catt can only cast local files that the Chromecast supports natively
  • Use local or remote subtitles
  • Cast any website to your Chromecast
  • Add video to queue
  • Control the Chromecast device (pause, stop, rewind, skip, seek, volume control)
  • Save and restore the Chromecast state

Related: Cast Videos To Chromecast On Linux With Gnomecast.

The new CATT "cast website" feature is similar to the "Cast tab" Google Chrome feature, so the website casted using CATT is dynamic, and not just a simple static view of the website. This feature is great for quickly sending a website to be viewed on your Chromecast, or for automation (can be used in scripts, e.g. create a custom Chromecast dashboard and automatically send it to the Chromecast when the device is idle). It's not useful if you need to interact with the casted website though, because you can't do that with CATT (it can control casted videos, but not websites).

As for the new subtitles feature, CATT automatically converts the subtitles to the WEBVTT format on the fly, so there's no need for prior conversion. The videos still have to be supported directly by Chromecast though, as CATT doesn't do any video transcoding.

The CATT 0.7.0 release also includes a few bug fixes:
  • Use netifaces instead of socket for get_local_ip
  • Guess the content type of remote files as well
  • Specify the correct mimetype when casting local files

Quick CATT usage guide


Catt Cast All The Things command line Chromecast player

To use CATT to cast a YouTube video to a Chromecast, use:

catt cast "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

In the same way you can cast videos from any website supported by youtube-dl, which CATT uses internally.

If you have more than 1 Chromecast device, you may want to specify to which device to cast the video. To do this, use:

catt -d Ultra cast "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Where Ultra is the name of the Chromecast device on which you want to stream the video and the YouTube url is the video you want to play on your Chromecast.

You can also use the CATT configuration file to select the default device. See how to do this here.

CATT automatically picks up subtitle files that have the same name as the video and they are in the same folder. If you want to specify the subtitles manually, use:

catt cast -s ./subtitle.srt ./video.mp4

Replacing subtitle.srt with your subtitle file and video.mp4 with the video you want to cast. CATT converts the subtitles to WEBVTT on the fly, but it does not convert videos, so make sure you only cast videos supported directly by the Chromecast device or they won't work.

To use CATT to cast (render) a website on your Chromecast, run:

catt cast_site https://www.linuxuprising.com

Replacing the Linux Uprising URL with the URL of the website you want to cast to your Chromecast.

CATT can also be used to control the Chromecast device (play, pause, seek, etc.), save and restore the Chromecast state, and more. See catt --help for a complete list of options:

$ catt --help
Usage: catt [OPTIONS] COMMAND [ARGS]...

Options:
  --delete-cache     Empty the Chromecast discovery cache.
  -d, --device NAME  Select Chromecast device.
  --help             Show this message and exit.

Commands:
  add           Add a video to the queue.
  cast          Send a video to a Chromecast for playing.
  cast_site     Cast any webpage to a Chromecast.
  ffwd          Fastforward a video by TIME duration.
  info          Show complete information about the currently-playing video.
  pause         Pause a video.
  play          Resume a video after it has been paused.
  restore       Return Chromecast to saved state.
  rewind        Rewind a video by TIME duration.
  save          Save the current state of the Chromecast for later use.
  scan          Scan the local network and show all Chromecasts and their IPs.
  seek          Seek the video to TIME position.
  skip          Skip to next video in queue (if any).
  status        Show some information about the currently-playing video.
  stop          Stop playing.
  volume        Set the volume to LVL [0-100].
  volumedown    Turn down volume by a DELTA increment.
  volumeup      Turn up volume by a DELTA increment.
  write_config  Write the name of default Chromecast device to config file.

How To Install CATT (Cast All The Things) in Linux


1. Add ~/.local/bin to your PATH (if it's not already added). Also export the PYTHONPATH as /usr/lib/python3/dist-packages:$PYTHONPATH to avoid having other apps picking up Python modules from ~/.local/lib.

You can do this manually (and source .bashrc / .zshrc) or run the following commands to do all of this:

  • for Bash:
echo "export PATH=\"\$PATH:\$HOME/.local/bin\"" >> ~/.bashrc
echo "export PYTHONPATH=\"/usr/lib/python3/dist-packages:\$PYTHONPATH\"" >> ~/.bashrc
. ~/.bashrc

  • for Zsh:
echo "export PATH=\"\$PATH:\$HOME/.local/bin\"" >> ~/.zshrc
echo "export PYTHONPATH=\"/usr/lib/python3/dist-packages:\$PYTHONPATH\"" >> ~/.zshrc
. ~/.zshrc

2. Install Python3 PIP and Python3 Setuptools

In Debian / Ubuntu / Linux Mint, use:

sudo apt install python3-pip python3-setuptools

3. Install CATT using Python3 PIP:

pip3 install --user catt

If you get a permission error when trying to install CATT using this command, you may have previously used PIP to install packages as root. This is not recommended but in such a case, you can force the CATT installation by running the install command above with sudo.

To download the CATT source, see this page.