0
votes

I am writing an application above a camera driver, I am using IMFSourceReader in a synchronized way to extract IMFSamples from the driver. I am able to config the SourceReader media types of each stream and generate sample in 2 video formats that my camera driver supports, NV12 and YUY2. What I want is a video format that I can display easily like RGB, so I was looking for a MFT that can convert these media types, but I am not sure I can connect it to the SourceReader, as I understood from media foundation documentation I see that the IMFSourceReader can load a decoder but a decoder is not a converter…

I was wondering what is the best way to convert a video source output media type to a different media type like RGB (beside doing the conversion by myself), while still using IMFSourceReader?

1

1 Answers

1
votes

On Windows 8 you can set the MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING attribute to get GPU accelerated YUV to RGB conversion.

On earlier versions of Windows you can use DXVA2 with D3D9 and just use IDirect3DDevice9::StretchRect() to copy between your YUV surface to an RGB surface. This will do the conversion during the copy, if the graphics driver supports this. You should call ID3D9::CheckDeviceFormatConversion() to check the the driver supports the color conversion that you're doing before relying on this though.