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.

simple_3_encode, MFXVideoCORE_SyncOperation failing with MFX_ERR_DEVICE_FAILED

Milen_Y_
Beginner
443 Views
Hi,
 
I'm using the sample simple_3_encode from http://software.intel.com/sites/default/files/mediasdk-tutorials-0.0.3.zip
The sample is compiled with VS 2015 in Release|Win32 mode. The input file is uncompressed YUV: https://bitbucket.org/myordanovps/qsvsamples/downloads/352x240.7z
 
I run a BAT file with the following code:
 
-----------
:loop_start
simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264 && GOTO loop_start
-----------
 
The simple_encode.exe runs about 5 - 500 times successfully and then MFXVideoCORE_SyncOperation() fails with MFX_ERR_DEVICE_FAILED:
 
The test machine is i7-4770K, 32GB RAM, Windows 10 Pro 64bit, driver 15.40.10.64.4300. It also has NVIDIA GTX 960 and NVIDIA Quadro K600.
 
Here is my command prompt log:
-------------------------------------------
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>run_test.bat
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 3644
Execution time: 3.59 s (1013.70 fps)
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 3644
Execution time: 3.55 s (1026.90 fps)
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 3644
Execution time: 3.74 s (975.18 fps)
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 3644
Execution time: 3.59 s (1016.45 fps)
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 3644
Execution time: 3.57 s (1021.92 fps)
 
E:\tmp\mediasdk-tutorials-0.0.3\_build\Win32\Release>simple_encode.exe -g 352x240 -b 300 -f 25/1 352x240.yuv out.h264   && GOTO loop_start
Frame number: 1635
 Device operation failure. src\simple_encode.cpp 223
-------------------------------------------
0 Kudos
3 Replies
Surbhi_M_Intel
Employee
443 Views

Hi Milen, 

Thanks for sharing the issue, MFX_ERR_DEVICE_FAILED generally comes when there is a failure in hardware acceleration, regarding the setup - any particular reason you are using simple_3_encode instead of simple_3_encode_vmem, making use of d3d9 and d3d11 implementation or use sample_encode and use hw acceleration?
Do you see this issue without the discrete graphics card connected? this will might help to narrow down the issue

Thanks,
Surbhi

 

0 Kudos
Milen_Y_
Beginner
443 Views
Hi Surbhi,
 
Today I did some tests. The results are:
1) simple_3_encode runs OK if the monitor is connected to Intel HD Adapter. NVIDIA GTX 960 is present on the machine.
2) simple_3_encode fails with MFX_ERR_DEVICE_FAILED if the monitor is connected NVIDIA GTX 960.
3) simple_3_encode_vmem (DX11) runs OK if the monitor is connected NVIDIA GTX 960.
 
I'm using the code from the sample in my app. I'm using the simple_3_encode instead of simple_3_encode_vmem because its source code is simpler.
I'm going to switch from simple_3_encode to simple_3_encode_vmem because it does not fail with MFX_ERR_DEVICE_FAILED. Also the test file 352x240 runs about 40% faster with simple_3_encode_vmem (1000FPS vs 1400FPS).
 
Thanks,
Milen
0 Kudos
Surbhi_M_Intel
Employee
443 Views

Hi Milen, 

Thanks for doing more experiments and providing detailed analysis. Let me try to explain the reason of the failure and probably you can match with your experiment - 
1) simple_3_encode runs OK if the monitor is connected to Intel HD Adapter. NVIDIA GTX 960 is present on the machine.
2) simple_3_encode fails with MFX_ERR_DEVICE_FAILED if the monitor is connected NVIDIA GTX 960.

In simple_3_encode, default implementation is AUTO_ANY, which choose the default implementation i.e. via d3d9 unless you specifically choose sw. There is a known limitation in MSDK - In the presence of discrete graphics card and using d3d9 implementation, the monitor needs to be connected to Intel graphics device. So you see failure in second case.

3) simple_3_encode_vmem (DX11) runs OK if the monitor is connected NVIDIA GTX 960.
Above limitation is applicable to d3d9 and not applicable to d3d11. 

Since your system supports d3d11 implementation, I will recommend to use the performance goodness of d3d11 instead of using d3d9. If you are doing single stream encode, I would recommend you to check async depth parameter which tells number of asynchronous pipeline to run before calling sync operation. Async depth = 4 or 5, results in better performance, you can find more details in this article 
https://software.intel.com/en-us/articles/aync-and-join-operation-in-media-sdk-multi-transcoding and code details from simple_3_encode_vmem_async tutorial. 

Thanks,
Surbhi

 

0 Kudos
Reply