Kodi Audio Out of Sync playing file or after seeking

Why do you think it will only land in the nightly of the 18th when @Portisch says it will be in the nightly of the 17th?

Looked like that because I assumed he just comitted it (plus my local timezone etc). You’re probably right, it could totally be in 1017 already.

it is, you can easily check it in the changelog:
kodi package bumped and the new version corresponds to the last commit (with new buffer code) in the respective 21.2 xbmc branch.

1 Like

I did a quick test with the latest nightly and it seems better, but still not in sync. Using Audio-delay-test-v5_23.976.mkv, it is still usually out of sync by +3 most of the time but it is bounded between +0 and +3. Using the freerun_mode trick will also still eventually get it to sync perfectly.

Kodi under Android on the same hardware still does not have any sync issues whatsoever with passthrough.

1 Like

I can confirm that this change has definitely led to some improvement, for me it looks like the audio offset is somewhat static per file now (i.e. rewinding 10s does not change the offset) but its still there, some are sync, others are more like 100ms or even 200ms off. I only tested TrueHD with Atmos so far.

It looks like Kodi has two passthrough options, ā€œAudioTrack (RAW)ā€ and ā€œAudioTrack IECā€. Which did you test with?

Does anyone know if what CE does is ā€˜equivalent’ to either of these?

It won’t solve the root problems, but I just recently published a Kodi addon that has some features which can help alleviate some of them.

I made an addon that allows you to configure individual audio offsets based on HDR type and audio format, along with some other seek-back features that help resync the AV stream. For me, I have to set my TrueHD offset to be different than my DTSHD-MA offset. This addon let’s me configure that and not have to manually adjust it based on the video I’m watching.

I’ll link the forum post here instead of double posting everything: Audio Offset Manager — Intelligently manage audio offsets

Currently, it’s only available from GitHub but I plan on submitting to the Kodi repo soon. If you do try it out, and notice any bugs or have ideas to improve it, you can raise the issue on GitHub.

edit: For anyone trying this, I’ve been releasing frequent updates as I prepare for Kodi repo submission. I mainly added an on-boarding process to detect if the addon is on a platform like CoreELEC and has access to amlogic infolabels, or if it’s on a generic platform that doesn’t. I also added a lot of error handling for playing formats that aren’t supported currently. If you experience any bugs, please check for the latest version on the releases page.

9 Likes

I have tested with both passthrough options. They both play in sync. There is this noticeable behavior though in Kodi under Android though where it appears to resync itself multiple times at the start before it ends up in sync.

I like the idea but like you said, this is just a band-aid for the underlying problem here. Sadly I can’t find a consistent delay per format, it feels like it changes per file and even per restart, so I have to manually adjust the delay every time…

3 Likes

@Portisch
If I didn’t miss anything, I noticed that the new experimental buffer code has been removed from the latest code in the repo. Is there any specific reason for it (issues, etc) or you just wanted to rework it a bit (or maybe had any other interesting ideas regarding that topic)?

@vpeter , @Vasco , @Portisch
Can you please comment on the removal of the experimental buffer code? Is it still safe to use in the personal builds or did you discover some issues with it? Thanks.

Do you think your device will explode or something?

It doesn’t work in all cases that’s why it was removed. Better handling is in work.

8 Likes

thanks). poor word choice on my end.
meant ā€˜safe’ playback-wise as I’m yet to test it on a wider range of content.

1 Like

@Unmutual
Would you be able to test with the files from Video Audio Sync Tests @ 23.98, 24, 25, 29.97, 50 & 59.94 and confirm that you are seeing perfectly in sync audio with those files (in particular the 23.98 fps one? The files make audio sync issues more clear to see compared to some movies.

When testing, also try seeking in the file after it has played a while and confirm if you see any change in audio-sync

Also how are your remuxes played back? Local hdd, smb over a local network, … etc

Thanks for the input on a problem that you are not seeing

Am6b+ here connected straight to TV and earc to denon 2700h. All in sync. No problems after skips or fast forward.
Files laying on my hard drive connected with usb 3…

2 Likes

I’ll have a look later for you when I’m back home. I play all my remuxes using Plex mod 4 Kodi. I’ve set it up using path mapping so it plays directly via SMB from my NAS but had no issues when streaming locally from my plex media server using the normal plex delivery method. The latest beta for Plex mod 4 Kodi has a specific setting for coreelec users to enable which is supposed to fix audio going out of sync after seeking. I had no issues before that setting appeared but I have it enabled anyway.

For what it’s worth, it’s something I’m incredibly sensitive to.

For me, the 23.976 4k one is slightly async, but the offset seems to be static (could be attributed to my TV or something), if I set the audio to ā€œahead by 75msā€, its fine and I can seek through the file, after seeking its sometimes slightly off but seems to fix itself after a few seconds.

However, this audio is PCM. With the Spears & Munsil 2019 samples (which have TrueHD, AC3, DTS, and DTS-HD and can therefore be used with passthrough), I’m seeing offsets all over the place, i.e. they change after each pause/seek. Offsets seem to vary between around -10 to +10 frames.

@doppingkoala is this the same for you?

I’m still running the latest nigthly (20241026).

This is exactly what I notice and why I don’t use those test files. I use the test files here in addition to the Spears & Munsil tests.

1 Like

Pretty much the same. For the PCM files, I was getting consistent results, a ~7 or 8 frame delay in the audio on initial playback, after a skip that would change to a ~5 frame delay.

Primarily I’ve been testing on the Spears & Munsil 2019 samples and a conversion I made of the PCM test sample to eac3, and I haven’t been able to find predictable pattern yet. cpm’s freerun trick somewhere above does seem to usually get close though, at least when only run once.

Is anyone aware of a publicly available test file like the Spears & Munsil one that has a white flash (allows the audio delay to be objectively measured) and has an audio format that works with passthrough?