Media Framework - WmfMedia audio lag
We are experiencing a persistent audio lag (about 0.5 to 1.0 second delay of audio track compared to video track) when playing any mp4 video using the Media Player. This happens even when opening the Media Player asset in the editor and playing any of the Media Source from there (without actually going into play mode).
UE version is 4.20.1. We were able to reproduce this on 3 different PCs and using several different videos, including this one: https://dnnrz1gqa.blob.core.windows.net/portals/attachments/Engine/MediaFramework/HowTo/StreamMediaSource/Infiltrator%20Demo.mp4?sr=b&si=DNNFileManagerPolicy&sig=F%2BBpnYueeQTUTSW0nCRSrXEfr35LIawe7C3MQoe2%2FPI%3D
Using File Media Source instead of Stream Media Source (after downloading video on disk) doesn't change anything.
I tried every setting I could find with no success. The only setting that made a difference is "Native Audio Out" in the WmfMedia plugin project settings. It did eliminate the lag, but prevent Pause from working (using "Pause" BP node on the Media Player returns false and video continues to play) so this is not a solution for us unfortunately.
For reference, here is our setup for using Media Player in play mode (though I doubt it has any relevance):
Lag is the same no matter if it's in actual standalone built game, in the MediaPlayer window in Editor or in PIE.
Has anyone else experienced this? Is there any solution other than writing custom Decoder Plugin?
Edit: tried using the current master of VlcMedia plugin with no success. The lag remains but with this decoder videos appear to be distorted now. Looks like this issue may be related to some core UE4 code for playing the audio and not the decoders.
Here's a potential solution.
I had a terrible lag that got worse as the video progressed. So I tried a different video format. I found that when I switched from H264 MP4 to H265 (HEVC), the audio lag disappeared and everything was nicely synched.
answered Apr 02 '19 at 11:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here