Cast Your Audio/Video to Your Google Cast or Sonos Devices
Mkchromecast
This is a program to cast audio and video from your macOS, or Linux
desktop to your Google Cast devices or Sonos speakers. It is written in
Python, and it streams via node.js
, ffmpeg
, or avconv
.
Mkchromecast is capable of using lossy and lossless
audio formats provided that ffmpeg
, avconv
(Linux), or parec
(Linux) are installed. It also supports Multi-room group
playback, and
24-bits/96kHz high audio resolution. Linux users also can configure ALSA
to capture audio.
Additionally, a system tray menu is available. More information here.
FAQ
For a list of frequently asked questions please visit the FAQ in the Wiki pages.
Contribute
If you want to contribute, help me improving this application by reporting issues, creating pull requests, or you may also buy me some pizza :).
Download
Select the best option for you
Install
macOS app
Download the dmg, and drag Mkchromecast to your
/Applications/
folder. Note that for the moments node
is the only backend
supported by default. This bundle contains support for casting to both Google
Cast and Sonos. You also need to install Soundflower as instructed below.
If you use homebrew, you can install Mkchromecast with one command line:
brew cask install mkchromecast
This will install the latest dmg and will install the Soundflower dependency.
Installing Soundflower (macOS users only)
For Soundflower you can check https://github.com/mattingalls/Soundflower/ or if you have Homebrew you can use brew cask as follows:
brew cask install soundflower
Or just download the latest dmg file.
Linux based installation
Mkchromecast is available in the official Debian and Ubuntu repositories. You need to install it by executing:
sudo apt-get install mkchromecast
Alternatively, you can download the latest deb package here, and install it as follows:
sudo dpkg -i mkchromecast_$VERSION_all.deb
where $VERSION = X.Y.Z-Rev
, e.g.: 0.2.6-1
. Then, if the dependencies are
not available you have to do:
sudo apt-get -f install
To pull the needed dependencies to cast using pulseaudio or ALSA, please
install mkchromecast-pulseaudio
or mkchromecast-alsa
respectively.
This should work in Debian Unstable and Testing. If you find any problems, please report it here.`
Installing from Github
To install Mkchromecast, clone this repository:
git clone https://github.com/muammar/mkchromecast.git
Or you may download one of the stable releases here, and unzip the file.
Python
To install the python requirements use the requirements.txt
file shipped in
this repository:
pip install -r requirements.txt
Note: if this step fails, maybe you need to run the installation with
sudo
as shown below. However, before installing using this method verify why
a regular user cannot install the requirements.
sudo pip install -r requirements.txt
Linux users can try to install these python requirements using the package managers coming with their distributions.
Now you are good to go!. If you are interested in installing ffmpeg, please follow the instructions here.
Sonos support
If you are using Linux, and need Sonos suport, you need to install the soco module:
pip install soco
This will automatically add support to stream to Sonos speakers.
cast
Casting from system tray
macOS
Casting from console (Linux example)
Note: macOS users don’t need to select any sources. Soundflower manages this automatically.
Some other examples
If you have installed the debian
package, then you just need to type
mkchromecast
in the console followed by the arguments shown below.
ffmpeg
Below an example using mp3
with ffmpeg
:
This is way more stable than the node
implementation. With ffmpeg
you can
modify the codec:
change the bitrate and sample rate:
Playing source URLs in Google Cast devices
You can play any source URLs headlessly from the command line:
python mkchromecast.py --source-url SOURCE_URL
This option is useful for:
- Casting using MPD in the case you have already a
http
streaming source. - Casting a radio station. A list of stations to try: https://ponyvillefm.com/servers
Example:
python mkchromecast.py --source-url http://192.99.131.205:8000/pvfm1.ogg -c ogg --volume
As it can be seen above, the codec has to be specified with the -c
flag.
Note: .m3u
or .pls
are not yet supported.
Playing Youtube URLs in Google Cast devices
You can play Youtube URLs headlessly from the command line:
python mkchromecast.py -y https://www.youtube.com/watch\?v\=NVvAJhZVBT
To use this function, you need to install youtube-dl
. In macOS, this can be
done with homebrew: brew install youtube-dl
. In Debian based distros:
apt-get install youtube-dl
.
Note: you may need to enclose the URL between quotation marks.
ALSA support
To cast using Linux with ALSA please check the wiki.
node
Change the bitrate and sample rate:
For more information:
Video
You can now cast videos to your Google cast using Mkchromecast. This feature is only working
with ffmpeg
backend and from command line. In the future, they may be a graphical interface
for this process. See this project.
- Cast a file from your computer to your chromecast:
python mkchromecast.py --video -i "/path/to/file.mp4"
Note: the format of the file can be whatever is supported by ffmpeg
and not exclusively mp4.
- Subtitles
python mkchromecast.py --video -i "/tmp/Homeland.S06E01.Fair.Game.1080p.AMZN.WEBRip.HEVC.DD5.1.x265.mkv" --subtitles /tmp/Homeland.S06E01.Fair\ Game.HDTV.x264-BATV.en.HI.srt
- Set the resolution
python mkchromecast.py --video --resolution 4k -i /path/to/myvideo.something --subtitles /path/to/my.srt
- Cast from a source url:
python mkchromecast.py --source-url http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -c mp4 --volume --video
- Youtube Video
python mkchromecast.py -y https://www.youtube.com/watch\?v\=VuMBaAZn3II --video
updating
Updating
macOS app
Download latest dmg file here. Drag and replace the Mkchromecast app.
Linux based installation
In debian (and soon in ubuntu), you can update by doing:
sudo apt-get update
.sudo apt-get upgrade
.
Alternatively, you can download the latest deb file
here, and do a sudo dpkg -i
mkchromecast_$VERSION_all.deb
From Github
So you’ve got a copy of Mkchromecast running and there’s some new update? Let’s update!
- Get into the Mkchromecast repository:
cd /path/to/mkchromecast
. - Run
git pull
to update. git fetch -p
to clean non existent remote branches.python mkchromecast.py -v
to verify the new version.
Alternatively, you can update as follows:
- Get into the Mkchromecast repository:
cd /path/to/mkchromecast
. - Run ` python mkchromecast.py –update `.