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
Announcements
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.
3042 Discussions

EncodeFrameAsync return MFX_ERR_MORE_DATA until 3rd frame feeded

derek_q_
Beginner
953 Views

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
4 Replies
Anna_B_Intel
Employee
953 Views

Hi Derek,

Please try to set AsyncDepth to 1.

Best wishes,

Anna

0 Kudos
wu_f_
Beginner
953 Views

hi,

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

0 Kudos
bingol__evren
Novice
953 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
Dmitry_E_Intel
Employee
905 Views
0 Kudos
Reply