Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools from Intel. This includes Intel® oneAPI Video Processing Library and Intel® Media SDK.

Re encode I-Frame

Oh_i_
Beginner
135 Views

Hi all,

I'm using the H.264 video encoder with the following parameters:

CodecId = MFX_CODEC_AVC;
TargetUsage = MFX_TARGETUSAGE_BALANCED;
TargetKbps = 10000;
RateControlMethod = MFX_RATECONTROL_VBR;
if(RateControlMethod == MFX_RATECONTROL_VBR)
{
MAXKbps = 11000;
InitialDelayInKB = 10000;
}
if(RateControlMethod == MFX_RATECONTROL_AVBR)
{
Accuracy = 10;
Convergence = 10;
}

FramRateExtN = 25;
FramRateExtD = 1;
FourCC = MFX_FOURCC_NV12;
ChromaFromat = MFX_CHROMAFORMAT_YUV420;
PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
Width = 192;
Height = 1080;
GopPicSize = 25;
GopRefDist = 1;
IdrInterval = 0;
CodecProfile = MFX_PROFILE_AVC_MAIN;
CodecLevel = 50;
IOPattern = MFX_IOPATTERN_INSYSTEM_MEMORY;
GopOptFlag = MFX_GOP_STRICT|MFX_GOP_CLOSED;

now I'm trying to re-encode I-frame, with the same input frame using the following:

m_encCtrl.FrameType = MFX_FRAMETYPE_I|MFX_FRAMETYPE_IDR

I expected the output will be the same, but! it is not! sometimes bigger, sometimes smaller, no consistency!

To make it clear:

1. Grab fram #F

2. Encode #F frame as I-frame (received stream with size of X)

3. Re-encode #F frame forcing I-frame (received stream with size of Y ???, should be X!!)

anyone?

Thanks

0 Kudos
1 Reply
Anthony_P_Intel
Employee
135 Views

Hi,

If I'm understanding your question correctly, i believe your answer lies in the method that Variable Bit Rate is maintained (AVBR or VBR encoding).  When encoder is setup to attempt an target bitrate (in your case 10 Mbits) and a GopPicSize of 25, indicating expected I frame frequency, then encoder can expect to spend one amount of bits on first (IDR) frame assuming the rest of the bits are spread on remaining frames (expecting B and P frames to require less bits to maintain quality), but when new/forced I Frame is requested early, the number of bits already used in the sequence have to be taken into account if 10Mbps target bitrate is to be maintained.

Reply