noelhibbard / node-airplayhub

AirPlay server which accepts streams and then streams the audio back out to multiple AirPlay devices with sync support.
51 stars 12 forks source link

Apple TV 4 sync issue #14

Open Peter98 opened 7 years ago

Peter98 commented 7 years ago

Hi Noel,

I have been reading through your posts on shairport-sync and your work here, which is excellent by the way and it has been really interesting seeing your journey to this solution, I have a slightly different use case I am trying to solve and would like a bit of inspiration (I am basically trying to make wireless speakers for my apple TV).

So I have 2 shairport-sync end points (Raspberry Pi 3 B each attached to a DAC, AMP and a left/right channel speaker) and I run node-airplayhub on one of them. I can output TV audio to the grouped speakers perfectly synced with each other and about 30-50ms delay from the TV at a guess maybe a bit less. If I play directly to one of the end-points theres no audio/video sync issue.

I was thinking of using forked-daapd to pass to the end points but it's not compatible with more recent versions of tvOS.

Any suggestions appreciated,

Peter

mikebrady commented 7 years ago

Hi Peter. Could you set a 30–50 ms negative offset in the Shairport Sync devices?

Peter98 commented 7 years ago

Hi Mike, Apologies for not following up on this. After playing around with this setting my understanding is that the amount of delay you can set is end point device (DAC etc) dependent. Once you exceed the delay of the end point device you get no playback in my case. I haven't looked through the code controlling this yet so I cannot confirm this 100%. I think I could set a negative delay of about 50ms. This did help my overall sync issue but there was still a noticeable lipsync issue, very small but noticeable, also I am not comfortable setting a fixed delay as it makes it device dependent.

So I thought I could cut out the middle man and have my end point raspberry pi running shairport-sync point directly to the source timing ports assuming they would support multiple connections. I got a fairway through reading the code and made some small test changes but did not get a complete working solution. As it was looking to be a significant amount of work I decided to wait for the release announcement of tvOS 11 on June 5. The rumour is that they may be allowing streaming to multiple devices directly from tvOS 11/Apple TV 5 (ie the behaviour you see in iTunes and MacOS). If this isn't the case I will be getting back to some code hacking. Keep you guys posted after June 5. There's also a rumour Chromecast video might allow streaming to grouped Chromecast audio devices. Lets hope this all happens as it will save a lot of work and result in a more ubiquitous solution.

Peter98 commented 7 years ago

Apple were not very vocal about tvOS 11 but they have announced Airplay 2 to be released with iOS 11 in September along with Apple TV 5. I will assume they have to update tvOS 11 to include Airplay 2 to maintain a consistent ecology noting likely supported backward compatibility. So two questions are key. 1) Will streaming to multiple speakers be supported for Airplay/Airplay 2 in tvOS 11 - I think this will be likely 2) How hard is it going to be to build "Shairport 2" - Given backward compatibility this might not be a massive issue but would be a longer term goal.