H.264 Encoder and interlacing RRS feed

  • Question

  • I'm trying to output an interlaced MP4 file, but I'm having issues.  


    Here's the code I'm using to set up my video output, minus error-handling and other cruft:


    hr = MFCreateAttributes( &pVideoAttrs, 6 );
    hr = pVideoAttrs->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264);
    hr = MFSetAttributeRatio(pVideoAttrs, MF_MT_FRAME_RATE, 30000, 1001);
    hr = MFSetAttributeSize(pVideoAttrs, MF_MT_FRAME_SIZE, 720, 480);
    hr = MFSetAttributeRatio(pVideoAttrs, MF_MT_PIXEL_ASPECT_RATIO, 10, 11);
    hr = pVideoAttrs->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_FieldInterleavedUpperFirst);
    hr = pVideoAttrs->SetUINT32(MF_MT_AVG_BITRATE, (UINT32)(2000000));
    hr = pVideoAttrs->SetUINT32(MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_Base);
    hr = m_pProfile->SetVideoAttributes( pVideoAttrs );
    hr = m_pMediaSession->SetTopology(0, m_pTopology);
      hr = m_pMediaSession->GetEvent(...);
        // decode message, discover 0xc00d36b4 (MF_E_INVALIDMEDIATYPE)

    The code is mostly adapted from the encoding sample.


    My code works perfectly and I get nicely-rendered files, but only if I render a progressive file.  The docs ( for the H.264 encoder indicate that it supports MF_MT_INTERLACE_MODE.  Are there other properties I need to set in order to successfully render the file with interlacing?

    Thursday, January 20, 2011 7:34 PM


  • How are you setting up the rest of your topology?  The H264 encoder supports the MF_MT_INTERLACE_MODE, but it does not actually interlace the video for you.  Thus, the input format on the encoder must include the MF_MT_INTERLACE_MODE attribute as well.  Unless the source content is interlaced -- and interlaced in the same manner -- some sort of interlacing MFT would be needed.  MF does not have such an MFT natively, so you would need to find or write one.  We generally do not put too much effort into supporting the generation of interlaced content, since most(+++) displays are progressive scan anyway.
    • Marked as answer by Art_99999 Wednesday, March 30, 2011 12:50 PM
    Wednesday, January 26, 2011 1:28 AM