Video Playback


21-02-2012 20:11:22

Hi guys,

I have been working on a game engine for some time now and one major feature that it's currently lacking is video playback. I can use libvlc and the RenderWindow's handle to display fullscreen videos (splash screens, cutscenes) but I can't use it on a texture. All topics I found in this forum, are either very old or completely dead-end. I already tried converting to SWF and playing it with Makarui but I got 1. no sound and 2. no material (seems to be null?). Could somebody point me in the right direction (existing library, TheoraVideoPlugin with Mogre, writing an ExternalTextureSource)?

Thanks for your help.


23-02-2012 20:14:38

I found a way to use AForge.Video.FFMPEG to render a video into bitmaps. I use this function to convert it into an Texture:

private static unsafe void ConvertBitmapToTexture(Bitmap image, string textureName, Size size)
int width = size.Width;
int height = size.Height;
using (ResourcePtr rpt = TextureManager.Singleton.GetByName(textureName))
using (TexturePtr texture = rpt)
HardwarePixelBufferSharedPtr texBuffer = texture.GetBuffer();
PixelBox pb = texBuffer.CurrentLock;

BitmapData data = image.LockBits(new System.Drawing.Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
CopyMemory(, data.Scan0, width * height * 4);

catch (Exception)

But, this makes the application unresponsible after rendering about 2~3 frames. BTW, the image is given to the game code using events, is that a performance issue? I don't think this code is actually the big issue cause I have taken it from ... Texture.cs.


04-03-2012 18:40:39

I wanted to point to the webcam demo of user smiley80, but you still found it.
Unfortunately I have no further idea. (I never tried to do something similar.)

Perhaps you can search/ask in the Ogre main forum.
It's not .NET, but perhaps they have ideas, which further techniques are possible.
Also you could search/ask in the Axiom forum.
Axiom is a port of Ogre to pure C#. If they have a solution for your needs, you have a good chance to do the same with your Mogre application.


05-03-2012 18:26:29

I think my current problem is converting the pixel formats between the Bitmaps I get from AForge and the Mogre Texture stuff. I also need to check whether my class design is fast enough. If I get something useful, I'll post it here.


05-03-2012 19:05:36

The Bitmap --> Texture conversion is a general question (not much Mogre specific.)
So you have good chances when you search/ask in the Ogre main forum. There are much more people than in our small sub cummunity.

Yes, if you find a solution, it would be nice to hear about.