Streaming music locally using icecast2 and mpd

I used to have my Chrome Cast devices steaming various Internet music stations via various integration points. Besides dependent on the Internet and the inability to control the music selection, the experience is mixed. From time to time the stations might be offline. Then there were also Chromecast bugs that would force a reboot to function correctly.

A few months back, I attempted to set up local streaming service again on an Ubuntu box. I tried it before, but gave up due to the lack of understanding of the underlying technologies. This time I finally got it working. It is still complex however. You need a sink device, Chrome Cast for me in this case, OpenHab and automation rules (HABApp-based in my case). Then you need the components to support local music stream: icecast2 streaming server, mpd server that plays music to the icecast2 server, and mpc client to control mpd. I captured the setup instruction at GitHub - yfaway/openhab-rules: OpenHab rules for my home . And here is the Python code invoking the mpc client to control the mpd server: zone-apis/src/zone_api/core/devices/mpd_device.py at master · yfaway/zone-apis · GitHub .

It is definitely not simple and not appropriate for non-technical people. But it has been working very well for me. Much more reliable than Internet music stations.

I hope this helps.

Another option can be to use Lyrion (formerly known as Logitech Music Server).
There is a LMS plugin to use chromecast audio devices in a way like a squeezebox player. And openHAB has a great LMS addon.
Lyrion is easy to setup, there are many options to use other players (sqeezelite is Open Source and there are builds for Android, iOS, GNU/Linux and Windows available, not to mention the original Squeezebox players as well as some other like the Pinnacle/Roku Tube players).

A long time ago I used Ampache to stream media via network, I’m not sure about the current state of the project, though.

3 Likes

Nice. I didn’t know about this one. I haven’t tried it myself, but it’s likely easier to set up than what I did.