MFT Encoder (h264) High CPU utilization

前端 未结 1 1970
栀梦
栀梦 2021-01-14 18:22

I am able successfully to encode the data by H264 using Media Foundation Transform (MFT) but unfortunately I got a very high CPU(when I comment in the program the calling of

相关标签:
1条回答
  • The first key is to ensure you have configured the sink with MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS. I also set the MF_LOW_LATENCY attribute.

    // error checking omitted for brevity
    hr = attributes->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, TRUE);
    hr = attributes->SetUINT32(MF_SINK_WRITER_DISABLE_THROTTLING, TRUE);
    hr = attributes->SetUINT32(MF_LOW_LATENCY, TRUE);
    

    The other key is to ensure you are selecting the native format for the output of the source. Otherwise, you will remain very disappointed. I describe this in detail here.

    I should also mention that you should consider creating the transform sample and memory buffer once at the beginning, instead of recreating them on each sample received.

    Good luck. I hope this helps.

    0 讨论(0)
提交回复
热议问题