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
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

Actual bitrate is roughly half of desired bitrate when using MFX_RATECONTROL_CBR


 I am having troubles getting a bitrate that is close to my desired bitrate.  I am using Constate Bitrate Control at 700 kbps with a frame rate of 30 fps.  I keep track of the encoded frame size by looking at the mfxBitStream datalength property, multiplying by 8 to get bits and dividing by num seconds of encoding to attempt to calculate the bitrate.  I seem to consistently calculate a bitrate of 1/2 of the TargetKbps.  Does anything look out of place for my encoder parameters?  Thanks!

// set up encoder parameters
encoderParameters = new mfxVideoParam();
memset(encoderParameters, 0, sizeof(encoderParameters));

encoderParameters->mfx.CodecId = MFX_CODEC_AVC;
encoderParameters->mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED;
encoderParameters->mfx.TargetKbps = 700;
encoderParameters->mfx.RateControlMethod = MFX_RATECONTROL_CBR; 
encoderParameters->mfx.FrameInfo.FrameRateExtN = 30;
encoderParameters->mfx.FrameInfo.FrameRateExtD = 1;
encoderParameters->mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
encoderParameters->mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
encoderParameters->mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
encoderParameters->mfx.FrameInfo.CropX = 0; 
encoderParameters->mfx.FrameInfo.CropY = 0;
encoderParameters->mfx.FrameInfo.CropW = 640;
encoderParameters->mfx.FrameInfo.CropH = 360;

encoderParameters->mfx.CodecProfile = MFX_PROFILE_AVC_BASELINE;
encoderParameters->mfx.CodecLevel = MFX_LEVEL_AVC_3;
encoderParameters->mfx.GopPicSize = 30;
encoderParameters->mfx.GopRefDist = 1;
encoderParameters->mfx.GopOptFlag = MFX_GOP_CLOSED;

encoderParameters->mfx.FrameInfo.Width  = MSDK_ALIGN16(width);
encoderParameters->mfx.FrameInfo.Height = (MFX_PICSTRUCT_PROGRESSIVE == encoderParameters->mfx.FrameInfo.PicStruct)?
            MSDK_ALIGN16(height) : MSDK_ALIGN32(height);

encoderParameters->IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;

0 Kudos
2 Replies

Hi Zach,

I did some quick tests here with the same config and I observe the actual bitrate of the encoded stream very close to the specified rate.

You may get some average rate discrepancy if your input is of very static nature. What type of content are you encoding?

Are you using HW or SW encode? Also what driver version and Media SDK version are you using?


0 Kudos

I was using SW encoding on version 1.7.  I just upgraded and seem to be experiencing the same issue.  I tried to encode a video with a lot of motion and still experienced the same result.  I will try to encode with one of the sample projects and report my results.

0 Kudos