[LINUX] Try casting videos and websites from Raspberry Pi to Chromecast and Nest Hub using CATT

background

I wish I could send video to Chromecast devices such as Chromecast, Google Nest Hub, Android TV with Gravio, but recently my colleague released a command written in Python called Cast All The Things (CATT). I was told that I am.

Cast All The Things: https://github.com/skorokithakis/catt

usage environment

Installation procedure

PIP installation

CATT is published on PIP. There are various ways to install PIP, so please refer to the following. https://www.python.jp/install/ubuntu/pip.html

$ sudo apt install python3-pip

Install CATT

Then install CATT. Note that it will be installed as a user environment without sudo. If you like that, please do so. It is better to install it with sudo to run it with Gravio.

$ sudo pip3 install catt 

What you can do with CATT

First, let's see the help for what you can do.

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

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

Commands:
  add           Add a video to the queue (YouTube only).
  cast          Send a video to a Chromecast for playing.
  cast_site     Cast any website to a Chromecast.
  clear         Clear the queue (YouTube only).
  del_alias     Delete the alias name of the selected device.
  del_default   Delete the default device.
  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.
  play_toggle   Toggle between playing and paused state.
  remove        Remove a video from the queue (YouTube only).
  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.
  set_alias     Set an alias name for the selected device.
  set_default   Set the selected device as default.
  skip          Skip to end of content.
  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  Please use "set_default".

You can do quite a lot of things. You can also view YouTube, local movie files, and sites. You can also operate the volume, specify the playback position, and operate the cue, so it seems that you can do various things depending on your ideas.

Try searching for Chromecast devices

Now let's search for Chromecast devices in the network.

$ catt scan
Scanning Chromecasts...
192.168.xx.xx - AFTT-51 - Google Inc. AirReceiver
192.168.xx.xx - Chromecast 4K - Google Inc. Chromecast Ultra
192.168.xx.xx - J:COM LINK XA401 - Google Inc. XA401
192.168.xx.xx -bedroom- Google Inc. Google Home Mini
192.168.xx.xx -Living room- Google Inc. Google Nest Hub

There are various Chromecast devices in my house, so there are so many. Google Home mini doesn't have a monitor, so this time it's out of scope. J: COM's STB was also recently replaced on Android TV, so it can be cast. AFTT-51 is a Kindle Fire TV Stick. I have an app called AirReceiver.

Try casting a YouTube video

Casting is easy. You can specify the device to cast with the -d option. Specify the device name you found earlier with catt scan. All you have to do is write the YouTube URL after cast.

$ catt -d living room cast https://youtu.be/tfNJctN1TL0
Casting remote file https://youtu.be/tfNJctN1TL0...
Playing "[Video]ASTERIA Warp Product Introduction 2min | Asteria" on "Living room"...

Try to display the website

$ catt -d living room cast_site https://asteria.com
Casting https://asteria.com on "Living room"...

Finally

I've been looking for it before, but before I knew it, I was able to create such a convenient command. Now you can do various things in cooperation with Gravio's sensor. That area will come later.

Recommended Posts

Try casting videos and websites from Raspberry Pi to Chromecast and Nest Hub using CATT
Install PyCall on Raspberry PI and try using GPIO's library for Python from Ruby
How to get temperature from switchBot thermo-hygrometer using raspberry Pi
Output from Raspberry Pi to Line
Try using ArUco on Raspberry Pi
From Python to using MeCab (and CaboCha)
Try to download Youtube videos using Pytube
Try using a QR code on a Raspberry Pi
Send data from Raspberry Pi using AWS IOT
Connect your Raspberry Pi to your smartphone using Blynk
From setting up Raspberry Pi to installing Python environment
Create a color sensor using a Raspberry Pi and a camera
Try to visualize the room with Raspberry Pi, part 1
Try using the temperature sensor (LM75B) on the Raspberry Pi.
Output to "7-segment LED" using python on Raspberry Pi 3!
Play to notify Slack of environmental data using AWS PaaS from SensorTag via Raspberry Pi3
[Go language] Use OpenWeatherMap and Twitter API to regularly tweet weather information from Raspberry Pi