Kodi Audio Out of Sync playing file or after seeking

Splitting out the conversation to this topic.

3 Likes

I also have the problem without doing any skipping - just starting a file.

1 Like

I think the amlogic side is set to free run, I take this to mean audio and video no attempt to sync them

CSysfsPath(“/sys/class/video/freerun_mode”, 1);

hard to tell if it is just video related or audio as well:

3 Likes

thx. I think probably just placebo for me!

Will check with the test patterns later to establish a baseline of the issue.

1 Like

I’ve also noticed the sync issues a couple of times (happened randomly). For me it also affects the subtitles: video stutters when subs are displayed if sync is really bad, then seeking fixes it most times (I made a separate thread for it).

1 Like

same here, also wrote in your thread.

1 Like

Had a look at: Audio-delay-test-v5_23.976.mkv
I presume the tones should line up with the 0.

The sound lines up at different places each play/pause and seek and does not look like it re-adjusts just stays in it’s starting pattern.

Latency is constant for me at 0.166
VSyncOff swing negative to positive, seen -40 to +40

Once playing VSyncOff stays relatively constant up and down jumps maybe 1 at initial start after a sec or two and then hovers around 0.1 to 0.2 fluctuations ±, pause/play or seek get new values each time.


@doppingkoala @synthoceps @chuckster @Gilgamesh

ok first gustimating and interesting results.

if set the /sys/class/video/freerun_mode to 0 and back to 1, it looks like it re-syncs itself if out of sync!

echo 0 > /sys/class/video/freerun_mode
echo 1 > /sys/class/video/freerun_mode

possible can just code that on each seek as a potential fix - obviously needs others to confirm but don’t think I am just seeing things, just skip around a bit get the track out of sync, then run the two commands above on ssh whilst the track is playing, the video will pause on the 1st one, and then play catchup on the 2nd, and hopefully then in sync for you.

4 Likes

This only changes based on refresh rate.

looks like an exact fraction 1/6, need to check what other refresh latency are see if a pattern.

For every file I tested, this value always showed the 1/fps, where fps is the refresh rate. edit: this is incorrect, will have to test again, maybe it was only lining up for the non-fractional refresh rates - but it was definitely different for different framerates.

You were testing a 23.976 fps file with a 60fps output and not using refresh rate matching?

Ah yeah makes sense 1/60.

Was playing as fractional 24 fps.
Every onscreen says running fractional 24 Hz.
My UI is currently set to exact 24Hz.


was also thinking about 24/144 is 0.1666 if that connected someway - probably not.

Looks like this part of the code was had relatively recent changes.

What version are people testing with? CE-21.1.1? A nightly?

My test is based on 21.1.1 head a few days back now - but my own build so waiting for others confirmation

1/60 = 0.0166, not 0.166.

I’m also always seeing 0.166 for 23.976 with the rate matching enabled. I’m currently on stable 21.1, but had exactly the same behavior on earlier builds as well (21 nightly from ~july)

2 Likes

lol oh yeah :slight_smile:

Ok back to wondering is there is a master running 144 and then fractional worked from that to give a latency for the fps/hz

1 Like

Testing at other rates may help with working that out

24 fractional → 0.166
25 → 0.080
30 fractional → 0.066
30 → 0.066
60 fractional → 0.066

No clear pattern to that as yet

Maybe it has to do with new MAT audio packer, discussed here

If anyone can try out the commands I gave see if get a good result - would be appreciated.

I can when I get home. :slight_smile:

1 Like