Media Player video seqance with no delay?

Hi,

I want to play a sequence of videos or image seqances in UE. I’m using Media Player and Playlist. I’m a beginner, so I apologise if I missed something obvious in my approach.

The Project is to display video/image sequence on a static mesh. You press Enter to start playback of Video 1. If player don’t do anything, then once Video 1 finishes Video 2 will start. However if player press Input Key “3” during playback of Video 1, than Video 3 will start after Video 1 ends.

Once I get this 100% working there will more videos to be included for longer experience.

My BluePrint so far:

Current issues:

  1. If I use mp4 videos than there is a short break between videos. It is essential that as soon as one video finish, than next one starts, so currently I can’t use it. I have Prechache File tickbox checked in video files.
    Same thing is visible here (Using Media Playlists | Unreal Engine Documentation)
    Andrew Hurley created some Media Player Template Project, unfortunately is not available any more.

  2. When I use image sequence (JPG or PNG) with lowres Proxy Override (960x540) this works, but when I use actual 4k images, then sequence don’t appear at all.

  3. At the moment I don’t know how to check the actual duration of video, so rather than that I made sure videos are 10 seconds long and I used 10 seconds delay.

  4. Is there away to have multiple MediaPlayers with different media to start exactly at the same time (it doesn’t need to be 4k). Right now when I try to start 3 of them with Key Input but they all start with delay to each other.

I’m on UE 4.18.1.

Thanks
Ace

If I use mp4 videos than there is a short break between videos

There is no built-in support for playing multiple videos seamlessly right now. The decoders will need some time to load and decode the beginning of a video, so the only way to make this work is to start decoding the next video ahead of time. Some media APIs, such as WMF, have support for this, but we haven’t implemented it, and I can’t say whether it will be implemented anytime soon or ever. You can emulate this behavior yourself by creating multiple players, start playback and then pause them right away. Then continue playback when their time comes, and switch over the MediaTexture to pull frames from the new player.

When I use image sequence (JPG or PNG) with lowres Proxy Override (960x540) this works

Image sequences have the advantage that there is very little overhead for decoding them. This also makes them much bigger than compressed video containers, such as MP4.

but when I use actual 4k images, then sequence don’t appear at all

JPG, PNG and BMP use our legacy image loader in UE4, which is extremely slow. For 4k plates in particular you’re going to see substantial slowdowns. They won’t play in real-time. If you want fast image sequences at high resolutions, you should use EXR instead, because we use a multi-threaded and highly optimized EXR reader. You will still need a computer with very high memory bandwidth. Needless to say, these kinds videos will also take an awful lot of room on your hard drive. Either way, for fast accurate video playback, EXRs are your best bet.

At the moment I don’t know how to check the actual duration of video

You cannot get the duration of videos unless they are opened in a media player. Once the media is opened, you can use MediaPlayer.GetDuration.

Is there away to have multiple MediaPlayers with different media to start exactly at the same time

There is no good way to do this right now. You’ll have to open the media in each player, then call Pause. If you’re lucky, this will prefetch the first few frames. Then, after some delay, you call Play on all players. You can also try Seek. In 4.18 there is a new callback called OnSeekCompleted that will notify when the seek operation is complete. You can wait for all players to be done, then call Play.

We are currently working on integration Media Framework with Sequencer. Sequencer will then take care of things like precaching and synchronizing multiple players.

Thank you for the explanation gmpreussner.

For some reason if I use EXR (even low res ones) it crashes UE. For now I’m just using low res JPG. This seams to be working.

Also is there a way to change fps playback of img media source? Once they are imported they appear in Media Player as 24fps. I tried using ‘Set Rate’ node, but I’m not sure does it work.

In case someone stumble on this: changing FPS inside Plugins - IMG Media, did not affect fps of Img Media Sequences for me. However inside of each Img Media Sequence there is a setting ‘Frame Per Second Override’ that you can adjust.

I’m still trying to find a reason why EXR are crashing Unreal for me.

I’m still trying to find a reason why EXR are crashing Unreal for me.

What is the callstack? Can you email me a few frames of your EXR sequence, so I can look at them? Thanks!

I’ve tried the seek solution with a media player and .wav audio. I bound to OnMediaOpened and OnSeekCompleted events. I waited for the OnMediaOpened event, and then did a seek(0), which returned true, and then waited for the OnSeekCompleted, which was never called. Calling seek(0) later did indeed trigger the event, so I must assume that the initial seek(0) I called erroneously returned true (should have been false).