I use MFX_RATECONTROL_QVBR in the SDK demo of sample_encode and have a question:
m_pmfxENC->Init(&m_mfxEncParams)error code is MFX_ERR_INVALID_VIDEO_PARAM
Do I need other initial parameters?
My initial parameters as follow:
mfxStatus CEncodingPipeline::InitMfxEncParams(sInputParams *pInParams)
{
m_MfxEncParams.mfx->FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
m_MfxEncParams.mfx->RateControlMethod = MFX_RATECONTROL_QVBR;
m_MfxEncParams.mfx->TargetKbps = 1000;
m_MfxEncParams.mfx->CodecId = MFX_CODEC_AVC;
m_MfxEncParams.mfx->FrameInfo.FrameRateExtN = 30;
m_MfxEncParams.mfx->FrameInfo.FrameRateExtD = 1;
m_MfxEncParams.mfx->EncodedOrder = 0;
m_MfxEncParams.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
m_MfxEncParams.mfx->FrameInfo.FourCC = MFX_FOURCC_NV12;
m_MfxEncParams.mfx->FrameInfo.ChromaFormat= MFX_CHROMAFORMAT_YUV420;
m_MfxEncParams.mfx->FrameInfo.Width = 1280;
m_MfxEncParams.mfx->FrameInfo.Height = 720;
m_MfxEncParams.mfx->FrameInfo.CropX = 0;
m_MfxEncParams.mfx->FrameInfo.CropY = 0;
m_MfxEncParams.mfx->FrameInfo.CropW = 1280;
m_MfxEncParams.mfx->FrameInfo.CropH = 720;
if( m_MfxEncParams.mfx->RateControlMethod == MFX_RATECONTROL_QVBR )
{
MSDK_ZERO_MEMORY(m_CodingOption3);
m_CodingOption3.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3;
m_CodingOption3.Header.BufferSz = sizeof(m_CodingOption3);
m_CodingOption3.QVBRQuality = 30;
m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption3);
}
if (!m_EncExtParams.empty())
{
m_MfxEncParams.ExtParam = &m_EncExtParams[0];
m_MfxEncParams.NumExtParam = (mfxU16)m_EncExtParams.size();
}
m_MfxEncParams.AsyncDepth = pInParams->nAsyncDepth;
return MFX_ERR_NONE;
}