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.
3056 Discussions

How to set "I Frame Interval" in Media SDK H264 Encoder Dshow filter?

lonely_hearts_club
564 Views
I have set


m_EncoderParams.ps_control.GopPicSize = 50;

m_EncoderParams.ps_control.GopRefDist = 0;

But the I Frame Interval was still 256.
It seems that no matter what value I set to GopPicSize,the I Frame Interval remains constant(=256).
What went wrong?



My parameters setting was like this:

void CH264EncVideoFilter::SetDefaultParams(void)

{

m_EncoderParams.level_idc = Params::LL_AUTOSELECT;

m_EncoderParams.profile_idc = Params::PF_AUTOSELECT;

m_EncoderParams.pc_control = Params::PC_FRAME;

m_EncoderParams.ps_control.GopPicSize = 50;

m_EncoderParams.ps_control.GopRefDist = 0;

m_EncoderParams.ps_control.NumSlice = 0; // autoselect

m_EncoderParams.rc_control.rc_method = IConfigureVideoEncoder::Params::RCControl::RC_VBR;

m_EncoderParams.rc_control.bitrate = 0;

m_EncoderParams.target_usage = MFX_TARGETUSAGE_BALANCED;

m_EncoderParams.preset = CodecPreset::PRESET_USER_DEFINED;

m_EncoderParams.frame_control.width = 0;

m_EncoderParams.frame_control.height = 0;

}




later,I found out that

CH264EncVideoFilter::CH264EncVideoFilter(TCHAR* tszName, LPUNKNOWN punk, HRESULT* phr) :

CEncVideoFilter(tszName, punk, FILTER_GUID, phr)

{

m_bstrFilterName = FILTER_NAME;

m_mfxParamsVideo.mfx.CodecId = MFX_CODEC_AVC;

//fill m_EncoderParams with default values

SetDefaultParams();

// Fill m_EncoderParams with values from registry if available,

// otherwise write current m_EncoderParams values to registry

// ReadParamsFromRegistry();

CopyEncoderToMFXParams(&m_EncoderParams, &m_mfxParamsVideo);

AlignFrameSizes(&m_mfxParamsVPP.vpp.Out, (mfxU16)m_EncoderParams.frame_control.width, (mfxU16)m_EncoderParams.frame_control.height);

}



ReadParamsFromRegistry() function Fill m_EncoderParams with values from registry, so I just simply cancled this statement, GraphEdit says "This graph can't play(return code:0x80004005)


(Version 3.0.774.38156)
-Patrick

0 Kudos
1 Solution
Petter_L_Intel
Employee
564 Views
Hi again,

let me add some clarification to avoid potential confusion. The suggestion I gave works for the case when preset is used (such as PRESET_BALANCED).

But if you do not want to use a preset then you can set preset to PRESET_USER_DEFINED and in that case the parameter values you set will be applied even without the suggested code change.

Regards,
Petter

View solution in original post

0 Kudos
4 Replies
lonely_hearts_club
564 Views
I finally found out that RCControl should set to CBR. Does it mean that I cannot use the VBR capability if i want to set I frame interval myself?
0 Kudos
Petter_L_Intel
Employee
564 Views
Hi,

The Media SDK DShow samples are unfortunately not perfectly suited for direct manipulation of parameters. Feel free to modify the sample code to fit your needs.

But to quickly get around the issue I suggest you remove the "CodecPreset::VParamsFromPreset()" call located at the end of the function "CopyEncoderToMFXParams" in "mfx_video_enc_filter_utils.cpp". This small change will let you set the parameter values using the SetParam() function.

Regards,
Petter
0 Kudos
lonely_hearts_club
564 Views
Thanks for you suggestion!!
0 Kudos
Petter_L_Intel
Employee
565 Views
Hi again,

let me add some clarification to avoid potential confusion. The suggestion I gave works for the case when preset is used (such as PRESET_BALANCED).

But if you do not want to use a preset then you can set preset to PRESET_USER_DEFINED and in that case the parameter values you set will be applied even without the suggested code change.

Regards,
Petter
0 Kudos
Reply