Kodi Audio Out of Sync playing file or after seeking

Does that mean output resolution or the actual video resolution?

Would make this sense?
Display resolution for sure as video is whatever itā€™s encoded or displayed.

Hi great work buddy what is steps to test, install latest nightly & which xml file? Thanks & does it mean itā€™s fixed or still work to be done.

What was I thinking doubting you? :blush: :sweat_smile: :yum:

Of course you got the things right using the display resolution and not the video height! Iā€™ve used :

<refresh resolution="2160">
  <min>23</min>
  <rate>23.976</rate>
  <max>24</max>
  <delay>250</delay>
</refresh>

and I get the same good results as before using the ā€œoldā€ format you added in nightly 20241129.

I managed to get my hands on a UHD video with dialogs and size 3840x1600 as top/bottom bars were cropped and of course, it played perfectly as expected!

I just wanted to post an update from my end: my addon ā€œAudio Offset Managerā€ finally got merged into the main Kodi repo under ā€œServiceā€ addons. I recommend everyone start by applying latencies as needed with Portischā€™s newly added advanced settings config, and then if you still need to apply different amounts of latencies for each type of audio codec (TrueHD vs DTSHD MA for example), you can look into using the addon.

3 Likes

I apologize if I am being dense, but Iā€™m unclear as to whether ā€œPortischā€™s newly added advanced settings configā€ is something that is included by default in a newer nightly build of CE, or whether (as a user of an AM6B+) I need to do some manual editing of config files? I am basically trying to figure out the easiest/most consistent path of fixing this problem going forward. Thank you!

You will have to create an advancedsettings.xml file and input your parameters as described by Portisch, indicating the audio delays you need for each resolution and frame rate. If your device is using SMB on your local home network, you can even access the Userdata folder that way and drop it in from a PC. Make sure to restart your device after modifying advancedsettings.xml.

And if you need offsets based on audio format, which is not configurable in advancedsettings.xml, you can use Audio Offset Manager to do that.

2 Likes

Update, everything is still all in sync (using version 20241206). Iā€™ve used my Ugoos a lot this week, all working 100%.

Iā€™ve been testing 21.1.1-Omega_nightly_20241206 for a few days by watching full UHD movies and see if everything works as expected and it doesā€¦ on that part!

What a bad surprise it was when I returned to regular 1080p content and noticed an audio delay I never had before until this release :frowning: My config is on Post #286

Iā€™ve been pulling my hair for more than 2 hours now trying to find the right config and get things working exactly as before, ie: 20241129 with the simple advancedsettings.xml like in Post #257

First a very important question because I canā€™t seem to determine that exactly :
When using the ā€œAudio delayā€ slider on per-video Kodi settings, is this delay added to the default in advancedsettings.xml or does is replaces it when non-zero?

So far, I canā€™t get everything to work properly! Here are a few things I tried:

<latency>
    <delay>0</delay>
</latency>

ā†’ Every video have a delay, which is to be expected!

<latency>
  <delay>175</delay>
</latency>

ā†’ UHD audio OK, everything else is not

<latency>
    <delay>250</delay>
    <refresh resolution="2160">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>175</delay>
    </refresh>
</latency>

ā†’ UHD audio OK
ā†’ HD/1080 audio is not I have to use the Kodi audio slider and set to ā€œAhead by 175ā€ ! So whatā€™s the real delay here? 175 or 175+250?
ā†’ All tested HD/1080 frame rates are affected, ie: 23.976, 24 and 25

<latency>
    <delay>0</delay>
    <refresh resolution="1080">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>250</delay>
    </refresh>
    <refresh resolution="2160">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>175</delay>
    </refresh>
</latency>

ā†’ Exact same results as before!

Iā€™ve tested more than 20 combinations and so far, Iā€™ve not been able to get a config which works for every scenario! Is it me or is there something wrong with this release?

The default latency is by frame rate and by the number of buffers used in Settings/System/Display. Default is 3.

Itā€™s ((number of buffers + 1) / frame rate) * 1000 like for 24Hz: ((3 + 1) / 24) * 1000 = 166.67ms.

With the advancedsettings.xml you are able to modify this hard coded value, increment by positive or decrement by negative value used as delay.

You need to make sure by yourself there is no audio offset set in player audio settings as this does take into count as well.
This value is used and set by the addon audio offset manager so it might confuse as it have much more dynamic adjustments possible. And I am not sure if the audio offset does get set to 0 again on end of playback.

1 Like

Hello Everyone,

Iā€™ve read most of the long thread which started with people complaining about an audio delay that was fixed by either skipping forward or reverse or stopping and re-starting playback.

I ask as I have this issue from time to time on all types of playback, from FTA TV to Movies and TV Shows.

While the most recents posts are about setting delays for various resolutions and frame rates, I wonder if the original issue, as I explained above, as been rectified?

TIA

Hi, Iā€™m sorry but this simply does not work, somethingā€™s wrong somewhere and I canā€™t figure out what :frowning:

  • Buffers are set to 3. Iā€™ve never changed that setting
  • I use ā€œAudio offsetā€ only to pin-point the needed offset. It is set back to 0 and I adjust the XML file accordingly

According to the formula, here is the current XML latency config :

<latency>
    <refresh resolution="1080">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>167</delay>
    </refresh>
    <refresh resolution="1080">
        <min>25</min>
        <rate>25</rate>
        <max>25</max>
        <delay>160</delay>
    </refresh>
    <refresh resolution="2160">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>167</delay>
    </refresh>

Which gives the following results :

  • 2160/23.976 and 2160/24 are OK
  • 1080/23.976, 1080/24 and 1080/25 are not OK. In all 3 cases, ā€œAudio offsetā€ confirms that AHEAD=150-175 is required (166.83, 166.67 and 160 respectively according to the formula)

So, whatā€™s the catch here? Why is this not working like it should?

I donā€™t know if two same refresh do work.
And you can here 7ms offset?
Just set one node with min 23 and max 25hz?

Of course I canā€™t hear a 7ms audio delay difference :sweat_smile: I just wanted to test a perfectly adjusted setting for all refresh rates :slight_smile:

I already tried yesterday to combine 23.976, 24 and 25 Hz settings in one stance to no avail. I even tried to reverse the stances, like 1080 after 2160 in case there was a parsing bug, again with no luck. As I said, I spent more than 2 H yesterday trying everything.

For now, Iā€™m back to 20241129 which works perfectly well with one setting but obviously, this is not a future proof solution.

Iā€™ll keep the 20241206 on my test USB stick in case a new nightly release brings something to the table.

I did a last test before giving up with

<latency>
    <delay>0</delay>
    <refresh resolution="1080">
        <min>23</min>
        <rate>23.976</rate>
        <max>25</max>
        <delay>167</delay>
    </refresh>
    <refresh resolution="2160">
        <min>23</min>
        <rate>23.976</rate>
        <max>24</max>
        <delay>167</delay>
    </refresh>
</latency>

and nothing new happened obviously. 2160 is still OK and 1080 still delayed. I also tried without the default <delay>0</delay> setting without any improvement.

Iā€™m giving up on testing for now, until something new comes up :slight_smile:
Iā€™m back on 20241129 for day-to-day use.

Yeah this issue sorta got muddied along the way. The original issue was that a ā€œsync eventā€ as someone coined it (referring to starting playback, seeking, pausing, etc.) could result in playback that was out of sync and that sync changed ā€œrandomlyā€ each sync event.

From what Iā€™ve observed in my limited testing, that seems to be resolved.

And we didnā€™t even have to mail Portisch any of our equipment! :sweat_smile:

1 Like

Did you try with latest nightly? There where some changes/fixes every new nightly. I will need to implement a logging what setting is pulled from xml.

On https://relkai.coreelec.org/?dir=Amlogic-ng/ce-21 the latest nightly is 20241206 and thatā€™s what I used for all my tests.

The new nightlies will include a entry in Kodi debug what latency was picked from advanced settings XML.

1 Like

Something Iā€™ve observed - as others have already mentioned as well, I do encounter different AV sync depending on output resolution/frame rate. However I think there is a drawback to the current approach. Non-passthrough playback is always in sync (for me at least, I donā€™t know if others observe the same). If latency settings are applied to tune passthrough sync issues, non passthrough audio (such as AAC or FLAC) in turn becomes out of sync.