Hacker News new | past | comments | ask | show | jobs | submit login
An open-source AirPlay mirroring server for the Raspberry Pi (github.com/fd-)
258 points by chetangoti on Feb 4, 2021 | hide | past | favorite | 118 comments



Gave up on chromecast for audio recently, had too many issues with discovery of the client.

Now using shairport (via the excellent hifiberry os and picoreplayer) on RPis and AirMusic on Android.

Seems a bit silly to be using an Apple protocol when I own zero Apple devices but works rather well. Had to give up on clientless playback (podcast app via chromecast) but this setup is significantly more reliable.


AirPlay is buggy sometimes well. For audio, my goto is Spotify connected to Echo devices. Spotify has a proprietary protocol for streaming to some devices that works really well.


AirPlay also works well with PulseAudio as a source IIRC, so even streaming from the desktop is pretty seamless.


Have tried, works well.

Does have a weird quirk where it'd detect two devices for each speaker, an IPv4 and v6 address. Only the v4 worked and both had the exact same name, mildly irritating.

Did try and find docs on disabling discovery and hard-coding addresses but to no avail.


Apple and friends should be _required_ to document their protocols. It would improve competition and benefit everyone in the long run.


Absolutely. Some smart person at my local school district decided that all rooms be fitted with Apple TVs(a great budget decision, especially since they're used exclusively as cast targets and have no accounts), which now only about 30% of students and about 70% of teachers can use because you need Apple clients to use them. This is in Europe, so Android has a relatively large userbase, especially for students.

The same smart person worked out a great deal during Covid that lets "disadvantaged" families buy an iPad for only 500€ so they can participate in online schooling.


I don't know what country specifically or how iPads are priced there, but just picking Germany at random the iPad's list price starts at 379€. Quite a deal they've got going...


PCs with a javascript console, GCC and Word-Excel (if not LibreOffice or just a browser) also start at 350€.

It’s for pupils. People who will make tomorrow’s world. We don’t want to give them a read-only world.


> We don’t want to give them a read-only world

One pan make many valid arguments about iPads vs PCs, and open vs walled gardens, but calling an iPad a 'read-only' device is NOT one of them.

My brilliant 12 year old daughter is an artist (both 2 and 3d, depending on her whims), and uses an iPad as a creative device that literally has no peer from other, more open ecosystems.

My 14 year old son learned the basics of coding on an iPad, and can use his for writing, math homework, and an incredible level of creative output programming various robotics devices he has.

An iPad does live in a walled garden, but it is far from a read-only device.


Tangent: Do you see any downsides of your kids using this technology vs writing/painting on paper?


No, I really don't. The kinda of things my daughter does on an iPad aren't possible on paper, and use a part of her brain that she doesn't trigger when she uses pen or paint and paper. Also, she does both.


Can you recommend any creation apps? I'm trying to make my iPad more useful to me than the browser and video watching device it currently is, but have had a hard time finding good apps for art and coding.


There are literally hundreds of great art apps - it really depends what you're in to. Procreate is perhaps the most popular, but there are options for animation and 3d art as well. Like any area of software, different tools fit different uses.


Setting aside the very necessary questions around the pros and cons of ed tech, from a strictly IT-management standpoint the support costs for iPads will be vastly lower than for PCs, especially a 350€ PC.

(Assuming they're well-insured and/or the children don't abuse them, etc.)


This sounds like words of a programmer. And I agree with your point to some degree, I would never consider an iPad for my work as a developer.

But this point is unfair to other knowledge workers. For example, my SO would get much better workflow from an iPad, especially with the pencil. The workflow includes a lot of research and note taking, including annotating images, and a mouse/trackpad is just too clumsy for this. The iPad seems perfect for that. I plan to get her one, currently waiting to see if they will refresh the iPad pro lineup in March.

Mind you that a 350€ laptop PC does not come with nearly as much longevity (due to bad build quality), performance and user satisfaction as the similarly priced iPad.

I believe iPad is a great force multiplier of the good 'ol pen and paper. It takes a bit of getting used to, but I bet the kids pick it up in a heartbeat.

For the more advanced endeavors, a 350€ PC as a second device. Not that expensive for a hobby, I think this is in reach of most parents.


Why not use iPad plus Raspberry Pi? - the combination would seem to cover a very wide spectrum of computing and learning.


That's also the list price. There's an education discount and annual back-to-school sales offered in Germany and a bunch of other countries.


That is insane.

I love my iPad and have used them in research for over 10 years. But I also have kids. It should be illegal to purchase glass tablets for education.

If Apple wants the education business, they should release a plastic touch screen version with a plastic backing (kids throw things, they can cut people in fights).

It’s sad when wealthy parents with too much time on their hands join these decision making committees and end up fighting for large corporations; and in this case, hurting the poor.


Schools almost always have decent cases on the iPads, and the backs are metal, so there isnt any issue with that breaking. With a decent case, there is a pretty low chance of the screens cracking at all. We rolled them out in an elementary school and had zero issues with screens cracking or general durability of the actual iPad.

Also, there is almost no other option. If you think there is a competitor with similar usability, support, specs, and is the same price, you should let some school IT people know, because Im sure they'd appreciate it.

Also if kids are cutting themselves because they are throwing iPads at each other while fighting, you have serious other issues going on.


Decent cases are on the order of $100. If iPads + essentials are ~$500, it’s no surprise chromebooks are doing so well.


Cases are less than 100$ for a good one. The iPad itself is only 300 for schools, so even if youre spending 100$ on a case, you're still only 400$ all in, and this is assuming you didnt get a grant from Apple that provides a significant discount beyond that.

Chromebooks have seen some impressive growth, but I dont think its going to sustain itself. The quality of the 300-500$ chromebooks is atrocious. They have to be replaced at least yearly, and the usability of this is very poor.


Parent of students with school issued iPads, here.

I hate iPads now, but I liked them before the schools standardized on them. The bluetooth keyboard clamshell case they issued was balls. The restrictive app and network policy enforced by the district was balls. The litany of apps students were required to use beyond instructional materials was boggling. They essentially assumed students would be great petty bureaucrats and they were wrong.


Even just legislation to safeguard adversarial interoperability would be a big help, so that companies like Apple can't wield DRM laws to shut down reverse engineering.


I’m all for “protocols should mandatorily be free” but then, how does Apple “guarantees authenticity” of the opposite device, to ensure it doesn’t brick it or gets bricked by it? I’m half serious, it’s always the excuse used for applying DRM to any device (even the famous orange juice presser, Juicero, now bankrupt, which only works with DRM’ed oranges, to ensure it doesn’t intoxicate the consumer), so should law also mandate that a device producer who doesn’t respect the specs is liable for the bricked iPhone?


If an improper Airplay implementation could brick an iPhone, what's to say a hacker couldn't do the same (whether or not you've opened up the protocol, because anything can be hacked)? Or even just a network screwup, or a random bitflip.

Which is to say, airplay shouldn't be capable of bricking an iPhone, and if it can, that's a critical issue which needs to be fixed.


I think a better example for AirPlay would be a third-party AirPlay server that (either maliciously or incompetently) exposes content streamed from the user's iPhone on the Internet publicly.


You could do that with an Apple TV too. The Apple TV has HDMI out—who knows where that signal is going!

Of course, the user needs to enable screen mirroring first, but they'd have to anyway. If the iPhone can be made to send a video signal over Airplay without user interaction, that's a serious vulnerability which Apple needs to address immediately.


> The Apple TV has HDMI out—who knows where that signal is going!

Sure. You could also point your webcam at your TV and then malware on your computer streams that to the public. This is all just a matter of how likely each problem is in practice.


Actually, HDMi is encrypted and only peripherals approved as receivers (i.e. not re-encoders) have the decryption key.

So they’ve tried at having a closed garden. They didn’t succeed much because they had to enable HDMi-to-VGA adapters, and VGA is not encrypted. But the resolution is lower.

But the battleground has been tested for complete lockdown of image output, and now that they have the rough idea, no doubt the next standards are going to be more and more restrictive.


> how does Apple “guarantees authenticity” of the opposite device, to ensure it doesn’t brick it or gets bricked by it?

The same way they do it with webpages, Messages, and email. JailbreakMe.com used a TIFF exploit to jailbreak your phone 10 years ago--they patched it. iOS 14 added a thing called BlastDoor to protect Messages from malicious data. I don't see how documenting it changes anything.


You actually authenticate the client? Just because, say, Apple has to document their protocols doesn’t mean they also can’t reject connects that aren’t Genuine(tm) Apple hardware with the usual bag of DRM.


Documenting the protocols would do little. You could have a completely documented protocol, as long as it requires some form of secret access key they won’t tell you there would be little you could do with it.


Does AirPlay require mandatory DRM? If not, I don't see why the base protocol couldn't be open, with DRM as a proprietary extension.


There are several AirPlay's. Some do, some have optional DRM, some just rely on device keys (some of which were reverse engineered years ago).

AirPlay is not a very useful term at this point tbh, but the Apple documentation on the differences is also garbage.


That just takes a crowd, and time


Sure the DVD and HDMi encryption keys are now public, but I doubt a long-enough encryption key will necessarily be cracked.


Any key that is in large amounts of consumer devices will be cracked.


Maybe, but it will also get revoked by the provider and not be very useful any more

There are lots of compromised Widevine Level 1 keys out there, but Widevine license servers no longer accept them.


If the key is in hardware is isn’t quite that easy to revoke, and if it is in software it isn’t quite that difficult to crack.


All Widevine Level 1 keys are in hardware. It's one of the definitions of a Level 1 key.


100% agree, an elegant solution to anti-trust would be prohibition on exclusive API access for any add-on products (watch, airplay, etc). I'm not that worried about the AppStore as an end-user as I like knowing I'm not downloading malware, that they are enforcing strong privacy requirements etc, but if I want to buy a non-Apple watch it should have complete compatibility with Apple Fitness, otherwise there's zero room for an honest case to be made that there isn't an abuse of dominance in one area (iOS/iPhone) to create dominance in another (wearables).


In this situation, as soon as Apple makes changes to any of their protocols, that would also be seen as anti-competitive behavior.

How would you propose to deal with API changes?


Like any other API they already make public for iOS/macOS: clear communication and deprecation timelines.


It’s worth noting that newly introduced Apple technologies are notoriously poorly documented. See SwiftUI as an example. Half of the api surface was undocumented at release. Surely that would give them a competitive advantage.

As for deprecation - why wouldn’t they deprecate as soon as they have a software update for their own supported devices?


Tbf AirPlay has been badly documented for more than a decade, it's not just recently!


Exactly - so ‘documentation as usual’ can’t really be the solution.


They’d just block third party implementations using patents.


So, with this you can stream from your iDevice using AirPlay to a Raspberry connected to, say, a TV? Is this correct?


correct


This has been really useful for me when teaching online. Just mirror my iPad to a desktop window, then point OBS at said window (then pipe OBS to Zoom through a virtual camera). I tried to modify the source to output to a v2l loopback device instead, but couldn't quite get it to work.


If you have a Mac, you can connect the iPad to it and share the contents of the screen directly (via QuickTime). The latency is lower.

https://appleinsider.com/articles/18/03/26/tip-record-your-i...


You can send the iPad screen directly into OBS using NDI. NDI HX Capture is the app for iOS/iPadOS. You'll need the NDI plugin for OBS.

I'm not sure which ends up being more reliable but I've had great success with NDI.


Oh that looks excellent, I'll check it out. Yeah, the latency right now is decent enough for whiteboard writing but could definitely be better. Only tricky thing might be that some apps have AirPlay integrations that will just broadcast parts of the screen, like only the writing surface without the UI elements up top. Not sure if that carries over to NDI, but I could always just crop it in OBS.


Can't you share the iPad screen directly in zoom?


Yes but it's apparently a little complicated. https://support.zoom.us/hc/en-us/articles/115005890803-iOS-S...

Teams also supports this well.

I kind of assumed it wouldn't work well before trying it, perhaps due to the lingering "mobile devices are low powered devices" stigma. In reality my iPhone can run full AR apps (meaning running the camera and a 3D rendering engine) and stream them to a Teams meeting without breaking a sweat. I wasn't even anxious about plugging in.


Ah yeah, I forgot to mention that I'm on linux, and iPad direct to Zoom doesn't appear to work there. Also, going through OBS lets me do scene switching between full video, slides, and whiteboard, the latter two with video overlay in the corner.


> By using OpenSSL for AES decryption, I was able to speed up the decryption of video packets from up to 0.2 seconds to up to 0.007 seconds for large packets (On the Pi Zero). Average is now more like 0.002 seconds.

This is cool.


Thanks for sharing.

There was an Airplay 2 implementation existed for not very long. Hopefully this one will stay.

Looking forward to more open source projects supporting AirPlay 2.


I think this one is using the legacy protocol


What is the difference between the two?


From [0]:

> Airplay doesn't offer multi-room audio; AirPlay 2 does

> AirPlay lets you stream from any Apple device to your speakers or TV

> AirPlay 2 lets you play from speakers over Wi-Fi, and it'll stay in sync

> AirPlay 2 lets play different songs in different rooms with multiple HomePods

Personally I've been very happy using AirPlay 2 with recent iPhones, a collection of HomePod Minis, an AppleTV and Denon Receiver. It makes it pretty easy to set up complex audio routing configurations from your phone. You can send a stream to several devices simultaneously while controlling volume independently and as a group. You can see what's playing on each device. Audio quality is good, battery impact seems fine.

I wish I could have strong AirPlay 2 support from non-Apple devices, but I know how the ecosystem works. Still, easy enough to use something like the Emby iOS app [1] to bridge arbitrary content into the system.

[0] https://www.pocket-lint.com/speakers/news/apple/144646-apple...

[1] https://apps.apple.com/us/app/emby/id992180193


> Airplay doesn't offer multi-room audio; AirPlay 2 does

That seems strange. Because I remember buying several used Airport Express base station to build a multi-room audio system. It worked great. That was around 2006/7, if my memory serves me right. At that time the protocol and the feature was called AirTunes.


Yeah, you (used to?) be able to do multi-room audio with the original Airplay, but it was only supported from Macs. iOS did not support it.


Doesn't the original AirPlay have a constant 2 second lag? Like pressing Pause will take 2 seconds to take effect. I remember hearing it was something addressed in AirPlay2.


Original AirPlay does have a built in lag, but commands like pause were sent immediately (and if the target has hardware volume control, volume would be instant to rather than modifying the lagged audio stream)


In addition to the features given by others, I believe AirPlay 2 significantly re-worked the way timing and sync works.

Previously I believe AirPlay (1) had a fixed 2 second delay, which was not a great UX and also caused issues in syncing multi-room (or multi-output) audio.

AirPlay 2 does this in a much more dynamic way that reduces the latency (anecdotally, maybe 100-200ms is typical) and improves the sync. I have no idea how it achieves this though.


I believe AirPlay 1 could not do multi-room audio at all.

Edit: OP actually has a really nice breakdown. https://github.com/FD-/RPiPlay#airplay-protocol-versions


AirTunes already had multi-room support. It might have been technically different. But you could select to mulitple AirPort Express at once and they would play the audio synchronized.


Airplay 2 adds multi-room streaming, and a nifty shared up-next playlist that multiple users can add to.


For Spotify users, there is the excellent RaSpotify client. https://github.com/dtcooper/raspotify


Nice to see this! Hoping it can be ported to Kodi soon (which has AirPlay support but is limited to audio only for recent iOS versions, see https://kodi.wiki/view/AirPlay).


This is excellent. I have a Macbook for work, and a Linux media center, and I just added this as a button on my remote so that I can Airplay. Much better than the previous workarounds I was using.


Would this run on plain Debian on the PI?

Raspbian took a turn that makes me think one should not use it anymore:

https://www.cyberciti.biz/linux-news/heads-up-microsoft-repo...

Sweeping in a repo by a third party is a bad thing imo.


The author complains that if VS Code is to be included, then at the very least it should be on a special version of RPi OS “for kids” because other people just want to run RPi’s headless. The thing is, Raspberry Pi OS already works like this: there’s a Lite (headless) version, a desktop version, and a desktop version “with recommended software”. VS Code is almost certainly only in that last one. So you can even run a “headful” RPi without it!

With all that said, I’m glad they’re including VS Code in the recommended software. In the past I’ve tried compiling it from source, but given the Pi’s limited CPU muscle it takes a long time.

https://www.raspberrypi.org/software/operating-systems/


> VS Code is almost certainly only in that last one

One might think that. One would be wrong. It appears to be in the headless version and up.


    I’m glad they’re including VS Code
The problem is not including VS Code in their distros repo. The problem is adding a third party repo to their distro.


>The problem is adding a third party repo to their distro

Why is that a problem? Lets not pretend that the article you linked actually provides a legitimate answer to this question.


From what (little) I've seen on the topic, the concern arises both from who that repo belongs to (many haven't rebuilt that trust) as well as that repo having general activity data from the update/install pings.

As someone who has a couple, I'm not thrilled about it but I'll just quietly disable it with a guide every time I install or update one. If they keep going in this direction, competition does exist.


>the concern arises both from who that repo belongs to (many haven't rebuilt that trust)

What's the concern? One of the largest Linux contributors is going to start pushing malware in their repos? If you don't trust MS, why would you be using Linux in the first place?

>that repo having general activity data

Literally the only thing you can determine from this activity is that someone at your IP address has an arm64 device running apt.

>install pings Only if you install something from that repo, so that's a very limited set of software.


Now suddenly data flows between my computer and Microsoft. Without me ever agreeing to that.

And if I install the wrong application - BOOM - Code by Microsoft is executed on my machine.


If you're using Linux there's code by Microsoft being executed on your machine, MS is one of the largest contributors to the Linux kernel. This is a really bizarre thing to object to.

>Now suddenly data flows between my computer and Microsoft.

So what? Data probably flows between your computer and NTP pool servers operated by completely random parties too.


It's like if you let the key to your house to a friend you trust, then that friend let your key to someone else without asking you. It is not okay.


And that someone they lent it to is a well known bad guy.


That analogy is incorrect. Only when you install software from the repository, I can see the point.


1. Raspbian goals seem to be for the OS is to provide an educational platform. I don’t see it as nefarious that they would include VSCode, given they install a number of other components (e.g. matlab) on the basic install. If you don’t need that, they offer the lite version.

2. If you are thinking about playing video you need Rasbian’s closed source drivers and if you are using ffmpeg, you will want their custom build that has hardware acceleration for the pi.


This is not about which software Raspbian includes in their distro. It is about that they have added a third party repo to their distro. So even people who do not use the software are affected.


Wow that sucks. If they must install VSCode they should use VSCodium which omits the telemetry.


“Microsoft bashing.”

Such a strange reason to give for locking a thread concerning these recent changes to Raspbian.


I can't see an issue running it on Debian or Ubuntu for that matter


> Microsoft may collect more info about RPi and Linux users as many try to reduce their digital footprint such as your IP address and build a profile about you.

So Microsoft, assuming they want to go the extra effort (these are likely unconnected infrastructure pieces) could build a fingerprint of you to know that.. what, you have a raspberry pi? And they could go to extreme lengths to associate this with your GitHub account to know that yes you, John Smith, have a raspberry pi? What business value is this for them, and how could it be used for “evil”?


In the future, coordination across Github, Linkedin, and other properties of theirs could exist (e.g. Facebook & Oculus). The not-that-nefarious-but-annoying one I can come up with immediately is better targeting for recruiter spam on LinkedIn based on hobby projects, code language, and Linkedin/Github connection graphs. I know they have ads on Bing that could benefit as well, but I don't know if they run their own ad network or how those things might tie together.

I think others could probably give the "evil" part a better take. Mine is just an unfounded guess around business/market research and future competition.


Firstly, I wouldn't underestimate the level of separation between fiefdoms in Microsoft. LinkedIn, Bing, Github... these are all pretty different parts of the company. Secondly, so LinkedIn is better able to target people who own a raspberry pi? I'm not even sure what kind of signal that gives you (could correlated to a wide variety of things), but given it's 1-bit nature... ok so I'm headhunted more or less specifically a tiny bit? I can't imagine this is even worth the engineering time at Microsoft, but if it is somehow, I still don't see the big deal here.

To me it just sounds like a general distrust of Microsoft compared to the Raspberry Pi foundation. I just wish it was more framed as 'I don't like Microsoft, no matter how rational or irrational this fear is.' I'd respect that far more than alluding to some potential tangible harm cross referencing that you own a Raspberry Pi with your github profile. You already declare what you own in your user agent when you use github to begin with -- why is an RPI so different and that much worse?


Would you object to google or facebook getting private keys installed on your computer without being asked?

How about a repo just for the CCP/US Gov/Russia?


The private keys are specifically for accessing a repo, which is also easy to disable. No, I wouldn't object if I was downloading software from them: I'd want it to be cryptographically verified. Similarly, I accept an OS with keys from Google and all kinds of people and governments in the form of SSL root certificate trust.

If I was getting software from the CCP/US Gov/Russia then that would also be fine. Here I'm not, it's a repo for VSCode from Microsoft. Context matters.


For the rest of us, I guess the canary died.


Can you point me to this 'death' scenario? What did it die of?

Are you worried Microsoft is going to install spyware by overriding something like 'git' in their repo that your pi would download instead? I see I'm getting downvoted, but no one has actually spelled out the potential evil scenario here other than better LinkedIn recruiting.


Oh this is great. Hopefully won’t have to spend €250 on yet another box to function as essentially a wireless HDMI adapter ...


I can recommend AirServer if you have leftover PC or Xbox, bought it for my Xbox and it's worked fine for my use-cases. Also many "smart-TV"'s seems to have it built in these days.


any Roku will serve as a miracast device and as a WiDpi or whatever it's called


They also added Airplay officially pretty recently.

All my TVs have Roku built in and I was surprised a few weeks ago to wake up and see that My MacBook & iPhone started offering Airplay audio/video casting to any of my TVs.

Pretty slick addition to the already great Roku featureset.


> I was surprised a few weeks ago

Oh well that’s cause for hope!


I have been using this on my RPi4B and it’s been pretty inconsistent. I haven’t had a chance to troubleshoot it yet though.


So it looks like this is an open source implementation of the airplay server. So Apple devices using airplay can stream to whatever server is running this.

Is there a program that does the same thing for the client? Such that I can run the client software on my laptop, and airplay to a raspi connected to my TV running the server software?


For Linux, pulseaudio (for sound) and Miracast (for video) come to mind. Support isn't as smooth, though.

I've seen several attempts at open source Chromecast servers because the client support is excellent, but very few have remained after Google changed their API to be more closed and encrypted.

I do wish there was such a tool, though. An open source alternative to Chromecast would be amazing imo.


I’ve used this and it was surprisingly easy to setup. It makes the RPI show up just the same as any airplay device, which is convenient.


I've just poked into some source files and decided to compile it on Archlinux with GNOME and Avahi. It seem to work in general :)


If anyone stumbles upon this but doesn't run Gnome (or probably any other DE): Avahi daemon needs to be running. If it isn't, RPiPlayer doesn't complain, but the mac doesn't see it.


Very interesting, if it has indeed the video capabilities that Shairport (& shairport-sync, ...) lacks.


Does anyone have any ideas about how to pass the desktop's keyboard and mouse to the device?

Essentially, would a full remote (LAN) desktop solution be possible here? Would love to be able to access iMessage on my Ubuntu desktop without switching hardware.


Why not just turn on the macOS built-in "Screen Sharing" feature in System Preferences > Sharing - it's a standard, albeit basic, VNC server. Just run a VNC client. If you want more features, there are tons of other VNC servers for macOS. A solution like you are suggesting sounds dramatically over-complicated to simply access your Mac from Ubuntu.


I don’t have macOS. I’m talking about iOS/iPadOS devices.

I have contemplated a KVM/qemu VM but, there are issues with iCloud services, including iMessage, when going that route.


I tried this last year to cast video and audio from the AppleTV+ app. I spent quite a bit of time trying to make it work, but ultimately it didn't.

Has this been fixed at all? Has anyone been able to cast AppleTV+ content?


This maybe an odd workaround but I've found the Airplay support in Zoom screen share to work quite well. Not good enough for video, but very reliable for showing the screen of an iPhone or Mac.


Out of interest, is there also a AirPlay display sink client for Linux? I'm still looking for a way to share my screen of my Linux laptop to an Apple TV / stuff like this.


There is open-airplay[777] doing that.

[777] - https://github.com/openairplay/open-airplay


Could you use this as an “analog hole” to scrape/OCR screen content from iOS apps?


It looks great. I only wish it could drop the dependencies on avahi and gstreamer.


Without Mdns there’s no way to get it to show up in the airplay list on iOS




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: