Can anyone get IMFMediaEngine->TransferVideoFrame() to work with an IWICBitmap? RRS feed

  • Question

  • I've been searching around and seen this question asked in a couple places but never with any reply.

    Working from the media engine sample:


    All I've done is add construction of an IWICBitmap:


    mPiFactory->CreateBitmap(640, 480, GUID_WICPixelFormat24bppBGR, WICBitmapCacheOnDemand, &mWicBitmap)

    and then in OnTimer(), added this above the current TransferVideoFrame:

    m_spMediaEngine->TransferVideoFrame(mWicBitmap.Get(), nullptr, &r, &m_bkgColor);

    but it always fails. I've tried adding the MFVideoNormalizedRect arg (0, 0, 1, 1), but that makes no difference.

    I've tried using different pixel formats for the WICBitmap, which varies the error a little. I.e.,



    give me "One or more arguments are invalid."

    I've tried matching the format that the sample's DX11 texture is created in but


    gives me "No such interface supported."

    Is there something obvious I'm missing here?

    thanks much!

    Sunday, January 17, 2016 7:23 PM


  • I figured it out -- remove this line

                spAttributes->SetUnknown(MF_MEDIA_ENGINE_DXGI_MANAGER, (IUnknown*) m_spDXGIManager.Get())

    when constructing the MediaEngine. The whole decode path now won't use hardware acceleration, so apparently you can't mix hardware decoding with getting the frame data via WIC. Or if you can, I don't know how to do it. So now I guess the question is, is it faster to use DX11 and get any hardware acceleration, but go through an extra copy at the end to get the data, or faster to do this. I'd guess the DX11 path would typically be much faster on most hardware, but that's a question for another day.

    • Marked as answer by hackborn Sunday, January 17, 2016 11:18 PM
    Sunday, January 17, 2016 11:16 PM