Audio passthrough and infuse workaround

It’s ugly, but I have figured out a way to get true audio passthrough in tandem with content streamed via infuse (tied to a plex server).

Here’s the setup:

  • Apple TV 4K 3rd Gen (w/ethernet)
  • A spare Intel PC with a 9900k (loaded with kodi libreELEC) - I’m guessing there’s plenty of alternatives here that also have support for HDMI high quality audio codecs (afaik, raspberry pi’s are limited) but it’s what I had kicking around
  • Raspberry Pi 4b (loaded with the lite raspberry pi os)
  • Apple TV is going to the TV only and the Intel box is going to my surround sound only (obviously a couple simple switches could make it possible to flip to this “setup” quickly)

All are hooked via Ethernet to the same unifi flex switch. 2 scripts run on the pi: 1 script for a web remote (with play/pause) and 1 video syncing script.

It works like this:

  1. Find a movie or show to watch on infuse
  2. Play said content and hit pause either on the Apple TV remote or raspberry pi web remote
  3. The syncing script will fetch the movie and go to the exact time code from infuse on the Intel box running coreelec
  4. Once the two are synced, the web remote will report that it’s ready to play (takes about 3 seconds)
  5. You press play on the web remote which starts both infuse and playback on the Intel box
  6. You are now watching glorious infuse with passthrough audio

I know I could simply use the Intel PC with libreELEC or use my ugoos player, but I just find infuse to be a vastly superior and more reliable experience for video formats.

There’s still some bugs I’m trying to iron out (namely on getting the time codes EXACTLY right), but I’m so happy to finally have a solution for my Apple TV and passthrough audio.

Right now the only major sync issue I can’t seem to get around is that there is a bit of an arbitrary delay (based on what type of file is playing) when pressing “Play” on the web app remote.

Is there any way I could set infuse to have a deterministic delay on “Play”? Haha, not even sure if that’s possible. Ie, “Play” takes exactly 2 seconds to resume even if the file is ready to resume in 1 second.

Interesting setup! Thanks for sharing. :slight_smile:

Made some tweaks - given “Play” (after something is paused) can be arbitrarily long depending on the file, my web app remote strategy (pause, wait for sync, play) wasn’t really effective in all cases. If there was a setting I could toggle (maybe something that makes play take exactly 2.00 or 3.00 seconds?) it could work.

Instead I got rid of the webapp remote, and made it so the python script “seeks” across the video file and “learns” how much drift is being added or removed on its seek attempts (as, seeking also has arbitrarily long start and stop times). It stops nudging once both files are within 75ms of each other.

Plex also only updates video position around every 5 seconds, so trying to aim and hit the right mark was almost impossible. Instead, I used Tautulli which updates about once every second (though it does seem to have some errant data which needs filtered).

It depends on the content (size and type), but it typically takes about 1-2 minutes for it to hit a sync drift under 75ms. Quick demo of what it looks like (infuse on the left, kodi on the right), in this instance it took about 1.5 minutes to sync under 75ms (at least according to the drift detector it stopped at 54ms):

Neat setup :smiley:

Personally, if the goal is to get Atmos from bluray rips, I’ve resorted to converting the TrueHD Atmos tracks to high bitrate DD+ Atmos (link to forum post below),. I’d be surprised if anyone could tell the difference in a blind test (here they could not).

Omg this should work with spatial audio and my bass transducers!! Finally get tactile impact from the airpods