Convert image formats from webcam RRS feed

  • Question

  • Hi

    I've been using the MFCaptureToFile Sample (http://msdn.microsoft.com/en-us/library/windows/desktop/ee663604(v=vs.85).aspx) to get video frames from a webcam and passing them to a video encoder (WebM which requires YV12 image format). My webcam, however, only provides RGB24 or YUY2 images so I need to convert these to YV12. I can, of course, do it myself with my own conversion algorithms, but I'd prefer to use OS-calls since these can make use of hardware devices to do the conversion.

    I've looked at MFTEnumEx to see if it has a way to convert but it gives errors to pretty much any format I insert. He's what I've been trying to do:
        MFT_REGISTER_TYPE_INFO inputFilter = { MFMediaType_Video, MFVideoFormat_RGB24  };
        MFT_REGISTER_TYPE_INFO outputFilter = { MFMediaType_Video, MFVideoFormat_YV12  };
        UINT32      cDevices;
        IMFActivate **ppActivaters = NULL;
        hr = MFTEnumEx(MFT_CATEGORY_VIDEO_DECODER, unFlags, &inputFilter, &outputFilter, &ppActivaters, &cDevices);
        assert(cDevices > 0);
    Doesn't Media Foundation provide a way to convert image formats from video devices? 

    -- Bjoern

    Kind regards Bjoern

    Sunday, December 29, 2013 12:06 PM

All replies

  • Hello.

    Read about color converter : Color Converter.

    Perhaps it helps. You'll have to insert it between capture and encoder.

    PS: this is strange for me that a video encoder needs YV12 image format...

    Monday, January 6, 2014 11:29 PM