locked
SinkWriter->WriteSample() fails with MF_E_UNEXPECTED after 3rd sample when using hardware encoder RRS feed

  • Question

  • I have a sample application that creates an rgb24 sample, color converts it to nv12 using the ColorConvert transform, and then writes the sample 1000 times (same sample over and over) to a SinkWriter, to produce a valid h264 encoded mp4 file.

    As long as I use a software encoder it works fine, when I enable hardware

    swConf->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, TRUE);

    it processes to first 3 samples ok, but the 4th sinkWriter->WriteSample() returns MF_E_UNEXPECTED.

    Are there any additional steps/flags I have to watch when using hardware transforms?

    I have an Windows 7, i7 with Intel QuickSync MFT.


    Tuesday, May 22, 2018 1:56 PM

All replies

  • Presumably there is a problem with your encoder input, which encoder does not recognize until you start sending actual samples/frames. As the error is being triggered on a worker thread, you have it bounced back to you after you have a few frames submitted.

    You need to look at your samples closer and guess (including with the help of MFTrace or otherwise; possibly trying to feed that to the encoder directly) what might be not acceptable for the encoder.


    http://alax.info/blog/tag/directshow

    Tuesday, May 22, 2018 3:40 PM
  • Presumably there is a problem with your encoder input, which encoder does not recognize until you start sending actual samples/frames. As the error is being triggered on a worker thread, you have it bounced back to you after you have a few frames submitted.

    You need to look at your samples closer and guess (including with the help of MFTrace or otherwise; possibly trying to feed that to the encoder directly) what might be not acceptable for the encoder.


    I tried MFTrace.exe , but the behaviour of my app changes ... it then fails to load the hardware transform(some merit error?) and uses the software encoder, and everything works.

    The sample creation stays the same however, I create an rgb sample (single frame, all green), feed it into the ColorConvert transform to convert to an nv12 sample, and feed those nv12 samples into the SinkWriter.

    Wednesday, May 23, 2018 10:16 AM