Media streaming without Air Play

Just before the New Year, we saw a lot of links in the tech press to a very neat hack using a Raspberry Pi as an Apple AirPlay receiver. The project had so many news stories written about it before I’d spotted it that I didn’t put it on this blog at the time because I thought most of you would have seen it – but do go and have a look if you’re a iTunes person (and have managed to get your head around the new layout of the library in iTunes 11 – my own failure to have got accustomed to it so far makes me worry about brain softening).

If you’re not an iTunes person, and you’re looking for an open alternative, you could do a lot worse than use Stephen Phillips’ UPnP/DLNA streaming method, which uses Android phones as remote controls. Your music lives on a server, and streams to your home speakers via the Pi. You can also play your music by streaming it to any of those phones, whether you’re at home or out gallivanting.

If you already have at least one Android device and some speakers, Stephen reckons that your outlay, including the Pi, should be about £45 – contrast this with the cost of a similar (closed) setup using Sonos hardware (today’s price on Amazon, with a sale on, was £230). Audio quality should be as good as – or even better than, depending on what your home hi-fi setup is like – an off-the-shelf solution using AirPlay, Sonos or Squeezebox, despite coming in at a fifth the price.

This is something I’ve been meaning to set a Pi up at home to do for ages (a little thing called work has got in the way). If you want to make your own streaming setup, Stephen has easy-to-follow instructions on his blog.

 

29 comments

Avatar

Easier to install MPD, it can be quickly configured to stream to any of it’s client devices as well as play music locally.

Avatar

I don’t know about MPD. Does it allow multiple remote controls to share the same playlist? That’s the feature that I wanted.

Avatar

MPD does seem to have become sort of the “standard” for a server-based open-source music-player.

I wouldn’t give up on other projects or on the idea of starting your own though, as MPD leaves some things to be desired (for example, it’s built around a proprietary database and controlled through a proprietary text-based protocol) . I’ve been working on my own buildroot-linux based project (https://github.com/drensber/mpbox/wiki/mpbox-and-mpservice) that is functionally similar. I originally targeted x86 because that seemed to be the cheapest platform available to regular people. Of course the Raspberry Pi changes all of that, so I plan to get this ported sometime soon, probably taking advantage of the rpi-buildroot project for the underlying distribution: https://github.com/gamaral/rpi-buildroot, (if I can find a few cycles between taking care of a 1 1/2 year old!).

If nothing else, building your own gives you exposure to a lot of different aspects of software development (networking, databases, media codecs, device drivers).

Avatar

This has been one of the most useful features of the RASPBMC project, lots of fun surfing Youtube on the iPad for nursery rhymes for my son and then sending it to the Pi … the wife is now a Pi fan as she share out music videos from the iPad (youtube) to the Pi … works on Android too ….

Avatar

I have been running the MiniDLNA server on the Pi its self and this works great, tied in with a external drive and there is no need for the separate linux server.

more recently I have been playing with subsonic as a media server, the issues I have with uPNP/DLNA is that the device you are suing must be able to play the media file format as stored on the server. Does bubbleUpnp transcode the media to suit the client ?

I am waiting to see if we will ever get the GPU enabled encoding working with the likes of ffmpeg, its a pity to know hat the ability is there, but not accessible to those of us with out low level programming skills. From what I have seen if this was enabled the Pi would make a very nice low powered media server.

Avatar

Indeed I have had to purchase a second Pi because my wife does not like me playing with the media server as she is catching up on TV shows. Will be interesting to see how a 512mb version runs agisnt the 256mb one.

Avatar

I used to use Subsonic on my media server and an Android phone with the Subsonic client on stuck to the wall next to the Hi-Fi with velcro (and plugged in via the headphone output). This worked fine (though low volume) and the Subsonic server transcoded my FLAC files to high-bitrate MP3s before sending to the phone.

With this new set-up I don’t need transcoding as the RPi can deal with all the media file-types I have. I know there is some facility for transcoding in the BubbleUPnP server software because when I am out of the home and I request a FLAC file on my phone it transcodes it to an MP3 before delivery.

Avatar

If you want to stream to an android device just set up Samba on your pi and use es file explorer – this works very well for when I want to watch movies on the pi when I am in bed. Works for e-books as well, you can open any file in the pi with ANY app on android through es file explorer.

Avatar

Quote:
“Audio quality should be as good as – or even better than, depending on what your home hi-fi setup is like – an off-the-shelf solution using AirPlay, Sonos or Squeezebox, despite coming in at a fifth the price.”

I think the squeezebox server (LMS server) is given to little credit here. I setup an LMS server on my NAS, and run squeezelite on my 3 Raspberry Pi’s. One is in the living room connected to a network speaker, one is in the kitchen connected to ceiling speakers, and one is embedded in an eighties portable radio.
All these three are synchronized, making it an multi-room solution.
I don’t own any logitech squeezebox devices, the NAS I allready had for backup purposes, and one Raspberry Pi setup with peripherals cost me 80 euros. So a lot cheaper then the Airplay or Sonos solution.
See also: and
I haven’t made a video of the multi room setup yet, but I plan one.

Avatar

Agree 100% – wireless kitchen music system for £45 – I had an old wifi dongle lying around and phone charger, just bought myself some nice cheap logitech speakers that sit nicely, invisibly on top of a kitchen cupboard. I use squeezeslave rather than squeezelite but I’m sure it does the same job. iPeng on the iPad to control the system is great!

Avatar

video is 3.14 seconds

Avatar

I don’t think that your not being able to get your head wrapped around the new iTunes interface has nothing to do with brain softening and everything to do with bad design on Apple’s part. Thanks for the article.

Avatar

If you want AirPlay, install xbmc : vidéo + sound

Very easy

Avatar

Of course xbmc can do just about everything, but when you just want music, I think there’s a very case to be made for something a little more light-weight that doesn’t use the television as it’s primary control interface. One thing that I think is awesome about a low-cost platform like the Pi is that it makes it cost-effective and feasible to make devices that only do one thing, but do it really well, as oppose to “everything but the kitchen sink” packages like xbmc. Back when you were going to have at least $100-200 wrapped up in power-hungry hardware, it was hard to avoid the temptation to cram every conceivable function into one box. With a Pi only costing $25-35, and consuming just watt or two, it starts to make a lot more sense to say “yeah, this one is going to be for music only”. That’s the essence of “embedded systems” vs. general-purpose platforms, IMHO.

Avatar

Frankly, DLNA, Airplay and MPD are *all* lacking in various ways.

Airplay is proprietary, has poor support even on Apple hardware (you want to use Spotify? But that’s not made by Apple!), and doesn’t support DLNA’s source-controller-sink model.

DLNA doesn’t support live streaming (not really), and is waaaay overcomplicated and poorly defined as a protocol, which means there are basically no good implementations.

I’ve started working on my own simple but powerful protocol based on JSON. It is simple enough that you should be able to implement it in hundreds – rather than thousands – of lines of code. I’d be interested in people’s thoughts. Here’s the (very) draft spec:

https://docs.google.com/document/d/15B_ep0tL4efc307mHUk3MvFaFOwSRe718mWcZy4WKMU/edit

Avatar

Then there’s LogitechMediaServer (formerly SqueezeBox, formerly SlimBox). The server is simple to set up on Win/Mac/Linux, there’s an excellent Android app, and small, thin, CLI clients for both x86 and ARM. I had three different computers (AMD 8-core, ATOM 4-core, and a Pi) playing the same music from Pandora in less than an hour. And, despite Logitech not selling the hardware anymore, the software is open-source — it’ll be around for quite some time.

Avatar

what is the software to use on the raspberry to play content from LogitechMediaServer ?

Avatar

It’s called “Squeezelite”, search on the forum for a how-to.

Avatar

thanks for the reply

Avatar

Very great post!
I learned a lot about UPnP protocol wich was for me not very well known.
We see every day UPnP devices but we don’t really know what the UPnP stuff is for.
With this article i finally managed to understand what it’s for and what we can do with it.

Avatar

That post was worth reading just for the word “gallivanting”.

Avatar

Does it support gapless playback and replay gain?

Avatar

“No” and “no”. In fact, right now there is a bit of a “pop” sound between tracks.

Avatar

I don’t hear any crackling sound from the analog audio out.. Is it alreadry fixed? am I the last one to know it?

Avatar

I suggest a stroll around the forums!

Avatar

It sounds absolutely fine to me – I didn’t know there had been a problem. I had to do a lot of messing about, directing the GStreamer output through PulseAudio and then into ALSA but it’s all documented in the blog post. Without PulseAudio the sound from GStreamer was terrible. Aside from that, just using aplay or mpg123 which directly use ALSA (I believe) were fine out of the box.

Avatar

This is NOT streaming as in AirPlay streaming.
“Your music lives on a server, and streams to your home speakers via the Pi. ” -> it’s a very different case. With AirPlay I don’t play the music I have on a server, I redirect the audio of any application running on my computer via an AirPlay device (an amplifier, a Sonos, a Raspberry Pi + an amplifier…).

Although this article is interesting to understand the different steps involved, I recommend SqueezePlug, that has both DNLA servers and clients ready to install, and an AirPlay port (Shairport) that works relatively well.
I actually (accidentally) played BOTH streams simultaneously with the Raspberry Pi and both were playing fine! I was playing music through DNLA and I started a skype conversation on my Mac without switching back to local speakers, so Skype audio was redirected to the RPi. It worked like a charm…

Avatar

If anyone is interested in getting AirPlay working on the RPi with a high-quality external USB audio interface, then check out my blog as I have recently written a detailed article on how to get it running …

http://audioplastic.org/blog/2013/01/10/AP1/

This is the first part of a blog series that I intend to write. I’m striving for a ver high quality AirPlay system.

Avatar

Thanks for all the interest – I’ll be looking at some of the alternatives myself when I get a moment.

Just to point out there’s a forum conversation about my tutorial now:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=29663

Stephen.

Leave a Comment

Comments are closed