Got Chromecast playback working

OK, that was a quick fix.

In your case, the following should fix it…

ssh into the pi and run:
cd mpd2chromecast
git pull

Then try running it manually again:

cd
killall python3; python3 mpd2chromecast/mpd2chromecast.py

Hopefully it will work this time and if so, you can Ctrl-C the local run and the script should be restarted in the background.

Greetings. Hopping on to this thread for… reasons :slight_smile:

Say… google discontinued the chromecast audio. Which bums me out / I always hoped this would come to volumio eventually

Would it be an idea to get access to whatever they left is with? Can I inquire to Google devs in your name?

Cheers and thanks for your hard work

It’s not the same thing to compare what I did here and what the Chromecast Audio is.

So to clarify… In Chromecast API terms, there are three roles/apps involved in the streaming:

  1. Controller (controls playback, initiates the streaming etc)
  2. Sender (supplies the data for streaming via URL)
  3. Receiver (the end device that streams the data from the sender URL and plays the audio… i.e chromecast or smart speaker etc)

If you’re using your phone to cast YouTube to a cast-enabled TV or Chromecast, then your phone is the “controller”, YouTube servers are the “sender” and the “receiver” is the TV or attached Chromecast device.

The script I wrote leverages existing Chromecast API modules (pychromecast) in Python and turns Volumio into a Google Cast “Controller” and “Sender”. That then converts local playback of files into “controller” requests to the desired Chromecast and then plays the role of “sender” to stream the target audio file to the receiver.

Google discontinuing their audio-only dongle is thus not related to this. There are a load of normal Chromecasts out there well capable of streaming audio via their HDMI into receivers. There are many AVRs with built-in Chromecast audio support and many active speakers that support this as well. All of these should work fine with my script.

I totally understand that the HDMI-based Chromecasts fall short in not having a desirable SPDIF output for dedicated stereo hardware. I’m also aware that even with HDMI, that they forcefully up/down-sample to 48Khz. But it still possible to deploy a normal Chromecast with a HDMI interceptor and get a SPDIF coax/optical feed off the device. Chromecast audio dongles are also still available on Ebay. Google killed it off because the sales levels were way too low compared to other devices to justify continuing to manufacture it.

There was some hope in the past that Google might add an analog line jack/optical port to a future update to their Nest home mini. Unfortunately that has no signs of happening any time soon.

But the variables are being changed, especially in the last few weeks. With Apple now offering lossless streaming, this will be a good nudge for Spotify, Google and others to do the same and at the same pricing.

Then we might see a reissue of the Chromecast Audio or that SPDIF port option appear in a later issue of the Nest Mini.

Hi folks,
I’ve just released an update to my mpd2chromecast script “plugin” with some improvements:

  • The script now runs via a systemd service (use sudo systemctl to start/stop/enable/disable)
  • It has a first stab at supporting streaming the MPD output stream (works with moOde only and should work for gapless playback). I’m still working on this support in Volumio.

Full instructions here: https://github.com/dresdner353/mpd2chrom…/README.md

Quick install guide
To install or upgrade an existing setup on Volumio, you need only do the following:

ssh volumio@volumio.local
curl -s https://raw.githubusercontent.com/dresdner353/mpd2chromecast/master/install.sh | sudo bash

This will download/install the script and related python modules and start the new mpd2chromecast systemd service. It may take some time to complete.

If it works, then you can browse to http://[your device ip]:8090 and should get a control panel web page like the attached screenshot below. That control panel lets you select a desired Google cast device on your network and should then be able to stream any current playback to that selected device. By setting the cast device to “Disabled”, it will disable the functionality.

Streaming the file vs MPD Output Stream
The 2nd combo box (with play icon) can be used to toggle between two playback modes:

  • Cast file URL (Default)
    This is the default mode which serves the playing track file as a URL to the cast device. The end device will stream the selected file directly and perform all decoding.

  • Cast MPD Output Stream (experimental, not yet working with Volumio)
    This is experimental at present and only working with moOde. I have to dig more into Volumio on the best way to get the MPD output stream enabled. But this approach would let you benefit from any onboard DSP processing in Volumio and also be an approach for gapless playback. Certainly in moOde, I’ve been able to get several albums I have with gapless tracks to stream gapless via the target cast device or group. If you do enable this option on Volumio it just wont work for now.

1 Like

Just the steps to follow if you’d like to try MPD streaming on Volumio for mpd2chromecast:
Install/update mpd2chromecast as described in the previous post.

Then we need to edit the MPD config:

ssh volumio@volumio.local
sudo nano /etc/mpd.conf

scroll down to the Audio Output section and paste the following in as an additional audio_output for MPD:

audio_output {
    type "httpd"
    name "HTTP Server"
    port "8000"
    encoder "flac"
    compression "0"
    tags "yes"
    always_on "yes"
}

Save the file (Ctrl-X to exit and press y when prompted to confirm save)

Then restart MPD with:
sudo systemctl restart mpd

Then you should be able to select the MPD Output stream in the mpd2chromecast control panel (http://volumio.local:8090) and cast from MPD to your desired cast devices. Gapless playback should now work for you.

Note: This is only a temporary setup because Volumio generates the /etc/mpd.conf file each time audio-related settings are made or Volumio is restarted.

To make the settings more permanent, you would need to make the edits instead to the mpd.conf template

sudo nano /volumio/app/plugins/music_service/mpd/mpd.conf.tmpl

and paste in the same audio_output settings.

Then you should get the same changes permanently propagated to the /etc/mpd.conf on the next audio settings update or the next reboot. Tread carefully here as you could totally mess up your volumio setup especially if you have other plugins etc in use. It might be sensible to take a backup of the /volumio/app/plugins/music_service/mpd/mpd.conf.tmpl file first allowing you to roll back if you mess up things.

First of all, thank you for your continued work on getting Chromecast devices to work with Volumio.

I’m new to both Volumio and Pi, so I might not get all the nuances, but if I understand correctly, it is currently only possible to select cast devices from a web browser?

I would love to be able to select them from the zones and outputs tab inside Volumio, since I mostly control it from the 7" touchscreen and the app. I understand that’s a lot more difficult for you to add, but is it something that might come in future versions?

I’d have to develop a plugin natively on the Volumio stack that would integrate with the UI in that way. I’m not sure at all if its even possible. Worst case, it would be a left menu option that brings you to a page with a drop-down for cast device as opposed to something integrated with the existing multi-room features/icons they have.

But there’s a bit more to consider here. Volumio has paid plans for feature sets beyond the basic free stuff. In among those paid plans are support for streaming in Tidal and several other external services. But Volumio also now have an early beta version of their own native Chromecast support and it only works on the highest paid “Superstar” plan (7 Euro/month or 70 Euro/year).

So it’s not something I really should be trying to do if it competes with a premium feature they are trying to bundle and upsell. So in that regard, you will never see a plugin from me that tries to integrate into the native UI. They have every right to upsell stuff and I have no interest in causing conflicts. I’m happier to stay with the model I took that works well on both Volumio and moOde without getting too specific to either platform.

For ease of access, on any mobile you can bookmark the page and on Android, you can even drop an icon on the home screen that brings you directly to the cast page (http://your-volumio-ip:8090). That makes it pretty easy to work with. I can get to mine real easily and setup the casting or disable it.

I completely understand, I still plan on trying out mpd2cc, but I’d have to spend some time figuring it out and setting it up, I currently run a standard Volumio image.

The Android shortcut is a nice solution, thanks for the info!

I don’t think that there any restrictions on plugins, as long as they don’t adversely affect the normal use of Volumio. Have a read here: Volumio 3 multiroom - #5 by volumio

in Volumio, you’d need to enable ssh access and then run a single install command. It’s not installed like a standard Volumio plugin. It also only works on the Volumio 3 RC images. It will not work any longer with Volumio 2 images because of the age/unsupported status of the OS. It used to work on Volumio 2 but stopped well over a year ago.

I have no interest in building a Volumio native plugin for this but I would never expect or even ask Volumio to approve a plugin that offers a free alternative to something they charge for as a premium service. That is a direct conflict with their bottom line. I have not seen the V3 plugin guidelines but I would expect there to be provisions in place for that exact kind of conflict.

I was just pointing out that Volumio has always encouraged the ‘tinkerers’ in the Community (with suitable warnings that they do so at their own risk), and I think much of it’s early success depended on adoption by such people … I like to tinker. :wink:

I think your expectations for the guidelines may well be misplaced. My link to the Snapcast plugin comment was an example of a forthcoming premium service being potentially provided by a Community plugin. The two are not necessarily mutually exclusive, and each will appear as desirable by different types of user.

At the end of the day, what you develop is entirely up to you. :smiley:

I’ve got aChromecast with Google TV, I currently have a RPi going to a DAC. Wondering if there are any apps to see now playing info for display on the TV? I don’t want to control it as such but perhaps will try to install the normal volumio app and it should follow what’s playing?

I did connect the mini HDMI to the TV once but got a bad ground loop.

Edit: just had a quick look and couldn’t see the app on the Google Play store on the Chromecast. Guess you could sideload it, but guessing not supported.
Could just instal Tidal perhaps but probably a bit pointless

Cheers

Hello.

I also have the Chromecast with Google TV.

I managed to side load the official Volumio App. Which is good enough to show what’s playing, but terrible to use.
Some one is developing a new app for Android Auto (I think) which I also gave a go. And while it had many issues it showed some promise for the chromecast. I haven’t got around to trying either for a while though.
I also tried to find a web browser app, but none of them would resolve a local site/IP so I was stuck there as well.

I did start a separate thread for the Chromecast with TV, but nothing interesting to report. Phone/tablet is still king :slightly_smiling_face:

Thanks, it’s interesting but decided no point as I only use volumio with the RPI 4 , which feeds my rme adi2 fs via USB, then balanced XLR to active monitors. All works sweet and control on phone and webpage app.

On that note, it’s probably easier having a volumio web browser open on the Google/smart TV, and wouldn’t you see what’s playing then?

That was the simplest solution I thought of, but so far I have not succeeded.

I believe with the full Volumio subscription it opens up another set of api/html stuff so you could then have a remote page pointing your Chromecast back to your local Volumio install.

But at my last attempt I did not find a Chromecast browser that would resolve an internal web address/IP which I thought would have been easy. They all look external first.

If you find one, let me know :slightly_smiling_face:

Hi

Have just installed this from github and was hoping it could act as a replacement for Volumios built in chromecast support.

However as soon as I select a cast device from the web UI the track status changes to paused in the volumio UI. The current track will play on the chromecast, but no further tracks will play unless the queue is cleared and the chromecast device is set to Disabled.

I am running the latest version of volumio (3.378).

Logs below.

volumio@volumio:~$ python3 /home/volumio/mpd2chromecast/mpd2chromecast.py
Sat Nov 5 16:14:09 2022 Platform is identified as Volumio
Sat Nov 5 16:14:09 2022 Config file is /home/volumio/.mpd2chromecast
Sat Nov 5 16:14:09 2022 Detected update to /home/volumio/.mpd2chromecast
Sat Nov 5 16:14:09 2022 Loading config from /home/volumio/.mpd2chromecast
Sat Nov 5 16:14:09 2022 Config [{‘castDevice’: ‘Kitchen speaker’, ‘castMode’: ‘direct’}]
Sat Nov 5 16:14:09 2022 Starting MPD File Agent

Sat Nov 5 16:14:10 2022 Connecting to MPD…
Sat Nov 5 16:14:10 2022 Current Track://
Sat Nov 5 16:14:10 2022 MPD (play) vol:N/A 0:12/4:57 [04%]
Sat Nov 5 16:14:10 2022 Looking up Cast Device [Kitchen speaker]
Sat Nov 5 16:14:10 2022 Getting cast device object

Sat Nov 5 16:14:11 2022 Current Track://
Sat Nov 5 16:14:11 2022 MPD (play) vol:N/A 0:13/4:57 [04%]
Sat Nov 5 16:14:11 2022 Failed to get cast device status… 1/20
Sat Nov 5 16:14:11 2022 Kitchen speaker (none) [file] vol:N/A 0:00/0:00 [00%]
Sat Nov 5 16:14:11 2022 Casting URL:http://streaming-qobuz-std.akamaized.net:80/file?xxxx
{‘content_type’: ‘audio/mp3’, ‘title’: ‘’, ‘autoplay’: True, ‘metadata’: {‘metadataType’: 3, ‘artist’: ‘’, ‘albumName’: ‘’}}
Sat Nov 5 16:14:11 2022 Pausing MPD (initial cast)

Sat Nov 5 16:14:12 2022 Current Track://
Sat Nov 5 16:14:12 2022 MPD (pause) vol:N/A 0:00/4:57 [00%]
Sat Nov 5 16:14:12 2022 Kitchen speaker (play) [file] vol:N/A 0:00/4:57 [00%]

Whats happening here is that you are playing an external stream and it treats it like a radio station. It doesn’t try to play that stream locally like it would with a locally stored track. So its a once-off casting and that’s what you then experience.

For normal local file playback, it detects the local playback kicking in, pauses it (as you’ve seen), casts a local URL to the CC and when it detects the CC playing, it unpauses the local playback and seeks it to about 1-2 seconds behind the CC. The local playback is then monitored every second to detect track/playlist changes and the like to keep the two in sync.

To make this script work correctly with the likes of Qobuz and other external track-streaming sources, I’d have to use the monitoring of the CC playback itself to detect it stopped and use that as the trigger for casting the next entry in the Volumio playlist. I’ll take a look at this if I get some spare time in the coming weeks.

For now, maybe cast from the Qobuz app directly to the CC.

Thanks for the quick reply and detailed explanation.

Happy to test any changes / updates you make should you require it.

is it possible to use this to display the Peppy plug in with the VU meters?