gcast is a simple yet powerful command-line tool written in Python to discover, control, play media, and send text-to-speech (TTS) messages to Google Cast devices (Chromecasts, Nest Audio, Google Home, etc.) on your local network.
- Discover: List all Cast devices on your network.
- Play: Stream audio from a URL to a specific device.
- Support for Volume Control: Set volume levels directly from the CLI.
- Text-to-Speech (TTS): Speak any text message on a device (Mac-only, requires
ffmpeg). - Stop: Stop playback and quit the active app on the device.
- Python 3.7+
- macOS (Required for the
saycommand used in TTS) - ffmpeg (Required for TTS audio conversion). Install via Homebrew:
brew install ffmpeg
-
Clone or download this repository.
-
Run the install script:
./install.sh
Installs to
~/.local/bin. Ensure this directory is in yourPATH.Or manually:
pip3 install -r requirements.txt chmod +x gcast mkdir -p ~/.local/bin cp gcast ~/.local/bin/
Find all available devices on your network.
gcast listOutput:
Found 1 device(s):
----------------------------------------
Name: Living Room Speaker
Model: Google Home (Google Inc.)
IP: 192.168.1.50:8009
...
Play a default test sound or a custom URL.
Interactive Mode (Prompts you to select a device):
gcast playTargeted Playback:
gcast play --device "Living Room" --volume 0.5Custom URL:
gcast play --device "Living Room" --url "http://example.com/music.mp3"Make your device speak!
gcast say --device "Living Room" --message "Dinner is ready!" --volume 0.8Note: This generates an audio file using macOS say, converts it to MP3 with ffmpeg, hosts it on a temporary local web server, and streams it to the device.
Stop whatever is playing.
gcast stop --device "Living Room"--verbose: Enable detailed logging for debugging.--version: Show version number.--timeout: Set discovery timeout (default: 5s).--json: Output discovery results in JSON format.
- No devices found: Ensure you are on the same Wi-Fi network and mDNS is allowed. Try increasing timeout:
./gcast list --timeout 10. - TTS not working: Ensure
ffmpegis installed (ffmpeg -version) and you are on macOS.