Linux-based Home Entertainment System

Since two or three years I am experimenting with different solutions for my personal home entertainment system. Now that the solution has become quite stable I am going to describe my current setup and its evolution in this blog post hoping that someone might find it useful.

Everything started with an old Android telephone that I didn't need anymore and the idea that online music streaming and remote control for music replay might be a nice idea. I put XBMC (now Kodi) on that phone with some music on the SD card and a remote on my new phone and then things started to evolve. Setting up an Android device so that it automatically powers up with XBMC running and switches off when not needed anymore worked somehow but was quite cumbersome at that time. Also, the music on the SD card never matched my actual music library and parallel maintenance was annoying. So I got a small NAS, put the music on that NAS and found and automatic SMB mounting solution for Android. It worked, but sound quality of the audio jack of the phone actually wasn't too good and administration was annoying. So I switched to a Raspberray Pi with XBMC and also connected it to my TV via the HDMI port. However, XBMC was sluggish on the Pi, so I tried MPD instead, which was blazing fast but soon lacked several features with my ideas of what can be done with such a system evolving. Therefore, I replaced my Pi and the ready-made Synology NAS with a custom-built Linux-based NAS, which is also the media center server, connected to my TV and my stereo sound system. This is now the current state of the hardware evolution.

Schematic overview of my current NAS / home entertainment system setup.

On my custom-built server I am running the following software:

  • Archlinux as the operating system
  • SMB and NFS for file sharing to other clients
  • Mopidy as the media center connected to an external USB audio interface (Behringer U-Control UCA202 USB Audio Interface)
  • snapcast for multi-room audio replay from Mopidy
  • Kodi for videos
  • autosuspend for automatic hibernation

I decided to use two different solutions for audio and video in parallel because:

  • Mopidy has working Spotify support
  • Can be completely controlled without requiring a TV for certain
  • Further streaming plugins for web radio etc. exist
  • On the other hand, Kodi is very nice for handling video tasks

As remote controls for Mopidy I use the command-line based ncmpcpp on OS X and Linux and Remotedy for Android, which works slightly better than MPD-based clients. For Kodi most things can be done with the official Android remote control Kore. Only for some URL sharing tasks Yatse works better.

While Mopidy can be started as a system service, I opted to start Kodi as an autostart application of a special user of my system, which is automatically logged in. That way, I can also use the system as a normal computer using a wireless keyboard. I also had to configure pulse to ignore the external USB soundcard so that Mopidy / snapcast could use it without problems.

Finally, snapcast is the newest addition to the setup. It allows synchronized replay of audio on multiple devices as e.g. Sonos but for free. Mopidy outputs the audio to snapcast for distributed replay and one snapcast client already runs on the NAS to feed the external audio interface. I have set up a second client on the Raspberry Pi (also running Archlinux ARM) and connected it to other loudspeakers in my kitchen. The snapclient is started as a system service and automatically (re-)connects to the server so that just switching on the system results in an instant replay. An Android app allows to control which clients play at which volume level and clients can even be switched between different streams. This works really well and I didn't have any issues with snapcast so far.