MFXVideoENCODE_EncodeFrameAsync is returning MFX_ERR_NOT_ENOUGH_BUFFER. But querying video parameters using following code returns the same size again as was returned by MFXVideoENCODE_Init.
memset(¶m, 0, sizeof(mfxVideoParam));
status = MFXVideoENCODE_GetVideoParam(priv->session, ¶m);
if (status != MFX_ERR_NONE)
printf("new size = %d\n", param.mfx.BufferSizeInKB) --> This returns the same size as was returned after init of encoder.
and hence call to MFXVideoENCODE_EncodeFrameAsync is always failing after few frames when this happens.
I am using version 1.16
This error means that the buffer size is too small for the output bitstream from the encoder.
Did you convert from kilobytes to bytes, i.e.
mfxBS.MaxLength = par.mfx.BufferSizeInKB * 1000?
Also, as long as the buffer is significantly larger than the largest frame generated you can use your own buffer size. Does this error go away if you increase buffer size to a few MB?
Can you replicate this behavior with the samples or tutorials?