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.

MFXVideoCORE_SyncOperation returns MFX_ERR_UNDEFINED_BEHAVIOR

Naresh_B_
Beginner
875 Views

Hi,

I am working on an application which will use hardware accelerator to encode input frames in x264 compressing.

My application working fine with all windows versions like 7,8,10. But my problem is, I recently upgraded to windows10 and I got some driver updates and my application stops working. I debugged my code and I found MFXVideoCORE_SyncOperation returning MFX_ERR_UNDEFINED_BEHAVIOR which was work fine priviously(without windows10 update).

I followed intel SDK API reference manual to handle all my operations with accelerator and my application loading intel sdk version1.13.

I am very confused whether the problem with my application or driver updates.

Please help me in this.

0 Kudos
5 Replies
Harshdeep_B_Intel
875 Views

Hi Naresh,

I will be happy to help you resolve this issue. But, I will need following details to better understand you system environment and pipeline:

1) We have latest SDK API 1.17 support available. Please check and upgrade to latest graphics drivers form https://downloadcenter.intel.com/ and to latest MSDK API: https://software.intel.com/en-us/media-sdk 

2) Share your system details and attach a log from system analyzer tool

3) You mentioned ("intel SDK API reference manual to handle all my operations with accelerator and my application"), can you share reproducer of your application and you can use MediaSDK samples https://software.intel.com/sites/default/files/MediaSamples_Windows_6.0.0.68.msi? Specifically, sample_encode app which includes complete HW encoding pipeline. This will help us understand  MSDK parameters your are setting and scenario in your application. 

Thanks, 

0 Kudos
Naresh_B_
Beginner
875 Views

Hi Harsh,

Thanks for your quick response.

1). As you suggested, I updated my SDKAPI to 1.17(but i am building my application with old headers and libs and runtime its loading 1.17 version API). Still  i am seeing same issue.

2). And below one is mediasdk_system_analyzer log

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

        Version Target  Supported       Dec     Enc
        1.0     HW      Yes             X       X
        1.0     SW      No
        1.1     HW      Yes             X       X
        1.1     SW      No
        1.3     HW      Yes             X       X
        1.3     SW      No
        1.4     HW      Yes             X       X
        1.4     SW      No
        1.5     HW      Yes             X       X
        1.5     SW      No
        1.6     HW      Yes             X       X
        1.6     SW      No
        1.7     HW      Yes             X       X
        1.7     SW      No
        1.8     HW      Yes             X       X
        1.8     SW      No

Graphics Devices:
        Name                                         Version             State
        Intel(R) HD Graphics 4600                    20.19.15.4331       Active

System info:
        CPU:    Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
        OS:     Microsoft Windows 10 Pro
        Arch:   64-bit

Installed Media SDK packages (be patient...processing takes some time):

Installed Media SDK DirectShow filters:

Installed Intel Media Foundation Transforms:
  Intel« Hardware M-JPEG Decoder MFT : {00C69F81-0524-48C0-A353-4DD9D54F9A6E}
  Intel« Hardware VP9 Sync Decoder MFT : {07AB4BD2-1979-4FCD-A697-DF9AD15B34FE}
  Intel« Hardware VP9 Decoder MFT : {0C69E30B-A112-4A86-B496-35120CD745D5}
  Intel« Hardware VP8 Sync Decoder MFT : {451E3CB7-2622-4BA5-8E1D-44B3C41D0924}
  Intel« Hardware VP8 Decoder MFT : {6D856398-834E-4A89-8EE5-071BB3F58BE4}
  Intel« Quick Sync Video H.264 Encoder MFT : {4BE8D3C0-0515-4A37-AD55-E4BAE19AF471}

3). I downloaded sample_encode app binary and tried with that .exe encoding is happening properly(is there any C version of samples).

Now my doubt, is there any problem with my encoder configuration?

But same configuration works for me before without any issue.

Below is my encoder configuration.

    videoParam.mfx.CodecId = MFX_CODEC_AVC;
    videoParam.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED;
    videoParam.mfx.TargetKbps = enc->bitrate / 1024; //(enc->bitrate/1000 * GST_ROUND_DOWN_16(GST_VIDEO_INFO_WIDTH (info) *      GST_ROUND_DOWN_16(GST_VIDEO_INFO_HEIGHT (info) ) /(1920*1088)));
    videoParam.mfx.MaxKbps = videoParam.mfx.TargetKbps;//(enc->bitrate*3)/(2*1000); //videoParam.mfx.TargetKbps *3/2;
    videoParam.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
    videoParam.mfx.FrameInfo.FrameRateExtN = enc->framerate;// info->fps_n; /**< not taking updated framerate; as the bitrate is set assuming 30 fps */
    videoParam.mfx.FrameInfo.FrameRateExtD = 1;// info->fps_d;
    videoParam.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
    videoParam.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
    videoParam.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
    videoParam.mfx.FrameInfo.CropX = 0;
    videoParam.mfx.FrameInfo.CropY = 0;
    videoParam.mfx.FrameInfo.CropW = (GST_VIDEO_INFO_WIDTH(info));
    videoParam.mfx.FrameInfo.CropH = (GST_VIDEO_INFO_HEIGHT(info));
    videoParam.mfx.FrameInfo.Width = (GST_VIDEO_INFO_WIDTH(info));
    videoParam.mfx.FrameInfo.Height = (GST_VIDEO_INFO_HEIGHT(info));

    videoParam.mfx.CodecProfile = MFX_PROFILE_AVC_CONSTRAINED_BASELINE;

    enc->bufsize = (guint)(GST_VIDEO_INFO_SIZE(info) + 1027);

    //enc->videoParam.IOPattern =  MFX_IOPATTERN_IN_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY ;
    videoParam.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
    videoParam.mfx.IdrInterval = 0; /** == 0, all I-frames are IDR */
    videoParam.mfx.NumRefFrame = 2; /** number of reference frames */
    if (nKeyFrameInterval <= 0)
        nKeyFrameInterval = enc->keyint;   
    videoParam.mfx.GopPicSize = nKeyFrameInterval;//enc->keyint; /**< number of pictures in one GOP; == 1, only I-frames */
    videoParam.mfx.GopRefDist = 1; /**< == 1; no B-frames; its the distance between I/P key frames */
    /** BufferSizeInKB represents the maximum possible size of any compressed frames */
    //videoParam.mfx.BufferSizeInKB = (enc->bufsize / 1024) + 1; 
    //videoParam.mfx.BufferSizeInKB = (enc->bufsize / 1024) + 1;
    //videoParam.mfx.BRCParamMultiplier = 1;
    /**  */
    //videoParam.mfx.InitialDelayInKB = (((((enc->bitrate) / 8)) / (1024)) / 4);

    status = MFXVideoENCODE_Query(enc->session, &videoParam, &enc->videoParam);   

    if (status != MFX_ERR_NONE)
    {
        LOGE("error in Query\n");
#if 1
        /** reset the harmless and required fields of
        *  Query output videoParam */
        enc->videoParam.mfx.IdrInterval = 1; /** ==1, all I-frames are IDR */
        enc->videoParam.mfx.NumRefFrame = 2; /** number of reference frames */
        enc->videoParam.mfx.GopPicSize = enc->keyint; /**< number of pictures in one GOP; == 1, only I-frames */
        enc->videoParam.mfx.GopRefDist = 1; /**< == 1; no B-frames; its the distance between I/P key frames */
#endif
    }

status = MFXVideoENCODE_Init(enc->session, &enc->videoParam);

0 Kudos
Harshdeep_B_Intel
875 Views

Hi Naresh, 

Thank you for sharing logs and requested details. I do not see any issue with your encoder configuration and also MFX_ERR_UNDEFINED_BEHAVIOR is not one of the expected return status from MFXVideoCORE_SyncOperation ( Refer MSDK Manual, Page No.44 https://software.intel.com/sites/default/files/managed/47/49/mediasdk-man.pdf). I am assuming return code is not specifically from sync function. 

For Q(3) I downloaded sample_encode app binary and tried with that .exe encoding is happening properly(is there any C version of samples). Now my doubt, is there any problem with my encoder configuration? But same configuration works for me before without any issue. -> As, sample_encode app is working, so issue is at application layer and not a driver issue. Here is a link tutorials (https://software.intel.com/sites/default/files/mediasdk-tutorials-0.0.3.zip) which are simplified version of samples in C.  Please take a look at simple_3_encode and specifically session handling in the tutorial. Please check and confirm in your application if you are handling sessions correctly. If yes, please share a reproducer using either tutorial or sample, so we could reproduce this issue and help triage further. You might also be interested in taking a look at this article : https://software.intel.com/en-us/articles/framework-for-developing-applications-using-media-sdk. ;

Thanks,  

0 Kudos
Naresh_B_
Beginner
875 Views
Hi Harsh, Thank you for your support. Mediasdk-tutorial-0.0.3 helps me a lot to resolve my issue. Issue solved.
0 Kudos
Harshdeep_B_Intel
875 Views

Hi Naresh, 

Glad, you have resolved the issue. I will go ahead an close this thread. Please start a new thread on forum, if any further questions. 

Thanks, 

0 Kudos
Reply