Wanted to stream videos from the Raspberry Pi to my Chromecast and control it on the command line through ssh. Found out about a cli tool that does just that. It’s called castnow and it was quite a beast figuring out how to install it, so I’ve boiled it down here.
# It’s actually not a regular program you can just download with apt-get. It runs on nodejs.
So here’s the install breakdown:
Pre-install flight check:
sudo apt-get update -y
sudo apt-get install wget
# Update and install wget if not already installed.
Install nodejs:
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
tar -zxvf node-v0.10.28-linux-arm-pi.tar.gz && cd node-v0.10.28-linux-arm-pi/bin
This downloads an archive of nodejs version 0.10.28 and extracts it.
sudo su
PATH=”$PATH:/location/to/download/node-v0.10.28-linux-arm-pi/bin/”
apt-get install npm
npm install -g castnow
Change to root and add this path so that castnow will be able to run as a regular command once it’s installed. Install npm, the nodejs package manager. Then use npm to install castnow.
su pi
sudo ln -s “$(which nodejs)” /usr/bin/node
Change back to the pi user and make a symbolic link to the node directory in /usr/bin.
There’s a few cool things you can do with castnow.
- Play local .mp4 video files.
castnow ./video.mp4
- Play video and / or audio files from a directory.
castnow ./Media/
- Play multiple videos in a row.
castnow episode1.mp4 episode2.mp4 episode3.mp4
There’s many more commands and options to play with, more information can be found on castnow’s github: