Hi everyone, I’m using media texture and media player to show some offline rendered videos in Unreal Engine(with 3D scenes behind the media texture). And I enchanted some problems:
Let’s say that the video is 30fps;
If the framerate is below 30fps when playing the video(let’s say 20fps), the result will be somewhat laggy(so I tried to move the camera to somewhere where the rendering payload is relatively low before playing video);
After trying the hack described in above(let’s say the framerate is about 40fps), there are still laggy moments(enabling VSync will ease but never kill that laggy).
Another test is about the Windows Media Player. Using PresentMon.exe to sample statistics when playing the same video, the average fps matches the fps of the video. And the video plays quiet smoothly.
So here are my questions:
Could 1% low fps affects the smoothness of video player in Unreal Engine?
Could the sync settings affects the smoothness of video player in Unreal Engine? (game thread/rendering thread/rhi thread/gpu/swap chain)
If there are settings, how do I config them when playing videos?
It would be helpful if anyone knows anything about this. Many thanks!
Hi agine. I’ve tested the following settings when playing the video(my monitor refresh rate is 60FPS and the video is 30FPS):
Turn on VSync with r.VSync=1
Setting the game thread sync type with r.GTSyncType=2
Setting the RHI sync interval with rhi.SyncInterval=2
Setting rhi.SyncSlackMS=5
So after applying the above settings, the experience is quite smooth. However there is another problem:
The video is in looping mode(not the automatic looping but close-before-reopen looping)
There are still laggy moments(loops)
Lets say loops [m, m+n] are smooth, then there will be loops (m+n, m+n+k] that will be laggy(where n >= 1 and k >=1). This pattern is quite obvious because you can feel the transition from smooth loop to laggy loop(and from laggy loop to smooth loop likewise).
Another information I’d like to share is that when using “stat media“, you can see that the “Electra decoder async job“ doubled in laggy loops than smooth loops. The source code says that “Electra decoder async job“ is mainly copy buffers around(maybe from IMF2DBuffer to ID3D12Resource).
That will be much helpful if anyone knows anything about how to solve this problem. Many Thanks!