Cutscene audio playing a bit late

Hello, I have been trying to do some cutscene audio in our game using this method listed in this discussion " Syncing audio with cutscenes ", using this script “https://fmod.com/docs/2.02/unity/examples-video-playback.html”. It works and is a much better improvement than playing the audio and video separately, but the audio still plays slightly off sync with the cutscene. Is there any way to adjust this? My current Latency_MS is set to 60 as of right now.

Thank you

Hi,

Latency_MS controls how much audio is buffered before playback and therefore introduces an intentional delay. It is not a synchronization offset. Reducing it may reduce a constant audio delay, but setting it too low may cause underruns.

Could you please confirm whether the audio is consistently late by roughly the same amount throughout the cutscene, or whether the offset gradually increases over time? Also, does lowering Latency_MS change the amount of offset?

Hello, thank you for the reply.

Yes, the audio is consistently late by nearly the same amount (tested in unity editor directly). No, lowering the Latency_MS does not solve it, it will make the entire audio glitch.

Try using this audio/video integration instead of the FMOD sample: Can we use fmod with videoplayer - #6 by alexholkner, it should fix latency and glitch issues.

Hey Alex, thank you for the help!
I tried integrating your script, but it seems I ran into an error in the editor:
“NullReferenceException: Object reference not set to an instance of an object
Audio.FMODVideoSyncer.Update () (at Assets/Scripts/TitleScreen/FMODVideoSyncer.cs:101)”

Line 101:
uint availableSamples = mProvider.availableSampleFrameCount;

I’m using .mp4 for the video and have set the audio output to API Only, with Track 0 (2 ch) enabled in the VideoPlayer component

Hello,
It seems I have managed to resolve the issue and the bug. Sorry for the unnecessary reply. Your script is now working. I will do several more tests, and if it is fully tested, I will mark this forum as Resolved. Thank you for your help @alexholkner @li_fmod . I stumbled upon your script when researching the topic. I thought your script was already integrated into the FMOD’s Scripting manual example, hence the creation of the thread, but it seems I misread the script. Sorry for that! But again, thank you for the help!!