DirectX (in C# with SlimDX) and ffmepg

Started by
1 comment, last by xDarkice 12 years, 1 month ago
Hello,

I have a C++ DLL which uses ffmepg to read a video. When it gets a picture, I transmit AVFrame (and put it to RGB24 format with sws_scale) to C# code thanks to a callback.
I try to display this picture with DirectX (Texture texture = Texture.FromMemory(..) ). When I convert the AVFrame to bmp, it's working but the image loses alpha canal. I would like use directly AVFrame->data[0] but DirectX do not know how manage it !

Is someone knowning how to display an AVFrame in DirectX ?
I would like to display keyframe and the others frame.
Advertisement
It's hard to tell you what you're doing wrong without seeing any code. What's the code you're using for converting it to a bmp, and what code are you using to try and create a texture? Are you getting error codes back or just funny looking textures?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Converting to PNG would do the job, but you will end up having performance issues. Instead of using Texture.FromMemory() which requires the texture already being in a right format, you should try to lock the texture and fill it with the raw data. You could take a look at my Direct3D rendering implementation which is at Github.

This topic is closed to new replies.

Advertisement