Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

H264 Encoding fails with D3D11 Memory

Ramashankar
New Contributor III
3,328 Views

Hi,

I am running Sample_Encode.exe for encoding a yuv file into h264, but this application is always failing if run with -d3d11 option.

It works fine with D3D9 video memory and System memory, but fail with D3D11 memory (failing in hardware device init). So is it any know issue or limitation in IMSDK h264 encoder implementation?

My environment details are as following:

IMSDK version: 6.0.0.349
Sample decode version: 6.0.0.49
OS: Windows 8.1
Graphics Card: Intel(R) HD Graphics 4400 with driver version 10.18.14.4170

System analyzer info and screen shot of command and error are attached.

0 Kudos
1 Solution
Jiandong_Z_Intel
Employee
3,328 Views

Hi Ramashankar,

It looks like we need some changes on sample_encode source.

Can you try following patch for sample_encode ? Please rebuild sample_encode after apply the patch.

diff --git a/pipeline_encode.cpp b/pipeline_encode.cpp
index bd4fc69..f7b4c06 100644
--- a/pipeline_encode.cpp
+++ b/pipeline_encode.cpp
@@ -492,7 +492,7 @@ mfxStatus CEncodingPipeline::CreateHWDevice()
         return MFX_ERR_MEMORY_ALLOC;
 
     sts = m_hwdev->Init(
-        window,
+        NULL,
         0,
         MSDKAdapter::GetNumber(m_mfxSession));
     MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

Let me know if this patch works for you.

Thanks

Zachary

 

 

View solution in original post

0 Kudos
16 Replies
Jiandong_Z_Intel
Employee
3,329 Views

Hi Ramashankar,

It looks like your graphic driver is an old one.

You can download and install the most new driver 15.36.26.4294 from https://downloadcenter.intel.com/product/81497/Intel-HD-Graphics-4400-for-4th-Generation-Intel-Core-Processors

For you command line test -d3d11, It looks like -hw parameter should be add to command line.

Thanks

Zachary

0 Kudos
Ramashankar
New Contributor III
3,329 Views

Hi Zachary,

Thanks for your reply.

Regarding missing -hw parameter, I was assuming that by default encoder will always run in hw acceleration mode only, until I mention "-sw" flag explicitly. Is it not so? Anyway, I run it again with -hw flag explicitly but result is same. Encoding is getting failed with d3d11 memory with current version of driver.

Let me check the behaviour with latest driver version also. I am downloading it now and will update you with result. 

Thanks.

0 Kudos
Ramashankar
New Contributor III
3,329 Views

Hi Zachary,

I tested this issue with latest driver (version 10.18.14.4294). There is some good news and some bad too.

H264 HW encoding started working with d3d11 memory now after driver update, but if the encoding is getting aborted (i.e. not a proper termination) then next time it never run successfully with d3d11 memory again, until I reboot the system. After reboot it again starts working fine till any next abnormal termination. However this is not the same behaviour with d3d9 memory or system memory.

As per my requirement, my encoder application may get terminated abnormally most of the time, so i need this support in my app.

I am attaching following logs/snapshot for your reference:

1. D3D11_Error.jpg: contains normal termination, then abort, and then error scenario

2. D3D9_OK.jpg: contains normal termination, then abort and then still OK scenario

3. tracer.log : tracer log during error scenario with d3d11 memory

4. sys_analyzer.txt : updated system analyzer log

Please let me know if you need any further information on this issue.

Thanks.

0 Kudos
Jiandong_Z_Intel
Employee
3,329 Views

Hi Ramashankar,

It looks like we need some changes on sample_encode source.

Can you try following patch for sample_encode ? Please rebuild sample_encode after apply the patch.

diff --git a/pipeline_encode.cpp b/pipeline_encode.cpp
index bd4fc69..f7b4c06 100644
--- a/pipeline_encode.cpp
+++ b/pipeline_encode.cpp
@@ -492,7 +492,7 @@ mfxStatus CEncodingPipeline::CreateHWDevice()
         return MFX_ERR_MEMORY_ALLOC;
 
     sts = m_hwdev->Init(
-        window,
+        NULL,
         0,
         MSDKAdapter::GetNumber(m_mfxSession));
     MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

Let me know if this patch works for you.

Thanks

Zachary

 

 

0 Kudos
Ramashankar
New Contributor III
3,329 Views

Hi Zachary,

Thanks for your patch. Yes, it worked fine for me.

So what I am concluding here is if there is no need of rendering then we should pass this window as NULL. Is it correct?

Thanks.

0 Kudos
Jiandong_Z_Intel
Employee
3,330 Views

Hi Ramashankar,

Yes, I think you are right if no need of rendering.

But when we read functions CDecodingPipeline::CreateHWDevice() in pipeline_decode.cpp in sample_decode source , we can found following code -

mfxStatus CDecodingPipeline::CreateHWDevice()
{
    HWND window = NULL;
   
    ....

    if (render) {
        window = (D3D11_MEMORY == m_memType) ? NULL : m_d3dRender.GetWindowHandle();
    }

    ...

 sts = m_hwdev->Init(
        window,
        render ? (m_bIsMVC ? 2 : 1) : 0,
        MSDKAdapter::GetNumber(m_mfxSession));
    MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

    ....

}

Maybe the code "window = (D3D11_MEMORY == m_memType) ? NULL : m_d3dRender.GetWindowHandle();" can told us something.

But you still can use sample_decode to have a try.

 

Best Regards,

Zachary

 

0 Kudos
Ramashankar
New Contributor III
3,330 Views

Hi Zachary,

Thanks for the further explanation. I will explore sample_decode code also in this regard. 

As my issue has been resolved, so you can close this thread now.

Thanks.

0 Kudos
Mohajer__Matt
Beginner
3,330 Views

I used "simple_encode_d3d" from VideoWatcher, it runs perfectly with d3d9 but fails with d3d11 on MFXVideoENCODE::Query (returns -2)

I have the the latest driver on my machine and my machine is running Windows 7, after I read this article I figured I should try Windows 8 or 10, so I installed windows 10 and got the latest driver which is newer than the latest driver on Windows 7 , the sample runs without any issue

so I think there is an issue in the driver side in Windows 7

I need to run the hardware encoder on d3d11 because I need to use opencl's new simultaneous extension to bind to both OpenGL and DirectX simultaneously, so far I made the changes in Windows 10 and get the h264 stream out of OpenGL output in a sample project but our product currently runs only on Windows 7 and I need this issue to be fixed

Thanks

Mahdi

Developer at NewTek

0 Kudos
Mohajer__Matt
Beginner
3,330 Views

this issue is only on Windows 7, try it on Windows 10, there must be an issue in the driver side, I explained in a post further down

0 Kudos
Harshdeep_B_Intel
3,330 Views

Hi Mahdi,

I think issue you are seeing is bit different from original post on the thread. The main difference here in your scenario is Direct X version usage vs supported Windows OS version. If you are interested in running application on Win7, then you can use dx9 implementation. DX11 implementation is available from Windows 8 and the use of MediaSDK with Direct3D11 requires Direct3D 11.1, which is only available when running Windows 8 and above. So, to use and run d3d11 implementation consider product update to Win8+, as it is very much preferred to use DX11, since DX9 have numerous limitations.

Thanks,

 

0 Kudos
Ramashankar
New Contributor III
3,330 Views

Hi Harsh,

I have one small doubt, with respect to minimum OS version requirement for Dirext11 support.

In media sdk release note, Intel mentions the software requirements as:

"For Microsoft DirectX* 11 functionality - Microsoft Windows 8.1, Microsoft Windows 10 Preview"

But in SDK's sample code, for enabling D3D11 support it checks for minimum OS version as "_WIN32_WINNT_WIN8" which is Windows 8.0 i believe and not the 8.1. Is this understanding correct?

If so, then what is actual minimum OS requirements for using D3D11 support? Is it Windows8.0 or Windows8.1?

~

Thanks.

0 Kudos
Harshdeep_B_Intel
3,330 Views

Hi Ramashankar,

Windows 8.0 provides D3D11.1 support and Windows 8.1 adds D3D11.2 support. As, I mentioned above - running MediaSDK in d3d11 scenario requires minimum Direct3D 11.1 support. Hence, yes, you guessed correctly. Minimum OS requirements for D3D11 support is Windows 8.0. But, few limitations in D3D11.1 were addressed in D3D11.2 release which is available only from Windows 8.1 onwards. I do see the confusion due to documentation here and hopefully will be addressed with next release.

Thanks,

 

0 Kudos
Ramashankar
New Contributor III
3,330 Views

Hi Harsh,
Thanks for the clarification.
Actually in my application, I had implemented a check for using d3d11 memory only from Windows8.1 onwards, considering the system requirement mentioned in media sdk release note. So now, as per your clarification, I think it is safe to include Windows 8.0 also for d3d11 memory usage. Correct?

Thanks,

 

0 Kudos
Ramashankar
New Contributor III
3,330 Views

one more point to add here for the clarification:

 => But, few limitations in D3D11.1 were addressed in D3D11.2 release which is available only from Windows 8.1 onwards

=> So now, as per your clarification, I think it is safe to include Windows 8.0 also for d3d11 memory usage. Correct?

I am using h264 encode & decode along with vpp for color format conversion and screen capture feature in my custom application. So I assume these features may not be having any such issue/limitation when using D3D11.1 also. Is it correct?

0 Kudos
Harshdeep_B_Intel
3,330 Views

Hello Ramashankar,

Let me answer your questions one by one, so we do not miss any.

 I think it is safe to include Windows 8.0 also for d3d11 memory usage. Correct? -> Yes, as, I mentioned above Windows 8.0 provides d3d11 support. 

So I assume these features may not be having any such issue/limitation when using D3D11.1 also. Is it correct? Yes, your feature scenarios are supported with D3D11.1 and we do not expect any such issue/limitation for your pipeline specifically when running on Win 8.0 machine. 

For further questions, please consider starting a new thread as it will be easier for us to track and respond.

Thanks,

0 Kudos
Ramashankar
New Contributor III
3,330 Views
Hi Harsh, Thanks for resolving all my doubts and queries. I have no more queries in this regard, so you can close this thread. Thanks,
0 Kudos
Reply