I'm using the Intel Media SDK to encode H264 video. When I use MFXVideoENCODE_QueryIOSurf() to retrieve the number of suggested video frames, the resulting mfxFrameAllocRequest.NumFrameSuggested is 1. I'm encoding at 60fps and although it works in most cases, though sometimes I receive a MFX_WRN_IN_EXECUTION result from MFXVideoCORE_SyncOperation. I can solve this by allocating more surfaces. Though how do I determine how many surfaces I need to allocated when the NumFrameSuggested is not enough?
In this case, you can manage and delegate memory management to the application. Please take a look at "Memory Allocation and External allocators" section in MSDK manual. Also, confirm if you are using latest graphics driver available at https://downloadcenter.intel.com/. Hope this was the information you were looking for.
MSDK recommends you minimal required working surfaces number to execute your designated pipeline successfully without hangs. If your pipeline involve decoder – it requires to keep reference frames and reconstructed frames in reorder buffer to satisfy Profile@Level requirements to DPB. Same for encoder – it needs keep reconstructed references and original pictures. Asynchronous pipeline requires extra surfaces to perform multiple operations simultaneously. When you have allocated less than minimal you may hit to bad situation when pipeline to be short in surfaces. So this MSDK functionality to provide you a hint which amount to start from.
It is really up to you to increase allocation count as many as you wish – up to memory limit.
I guess your encoding in high resolution at high bitrate for I frames only – so it is quite slow and you face warning in execution. You are challenging hardware performance bounds with your workload. Adding more working surfaces help you solving speed disbalance of I/O and coding parts
JFYI, here is manual https://software.intel.com/sites/default/files/mediasdk-man.pdf