Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
40 Views

Init returns MFX_ERR_MFX_ERR_INVALID_VIDEO_PARAM after upgrading from Media SDK 2016 to 2019

Jump to solution

Windows 10 Enterprise 2016 LTSB

Intel Core i7-6700

Intel HD Graphics 530 version 25.20.100.6323

I have an application used to encode video using hardware acceleration and H.264. After upgrading my Intel Media SDK from 2016 to the 2019 one, the pEncoder->Init function returns MFX_ERR_MFX_ERR_INVALID_VIDEO_PARAM(-15).  Code below:

Constructor:

m_BitStream.Data = NULL;
m_HeaderBuf.SPSBuffer = NULL;
m_HeaderBuf.PPSBuffer = NULL;
m_VideoParam.ExtParam = NULL;

mfxVersion min_version;
mfxVersion actual_version;
min_version.Major = 1;
min_version.Minor = 0;

mfxStatus sts = m_EncoderSession.Init( MFX_IMPL_HARDWARE, &min_version );
m_EncoderSession.QueryVersion( &actual_version ); // returns 1.27
m_EncoderSession.QueryIMPL( &m_usedImpl ); // returns 514

prepareEncoder function:

bool CompEngine::PrepareCompress()
{
	mfxStatus sts;

	int width = 1024;
	int height = 544;
	int bufferSizeBytes = 12582912;

	m_VideoParam.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
	m_VideoParam.AsyncDepth = 1;
	m_VideoParam.mfx.CodecId = MFX_CODEC_AVC;

	m_VideoParam.mfx.TargetUsage = MFX_TARGETUSAGE_4;
	m_VideoParam.mfx.RateControlMethod = MFX_RATECONTROL_QVBR;

	m_VideoParam.mfx.TargetKbps = 5000;
	m_VideoParam.mfx.InitialDelayInKB = 0;
	m_VideoParam.mfx.MaxKbps = 10000;

	m_VideoParam.NumExtParam = 1;
	m_VideoParam.ExtParam = new mfxExtBuffer *[1]; 		
	m_VideoParam.ExtParam[0] = (mfxExtBuffer*)&m_CodingOptions3Buf;
	memset(&m_CodingOptions3Buf, 0, sizeof(mfxExtCodingOption3));
	m_CodingOptions3Buf.Header.BufferSz = sizeof(mfxExtCodingOption3);
	m_CodingOptions3Buf.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3;
	m_CodingOptions3Buf.QVBRQuality = 18;

	m_VideoParam.mfx.EncodedOrder = 0;
	m_VideoParam.mfx.NumRefFrame = 9;
    	m_VideoParam.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
	m_VideoParam.mfx.FrameInfo.Width = width;
    	m_VideoParam.mfx.FrameInfo.Height = height;

	m_VideoParam.mfx.FrameInfo.CropX = 0;
	m_VideoParam.mfx.FrameInfo.CropY = 0;
	m_VideoParam.mfx.FrameInfo.CropW = width;
	m_VideoParam.mfx.FrameInfo.CropH = height;

	m_VideoParam.mfx.FrameInfo.FrameRateExtN = 30;
	m_VideoParam.mfx.FrameInfo.FrameRateExtD = 1; 
	m_VideoParam.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
	m_VideoParam.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;

	m_VideoParam.mfx.BufferSizeInKB = bufferSizeBytes/1024;
	m_VideoParam.mfx.GopPicSize = 1;
	m_VideoParam.mfx.GopRefDist = 1;
	m_VideoParam.mfx.GopOptFlag = MFX_GOP_STRICT;
	m_VideoParam.mfx.IdrInterval = 1;
	
	// Allocate Bitstream to receive the data	
	memset( &m_BitStream, 0, sizeof(mfxBitstream) );
	m_BitStream.MaxLength = bufferSizeBytes;
	m_BitStream.Data = new unsigned char[bufferSizeBytes];

	// create the encoder
	m_Encoder = new MFXVideoENCODE( m_EncoderSession );
	
	mfxFrameAllocRequest request;
	sts = m_Encoder->QueryIOSurf( &m_VideoParam, &request ); // returns MFX_ERR_NONE
	AllocateSurfacePool( request );

	sts = m_Encoder->Init( &m_VideoParam ); // returns MFX_ERR_INVALID_VIDEO_PARAM

	return true;
}

Can someone please tell me why m_VideoParam is invalid?

0 Kudos

Accepted Solutions
Highlighted
Moderator
40 Views

Hi Ryan,

Sorry for the late response.

Did you try to reproduce this with Media SDK samples?

The other approach you can try is to use system analyzer to check if there is anything run with the new installation. Like this post:

https://software.intel.com/en-us/forums/media/topic/851376

Mark Liu

View solution in original post

0 Kudos
1 Reply
Highlighted
Moderator
41 Views

Hi Ryan,

Sorry for the late response.

Did you try to reproduce this with Media SDK samples?

The other approach you can try is to use system analyzer to check if there is anything run with the new installation. Like this post:

https://software.intel.com/en-us/forums/media/topic/851376

Mark Liu

View solution in original post

0 Kudos