Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Diederick_H_
Beginner
151 Views

QuickSync with Windows Media Foundation gives E_FAIL when trying to create transform object

Hi, 

I've implemented the INDE SDK and I can encode and decode using  my Intel HD4000 w/o any issues. I'm now trying to use the Windows Media Foundation SDK but creating the IMFTransform object results in a E_FAIL. I iterate the hardware devices which are capable of hw-encoding and I find the Intel device.  I use the activation object to retrieve the CLSID to create the transform object; though this fails. I've also tried to use the activation object directly; none of these solutions work. 

My function (w/o error checks) looks like this:

 

int VideoEncoderWindowsMediaFoundation::findAndActivateHardwareEncoder(IMFTransform** tf, GUID& guid) {

    int r = 0;
    HRESULT hr = S_OK;
    UINT32 flags = 0;
    UINT32 count = 0;
    UINT32 i = 0;
    IMFActivate** result = NULL;
    IMFActivate* activate = NULL;
    IMFActivate* found_activate = NULL;
    MFT_REGISTER_TYPE_INFO info = { MFMediaType_Video, MFVideoFormat_H264 };

    flags |= MFT_ENUM_FLAG_LOCALMFT;
    flags |= MFT_ENUM_FLAG_TRANSCODE_ONLY;
    flags |= MFT_ENUM_FLAG_SYNCMFT;
    flags |= MFT_ENUM_FLAG_ASYNCMFT;
    flags |= MFT_ENUM_FLAG_HARDWARE;

    hr = MFTEnumEx(MFT_CATEGORY_VIDEO_ENCODER, flags, NULL, &info, &result, &count);

    for (i = 0; i < count; ++i) {
      
      activate = result;
      flags = 0;

      hr = activate->GetUINT32(MF_TRANSFORM_FLAGS_Attribute, &flags);
      if (MFT_ENUM_FLAG_HARDWARE == (flags & MFT_ENUM_FLAG_HARDWARE)) {
        SX_DEBUG("Activation Object %u supports hardware encoding.", i);
        found_activate = activate;
        break;
      }
    }

    hr = found_activate->ActivateObject(IID_IMFTransform, (void**)tf);
    if (false == SUCCEEDED(hr)) {
      _com_error err(hr);
      LPCTSTR errmsg = err.ErrorMessage();
      SX_ERROR("Failed to create the transform: %s (%08X)", errmsg, hr);
    }

  }

 

What am I doing wrong? 

Thanks
Diederick

0 Kudos
5 Replies
151 Views

Hi Diederick, 

Can you please share a log from System analyzer tool. Also, confirm if you have latest graphics driver installed on the machine from https://downloadcenter.intel.com/

Thanks,

Diederick_H_
Beginner
151 Views

Hi Harsh, 

Thanks for your reply. I'm not using the very latest drivers, but I'm using drivers that work when I use the INDE sdk to encode/decode H264. Therefore I don't think it's related to the driver, but I'll update the drivers and do another test but I'm pretty sure this is not going to solve this issue. Is there any way to get more information about what might be going wrong? E_FAIL is too generic to figure out what is going wrong.  I've got some thoughts; maybe it's the CLSID which I got from the activator object? Or do I maybe need to register the intel driver for the media foundation in some way? My code is not doing much more then what I pasted earlier so maybe I'm missing some setup code. 

This is the output of the analyzer:

Intel Media SDK System Analyzer (64 bit)


The following versions of Media SDK API are supported by platform/driver:

        Version Target  Supported       Dec     Enc
        1.0     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.0     SW      Yes             X       X
        1.1     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.1     SW      Yes             X       X
        1.3     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.3     SW      Yes             X       X
        1.4     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.4     SW      Yes             X       X
        1.5     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.5     SW      Yes             X       X
        1.6     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.6     SW      Yes             X       X
        1.7     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.7     SW      Yes             X       X
        1.8     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.8     SW      Yes             X       X

Graphics Devices:
        Name                                         Version             State
        NVIDIA GeForce GTX 670                       9.18.13.4411        Active
        Intel(R) HD Graphics 4000                    10.18.10.4176       08

System info:
        CPU:    Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
        OS:     Microsoft Windows 8.1
        Arch:   64-bit

Installed Media SDK packages (be patient...processing takes some time):
        Intel« INDE Media SDK for Windows 6.0.0.388
        Intel« INDE Media SDK for Windows 6.0.0.349

Installed Media SDK DirectShow filters:

Installed Intel Media Foundation Transforms:
  Intel« Hardware M-JPEG Decoder MFT : {00C69F81-0524-48C0-A353-4DD9D54F9A6E}
  Intel« Quick Sync Video H.264 Encoder MFT : {4BE8D3C0-0515-4A37-AD55-E4BAE19AF471}



Analysis complete... [press ENTER]

 

Thanks

 

151 Views

Hi Diederick, 

Thank you for sharing the log. We have had many changes in MediaSDK and also many fixes in drivers since INDE. So, please update to latest MediaSDK package and latest drivers and let me know how the test goes. In meantime, I will investigate further and share updates soon. 

Diederick_H_
Beginner
151 Views

Hi Harsh,

Thanks for your reply. I've just downloaded the Media SDK again. Using this link but I think I already installed it as I get a "Repair" installation option when I execute the installer. Because of this I cannot see where it's installing the SDK (?). Also, when I run the analyzer, I see that I've installed multiple version of the SDK now (see below), though I only see "Media SDK 2016" and not version 7.x.x. If I'm correct, the latest version is 7; but maybe this is the "Media SDK 2016" version.  

Anyway :-) I've installed the latest driver and media sdk and the issue still exists.

 

This is the output of the analzyer:

Intel Media SDK System Analyzer (64 bit)


The following versions of Media SDK API are supported by platform/driver:

        Version Target  Supported       Dec     Enc
        1.0     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.0     SW      Yes             X       X
        1.1     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.1     SW      Yes             X       X
        1.3     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.3     SW      Yes             X       X
        1.4     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.4     SW      Yes             X       X
        1.5     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.5     SW      Yes             X       X
        1.6     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.6     SW      Yes             X       X
        1.7     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.7     SW      Yes             X       X
        1.8     HW      Yes             X       X       [Adapter 1 (via DX11)]
        1.8     SW      Yes             X       X

Graphics Devices:
        Name                                         Version             State
        NVIDIA GeForce GTX 670                       9.18.13.4411        Active
        Intel(R) HD Graphics 4000                    10.18.10.4226       08

System info:
        CPU:    Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
        OS:     Microsoft Windows 8.1
        Arch:   64-bit

Installed Media SDK packages (be patient...processing takes some time):
        Intel« INDE Media SDK for Windows 6.0.0.388
        Intel« Media SDK 2016
        Intel« INDE Media SDK for Windows 6.0.0.349
        Intel« Media SDK Samples 2016

Installed Media SDK DirectShow filters:

Installed Intel Media Foundation Transforms:
  Intel« Hardware M-JPEG Decoder MFT : {00C69F81-0524-48C0-A353-4DD9D54F9A6E}
  Intel« Quick Sync Video H.264 Encoder MFT : {4BE8D3C0-0515-4A37-AD55-E4BAE19AF471}

I've also pasted my source here. It's a very minimal implementation but it may lead to the answer why I'm getting this E_FAIL error.

Thanks.

Diederick

151 Views

Hi Diederick, 

Thank you the updating to latest Media SDK and drivers. I tested the source code attached and the code worked fine on our side and do not see any errors. I also ran few experiments with internal tool to inspect and verify Intel Quick sync Video H.264 Encoder MFT  and results looks good with no error. So, as reproducing the issue on our end is the key to further traige, can you share complete reproducer application package  So, we can further investigate the issue. You can share the package directly with using private message.

Thanks, 

Reply