member "FrameType" in mfxEncodeCtrl Structure

member "FrameType" in mfxEncodeCtrl Structure

Hi there,
I have some questions about the mfxEncodeCtrl Structrue.

The reference manual says that the member "FrameType" is just short for "Encoding frame type".
Is that a field for write or read? If for write,that means I can (or must) specify the type of every frame by myself? or just to enforce the frame type change when I need?

Other way, if for read,couldI know what frame type the current frame is? where should I got current frame type if not?

Questions seem unsystematic, butappreciate for any device.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Joyah,

Your application is expected to fillthis field with the desired frametype. Providing the structure to the MFXVideoENCODE_EncodeFrameAsync() call is optional, and you only need to provide the structure if you want to overwrite the general encoding parameters that have been setup for the session.

In the MSDK 2012 R2 Reference manual, please look at the description for MFXVideoENCODE_EncodeFrameAsync call, as wellasthe structure definition.

"In the case of encoded ordering the mfxEncodeCtrl structure must specify the explicit frame type. In the case of display ordering, this function handles frame order shuffling according to the GOP structure parameters specified during initialization."


"If the encoder works in the encoded order, the application must specify the frame type. If the encoder works in the display order, only key frames are enforceable."

In other words, if you do not have a reason to overwrite the encoding parameters, provide a NULL instead of the mfxEncodeCtrl sturcture to the MFXVideoENCODE_EncodeFrameAsync call.


Hi Tony,
Thanks for your answer. There's still one question, that how to get the current frame type (I, P or B)?

Hi Joyah,

When encoding is configured and a GOP pattern is specified, the frames will be encoded with the pattern unless 'pre-frame' mfxEncodeCtrl is used to overwrite the pattern. Your application could keep track of frames being encoded and known the frametype for each encode request.

If you know the frame number, and the GOP pattern paramters, you can use an algorithm like the one shown in the MSDK Reference Manual in the section desribing the mfxInfoMFX sturcture (Example 11).



When I am forcing encoder (h264) to give out I-Frame by setting 
mfxEncCtrlParam.FrameType = MFX_FRAMETYPE_I  or 
mfxEncCtrlParam.FrameType = MFX_FRAMETYPE_IDR
My application is getting crashed during "SyncOperation". I am using Medis SDK 2017-R2 on Cent-OS 7.2.  PFB Back-Trace

#0  0x00007fb8f8d4f900 in ?? () from /opt/intel/mediasdk/lib64/
#1  0x00007fb8f684d043 in ?? () from /opt/intel/mediasdk/lib64/
#2  0x00007fb8f68279a1 in ?? () from /opt/intel/mediasdk/lib64/
#3  0x00007fb8f6858171 in ?? () from /opt/intel/mediasdk/lib64/
#4  0x00007fb8f5105593 in CmDevice_RT::OSALExtensionExecution(unsigned int, void*, unsigned int, void**, unsigned int) ()
   from /opt/intel/common/mdf/lib64/
#5  0x00007fb8f5108646 in CmSurfaceManager::DestroySurface2DUMD(CmSurface2D*&) ()
   from /opt/intel/common/mdf/lib64/
#6  0x00007fb8f51086ac in CmSurfaceManager::DestroySurface(CmSurface2D*&) () from /opt/intel/common/mdf/lib64/
#7  0x00007fb8fceac44a in ?? () from /opt/intel/mediasdk/lib64/
#8  0x00007fb8fceacb65 in ?? () from /opt/intel/mediasdk/lib64/
#9  0x00007fb8fcde2eff in ?? () from /opt/intel/mediasdk/lib64/
#10 0x00007fb8fce538f7 in ?? () from /opt/intel/mediasdk/lib64/
#11 0x00007fb901482dc5 in start_thread () from /lib64/
#12 0x00007fb90058321d in clone () from /lib64/


Please help me resolving this Issue.



Hi Akash,

How do you manage mfxEncCtrlParam object ? Do you fill the structure with zero's and set only FrameType ? Can you reproduce the crash if you apply your change to force IDR via FrameType to sample_encode or one of MediaSDK  tutorial samples? 



Leave a Comment

Please sign in to add a comment. Not a member? Join today