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

EncodeFrameAsync return MFX_ERR_MORE_DATA until 3rd frame feeded

Hi,

  I use ffmpeg with libmfx enabled for real time H264 encoding, the encoding frame rate is good, but there is about 400ms~500ms latency. 

  I finally found out that latency is causing by EncodeFrameAsync not return encoded frame immediately until the 7th frame feeded.

  I try to set the async_depth to 0(default is 4), then the latency drop to about 160ms ~ 260ms, and EncodeFrameAsync will output frames when 3rd frame feeded now.

  I wonder to know if there has way the let the EncodeFrameAsync output frame immediately when the first frame feeded, it will be great for real time H264 encoding.

0 Kudos
3 Replies
Highlighted
Employee
38 Views

Hi Derek,

Please try to set AsyncDepth to 1.

Best wishes,

Anna

0 Kudos
Highlighted
Beginner
38 Views

hi,

I have try to set AsyncDepth to 1, but no use.  Is any other params to set?

0 Kudos
Highlighted
Beginner
38 Views

 

I am having exact the same issue. 

I am not trying to encode a file content .I am trying to encoder real time data. The EncodeFrameAsync call executes 4 times before it returns NO error.  
async_depth is set to 1;


I only have 1 surface as I do one frame at a time ? Any suggestions. 

This is what the setup looks like. 

Params_in.mfx.CodecId = MFX_CODEC_HEVC;
Params_in.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED;
Params_in.mfx.GopPicSize = 60;
//Params_in.mfx.TargetKbps = 8000;
Params_in.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
 
Params_in.mfx.BufferSizeInKB = 129;
Params_in.mfx.TargetKbps = 129;
Params_in.mfx.FrameInfo.FrameRateExtN = 30;
Params_in.mfx.FrameInfo.FrameRateExtD = 1;
 
Params_in.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
Params_in.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
Params_in.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
Params_in.mfx.FrameInfo.CropX = 0;
Params_in.mfx.FrameInfo.CropY = 0;
 
Params_in.mfx.EncodedOrder = 0;
Params_in.mfx.CodecProfile = 0;
Params_in.mfx.CodecLevel = 0;
Params_in.mfx.NumSlice = 0;
Params_in.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
Params_in.mfx.FrameInfo.Width = MSDK_ALIGN16(m_Width);
Params_in.mfx.FrameInfo.Height = (MFX_PICSTRUCT_PROGRESSIVE == Params_in.mfx.FrameInfo.PicStruct) ?
MSDK_ALIGN16(m_Height) : MSDK_ALIGN32(m_Height);
Params_in.mfx.FrameInfo.CropW = m_Width;
Params_in.mfx.FrameInfo.CropH = m_Height;
Params_in.AsyncDepth = 1;

 

 

Thanks


 

0 Kudos