Python program streams macOS or Linux system audio, video files, and URLs to Chromecast devices or Sonos speakers.
Overview
Mkchromecast sends audio and video from a macOS or Linux desktop to Google Cast hardware or Sonos speakers. It is written in Python and can encode streams through node.js, parec on Linux, or ffmpeg for more control over codecs and stability.
By default it streams using mp3 with a 192 kbps bitrate, with flags to change sample rate and bitrate when Wi-Fi or quality trade-offs matter. Lossy and lossless formats are supported when ffmpeg or parec is installed, including multi-room group playback and high-resolution pcm-style options up to 24-bit/96 kHz where devices allow.
Linux users typically route playback through PulseAudio and pavucontrol, or configure ALSA capture as an alternative to PulseAudio. macOS installs may use bundled apps, Homebrew casks, and virtual audio drivers such as BlackHole or Soundflower to capture system sound. An optional PyQt5 system tray menu exposes casting controls without typing console commands.
Beyond mirroring desktop audio, the tool can cast local video files, HTTP source URLs, and YouTube links when yt-dlp is available, with optional volume control and subtitle support for video workflows.
Key features
- Google Cast audio and video
- Sonos speaker support via soco
- node.js, parec, and ffmpeg backends
- Configurable codec and bitrate
- Optional system tray interface
- Multi-room Cast group playback
- YouTube and HTTP URL casting
- ALSA or PulseAudio on Linux
Use cases
- Send desktop audio to Chromecast
- Play video files on a TV
- Stream to Sonos from a computer
- Cast radio or HTTP audio sources
- High-quality lossless Cast playback