I’m projecting a large MediaPlayer Texture onto a sphere for a VR 360 experience. I realize that the Media Player asset is still under development and a bit buggy but after some experimenting I’ve gotten some decent results.
Sometimes when I play the level, the video loads fine and I get decent frame rates (usually if I’ve been using the background video a few times and after restarting the editor). However, if I switch out the background video or change the video and go back to the old one my frame rates can drop down to single digits!
I assume that the times the video loads fine it is loaded into the memory buffer and being accessed more quickly. My question is, is it possible to force the media texture to load to memory before the level plays? Currently I have no load screen, but would prefer having one and allowing the video to buffer rather than starting out with a poor frame rate. Is there a node or something I’m missing that will let me load a video to memory before playing?
I’m using 4.12.5 and developing for Oculus DK2. Let me know if you need any more info, but this seems like more of a general question than a specific problem.
Thanks!
There will be a pre-cache option in 4.13 for selected platforms, including Windows. However, I wonder if the low frame rate doesn’t indicate some other problem. Are you accidentally playing more than one video at a time? Could anything else be slowing down your I/O or CPU?
Currently I am manually pausing all media players in the content browser before playing and the background video is started on EventBeginPlay so I believe it should be the only video playing. As far as other things affecting playback, I don’t think there was anything different during the times it was working versus the times where the frame rate is so low. If I play the same scene with the video paused, the frame rate shoots up to 100+.
Your BP looks OK. If you have multiple MediaPlayers, make sure that none of the others are playing. In 4.12 and before, there is an option to AutoPlay. Make sure it is turned off. Usually, when users have performance problems like this, it is because media players are happily decoding multiple videos in the background without them knowing.
The AutoPlay option has been removed for 4.13.
Is it possible AutoPlay has already been removed in 4.12.5? I’ve seen it mentioned in forums and documentation but it doesn’t appear to be on my MediaPlayers.
Also, as far as video playback, do you know if I should be monitoring GPU or CPU usage while playtesting?
You’re right, I might have removed it in 4.12 already.
What are the dimensions and frame rate of your video?
The video is 3840x1920 at 23fps. I know it’s big, but it seems like it plays OK sometimes (usually between 25 and 60 fps) andother times never gets past 5 fps!
It looks like you were right the first time around in a way! So I had a few versions of the background video (that were definitely paused in the Media Player and were not placed in the level), and after deleting them the framerate jumped up to almost 70!
So it looks like media in your content browser, even if it’s not playing in the media player, is somehow impacting performance while the level is running.
Do you know if this is a bug or if there is a potential fix? I’m currently working on one level with one BG video, but I’ll be implementing different levels with different BG videos and it’ll be a pain if videos that are not present in that level are impacting performance this much.
Well, it’s not a bug, but more of a very bad workflow.
In 4.13 I changed it so you won’t accidentally play videos. In particular…
- Any open media player editors will stop playback when PIE/SIE starts
- In the game, playback has to be started explicitly via BP
- When PIE/SIE ends, all players are stopped and reset
Hopefully, with those changes, the user is in full control over what plays when.
Since 4.13 still seems a ways off, is there a quick fix for my current project?
I have multiple levels, each with their own video. With the current workflow, can I keep the videos that are not playing at the time from impacting the performance? They’re all paused in their respective MediaPlayers so I don’t understand why they still have an impact. Does it have something to do with closed VS open instead of playing VS paused?
Thanks for your work on this. I’m excited to see the changes in 4.13!
If they are not playing then they should not have an impact (other than consuming memory). If your frame rate goes down, it means that some other movies are probably playing.
@gmpreussner
There will be a pre-cache option in 4.13 for selected platforms, including Windows.
Is mobile included or just desktop computers/high power consoles?
Thank you.
It depends on whether the native player API supports opening byte streams (which most don’t, unfortunately). It is currently supported in VlcMedia, PS4Media, WmfMedia, and MfMedia.(when it is finished).