Audio delay on video players
H
Hugo Zink
Audio delay on both stream sync and video sync gets worse over time. It's gotten bad enough that a "Resync" button is essential in any video player world.
Other Canny posts on the issue claim that the problem is fixed in Unity 2017, this is definitely
not
the case.Log In
H
Hugo Zink
I should mention that this also happens on Twitch. Can't even watch a livestream without both the audio and video desyncing from each other, and
also
two players desyncing between each other.It seems the only thing that works is a plain web-hosted MP4 file, and even that will freeze and crash on occasion for random players.
Tupper - VRChat Head of Community
What videos does this occur with? As a matter of personal experience, I very rarely encounter A/V desync (with 1hr+ videos) given the following requirements are met:
- Video codec is h264, constant framerate at 30FPS
- Audio codec is AAC at 128kbit
- Resolution is 1280x720 (it is rarely useful to have higher rez than this, anyways)
- Enable "Web Optimized" (faststart flag in ffmpeg, moves the mov atom to the beginning of the file)
- Enable "Fast Decode" or equivalent feature. This reduces the CPU load to decode the video at the cost of slightly higher encode time
-- in h264 NVENC in Handbrake, this is the "High Performance" preset
-- in h264 software in Handbrake, this is a flag to set
-- In ffmpeg, this is set as a flag/preset
YouTube for the most part matches these as long as they have the proper settings available. Not all YT videos have assets available that match these qualities. Other platforms will be a crapshoot.
As far as I understand, the desync occurs when frames are dropped-- which means you also shouldn't be in super-crowded instances, shouldn't be alt-tabbing the application, or doing other things that'll eat CPU cycles.
I realize this is a pretty hefty set of requirements, but A/V sync isn't really something VRChat touches. We utilize Unity's native playback (or AVPro, if you're using VRC_SyncVideoStream), and A/V desyncs often dig so deep into those systems they're beyond our reach. There are open bugs for Unity that state these sorts of issues persist, depending on how you're using video in your application.
tl;dr Use those settings for best results. We try to ensure video always has A/V synced, but some of it is out of our control until some things change.
H
Hugo Zink
Tupper - VRChat Head of Community: it happens with pretty much any given YouTube video, as well as with Twitch livestreams. The video was originally uploaded with an mp4 with H.264 as video track, and AAC 192 kbit for audio.
I have seen worlds without desync, but
no desync
seems to be impossible through YouTube.Kizzy
This has been an issue ever since video players were a thing unfortunately. And yeah it was claimed way back when in their big blog post about Unity 2017 that it would fix the sync issues but it did absolutely nothing.
If you're just watching short videos or listening to music (under 20mins long) I recommend using Sync_VideoPlayer. For videos longer than 20mins you're going to start to notice desync, and Sync_VideoPlayer does not have a resync button.
In comparison, Sync_VideoStream does have a resync button, and thus is better for watching long videos and movies, but the negative with Sync_VideoStream is it gets out of sync way faster than Sync_VideoPlayer does, so you have to hit the resync button like once every 6-7 minutes. Sync_VideoStream also does not support Windows 7 users.
Video players have a ton of issues. In addition to this one there's also the fact that YouTube Live has been broken for almost a year and so you can't stream live youtube videos in game.
There used to also be a bug where Sync_VideoStream would either crash people or send them into an infinite loading loop on many maps that used it, thankfully that seemed to have been fixed somehow a few months ago, so at least I can actually play videos for people now.