Solution for playing videos on Linux?

So I’ve been searching for some time trying to port my XNA game to linux, everything runs nice and smoothly and the last thing there is to port are the videos which I use at the end of every stage. But after some research ir appears that the VideoPlayer class wan’t implemented yet on the DesktopGL version.

I’ve hear that there is a way to use SDL2 to play videos but couldn’t find anything about it anywhere.

So, is there a solution to play videos on the Linux platform?

1 Like

Hi Rafael,
I had the same need a few months ago and I got video working in Linux with MonoGame 3.5.1 by adding TheoraPlay, Video and VideoPlayer classes as suggested:
Here:


And here:

Then I just had to install libtheora0, convert the videos using ex: VLC and then load the video file with MonoGame.

Those files don’t work with MonoGame 3.6 as they are because some GL functions changed.
If it helps I can upload a working sample of what was working for me… :slight_smile:

Thanks for your reply, sampereira, a while back I’ve read those posts about adding TheoraPlay to the project, it were just a week later after I’ve updated the project to 3.6, I had no idea that it weren’t working because I was on version that version.

The problem is that I working on I’m planing to add the Penumbra light engine to to the game, and it requires the version 3.6. (Krypton is giving me a headache)

Still, I would LOVE could upload a working sample, if it works I’ll definitely come back to 3.5.1 again.

Here is the sample game with video working in Linux:

I remember you that the video needs to be encoded with Theora.
I’ve used VLC to convert my videos.

I’ve precompiled MonoGame 3.5.1 with the changes to include it with the sample game, so you can just open the game project and run it.
The video used in the game is from the TheoraTestSuite. You can get more from here: https://wiki.xiph.org/TheoraTestsuite

If you prefer to compile MonoGame with this change for yourself:

  1. Clone MonoGame 3.5.1 from the repository
  2. Generate the solution with Protobuild
  3. Open MonoGame.Framework.Linux.sln and under Media create a new directory Xiph
  4. Add the 3 files included in MonoGameLinuxVideoTheora/src/Media/Xiph
  5. Compile it and use it in your project

The credits should go to the FNA maintainer flibitijibibo and termoventilador for the other topics about this.

I tried it with MonoGame 3.6 but it only works if you comment #define VIDEOPLAYER_OPENGL in both Video.cs and VideoPlayer.cs so it uses the TheoraPlay software converter and avoids all the GL. mess… but it’s a lot slower…

Maybe someone more experienced than me can give some help with the missing OpenGL functions…

Hope this helps you in some way :wink:

Dunno whats going on but i got the video player to work on windows with dx and in the crossplatform no one told me it wasn’t supposed to work before i tried it.

@Rafael_Bringel did you get this working?

My above post was in error so to avoid any confusion.
It only worked on windows as it’s only implemented for dx right now.
I had just used a mis-named (prefixed gl) test project.

Hey there @sampereira, Rafael here.

I did get it working commenting #define VIDEOPLAYER_OPENGL and I can’t thank you enough as for today I have a release candidate for my linux port. But I have another question for you, now that the linux port is almost over, the Mac port begins, and I can’t find the .dylib version of the dll, do I have to compile my own?
Do yo happen to have the .dylib version too?