How to display subtitles with VideoPlayer

So after some messing around, I finally managed to get the VideoPlayer class to properly process and display my mp4. The next step is to get subtitles working.

Question 1 - Is there any native support for this at all? I dug through the Video and VideoPlayer code and did some searching online but found nothing at all for it.

Question 2 - Assuming the answer to the above question is “there is no support for it”, how have people done this in the past? Or have people just not done it? I could always embed the subtitles into the video itself but then I’d need to do one video per language which is a lot of wasted space. Seems like the proper way would be to write my own Subtitle class and base string displays off the PlayPosition value of the VideoPlayer.

Question 3 - It’s looking like the VideoPlayer class is pretty limited overall, so I’m considering using Bink Video instead. I’ve used it on almost every game project I’ve done outside of the indie space and it’s always worked pretty well. Curious if anyone has ever used it with MonoGame?

All the systems I have used use bracketed timestamps

So you have a structure

TimeStamp Start;
TimeStamp End;
StringID Text;

Then the string ID goes though localisation and you slip into the deep dark morass of multi-lingual text display.

God I hate German.

“Leutenant Smith, put the kettle on”

turns into

“I need not quite an under captain Schmidt to start the engineering machine that takes water and turns it into hot water and steam”

But with lot’s of none ascii characters.

:smiley:

I have to use bink a lot, on all sorts of platforms, but never on monogame.

I am not sure about the licencing for it, but in the general case Bink just gives you a buffer full of pixels which you have to display yourself.

So it would be easy to do SetData on a Texture2D and then display it.

1 Like

Starting to think Video in games is no longer worth the effort :stuck_out_tongue:

Yes, on one game I worked on we started generating Hi-Def videos for a lot of scenes, but as the project progressed and the renderer got better, dumped the videos.

In fact in the end I think the only videos were the startup screens, legals, and the background for the credits.

1 Like

Thanks @Stainless - sounds like the way to go for this. And I totally hear you about dealing with sentences of vastly different lengths, always a fun time trying to figure out how to make something fit in a space designed for 20 characters when it’s 80.

@MrValentine I think in most cases you’re right. I doubt we’ll be doing a lot in our game for that very reason. We want to do one intro cutscene and then probably one final cutscene at the end of the game. The main reason I’ve found for doing it this way is that I can basically just turn control over to our artist to do whatever camera / visuals / effects he wants and then export me the video without me needing to support him step by step trying to replicate it in-engine.

1 Like

Why not create a scripting system so that they don’t have to :slight_smile:

Im a hobby programmer, the last time I played around with Mono the video class wasn’t functional. (windows project). Has the video class been implemented now?

We actually are using MoonSharp / Lua for all our UI already, but so far I haven’t had much luck getting him to dabble in that either. That is the dream, though!

1 Like

Welcome to the forums!

Yes it does seem to be working, but with a lot of caveats. I had an extremely difficult time finding an exact video format that would work. If you do a search In the forums you’ll see plenty of examples of this. It seems like WMV works better for a lot of people, though I personally was not able to get anything working with this.

I was able to get the video playing with audio and everything correctly by using the VLC Media Player and converting the original mp4 with some very specific options. Those settings and a lot of other really good information can be found in this thread

1 Like