moonlight-android icon indicating copy to clipboard operation
moonlight-android copied to clipboard

Audio latency when using Android TV clients on some TVs

Open safijari opened this issue 3 years ago • 11 comments

Describe the bug So first off I don't know if this is a moonlight bug, but I'm also not sure where else to post this. There is an AV sync problem that appears to be different when using the same client device (I've tried on Chromecast, FireTV, and Nvidia Shield) on various displays. Specifically, the output audio is delayed when playing from the TV. At first I thought this was an issue with a new TV that I had bought but that doesn't seem to be the case. Lemme try to describe what happens as best as I can:

Say I'm using a CCWGTV (4K) and running moonlight on it. If I connect it to my monitor, I notice little to no issues with audio latency. If I connect it to my old TV (some old Samsung LCD TV) I notice a slight audio latency. If I connect it to my LG C1 or Hisense U7H, I notice what sounds like 100ms ish audio latency (i.e the audio is lagging behind the video). On both these TVs, if I connect my Steam Deck instead I see no noticeable latency when using moonlight (which in my mind at least rules out the TV). The latency issue exists in all 3 Android TVs I've tried, with it being slightly less on the Nvidia Shield.

The funny thing is that if I plug in USB headphones directly to the Android TV device, there's no noticeable latency in the audio, so whatever is happening is happening in some HDMI related audio processing. Note that game mode is on on all TVs, and I've tried my best to disable 5.1 audio and any audio processing in all the TVs as well as Android TV devices.

Steps to reproduce Plug a chromecast or firetv into an LG C1 or Hisense U7H TV and stream your computer to it using moonlight.

Affected games The issue does not appear to be game specific.

Other Moonlight clients No, when using moonlight on my Steam Deck and connecting it to the same TVs, there's no audio latency. It appears to be Android TV specific.

Moonlight settings (please complete the following information) The problem exists with default settings as well.

Device details (please complete the following information)

  • Android version: Android 12 or Android 11, depending on device
  • Device model: Chromecast 4k, Fire TV 4k max, Nvidia Shield TV Pro (2019)

Server PC details (please complete the following information)

  • OS: Windows 10
  • GeForce Experience version: unsure, latest at time of filing
  • Nvidia GPU driver: latest at time of filing
  • Antivirus and firewall software: Windows Defender and Firewall are both on

safijari avatar Dec 19 '22 19:12 safijari

I’m not sure this would be helpful, but I made a tool for measuring HDMI audio latency of devices like TVs, soundbars, etc. If you want to rule out audio processing delay that happens with HDMI inputs on your Android TV, you could try measuring its audio latency and compare to other devices that don’t experience this issue.

https://avlatency.com/tools/av-latency-com-toolkit/

allenwp avatar Dec 20 '22 03:12 allenwp

I have precisely the same problem. I have described the issue in this Reddit post I found that a great way to measure the latency is in the audio settings of the game "Hi-Fi Rush" and this YouTube video It's definitely the android tv moonlight application. I didn't try on mobile android, but I guess that should be my next try!

EDIT: I just tried on my android phone and would you guess it - no latency! I'm not sure if the android tv app is different from the mobile android app. That could still be to blame if not the OS

Emmanuel-Tsapekis avatar Apr 11 '23 21:04 Emmanuel-Tsapekis

I'm a programmer btw. I haven't worked on Android or even worked open source before, but maybe I should take a look to see if I can't fix it myself. If anyone has advice on where to start looking, that would be great!

Emmanuel-Tsapekis avatar Apr 12 '23 04:04 Emmanuel-Tsapekis

Taking a look, it would seem that it's an android tv OS problem. Maybe it's just my version (android 10) though - I have no way of checking whether it's fixed in android versions 11+

Emmanuel-Tsapekis avatar Apr 12 '23 17:04 Emmanuel-Tsapekis

Unfortunately it's still not fixed in Android TV 11 - on xiaomi stick 4k audio is behind video for around 500 ms at least. Are there any plans on fixing this?

inox9 avatar Oct 07 '24 14:10 inox9

To add to the list: I also experience this issue (~1 second audio latency) with a Google streamer 4k on a samsung 65" QLED 4K UHD Q75R when using Moonlight.

Hato1 avatar Dec 20 '24 09:12 Hato1

Same issue Google tv streamer on Samsung q70 qled. Nothing else on Google tv streamer experiences the delay, only moonlight

awolden avatar Feb 17 '25 01:02 awolden

Switching to a Nvidia Shield solved my issue.

Hato1 avatar Feb 17 '25 02:02 Hato1

Does any setting exist in sunshine to fix this audio sync issue? Or can simply changing the delay in some tv setting fix this?

ozkar79 avatar Apr 09 '25 16:04 ozkar79

I don't think Sunshine can fix it. In order to fix it, they'd have to compensate for the delay. The audio and video are produced at the same time on the host and received at the same time on the client. One side, doesn't matter which, would have to delay the video by the amount of audio delay in the TV. But this happens after the audio and video frames have been generated, so as a result, you'd be able to sync the audio and video but both would be delayed by the amount of audio delay. That might make things unplayable depending on the game.

BTW, I tried a USB DAC on my Chrome with Google TV and that eliminated the audio delay via HDMI. NVIDIA Shield has no such delay over HDMI.

lightrush avatar Apr 09 '25 18:04 lightrush

Maybe it will help someone. For now I've kinda solved the issue by using 3.5mm audio jack on my xbox one controller for sound output to my wired headphones while streaming (of course you should check "play sound on PC" in moonlight settings for it to work and mute sound on tv). So, in conclusion - xbox controller is connected directly to pc (not to streaming machine) and acts not only as a controller itself but also as a wireless audio receiver. I've noticed absolutely no audio delay in this setup. Of course it will work well only if your pc is not too far away from the place where you are streaming to.

inox9 avatar Apr 09 '25 20:04 inox9