I would like to know whether the current frame is a key frame in the encoding process.
How do you know?
I have noticed that the H.264 encoder doesn't handle the transition from a still scene to a fast motion scene very well. In particular, the encoder doesn't send an IDR frame when we go to a fast motion scene and this results in one of two behaviors:
1) In CBR/VBR: You see a lot of artifacting and it looks very bad
2) In AVBR: The video looks good, however, at the point of transition to fast motion, the encoder generates several very large P frames (this is a problem for us since we are streaming)
It seems to me that when the transition to fast motion happens the encoder should simply generate an IDR frame. It looks like it is trying to follow the GOP size very strictly and only issues an IDR frame at the beginning of the next GOP. I'm using 150 for GOP size, GopRefDist of 1 and IdrInternval of 0; and I'm not setting the MFX_GOP_STRICT flag.
Any help would be appreciated.
Currently the SDK does not support automatic I-frame insertion.
But - if you go back to the message thread, the issue can be traced back to controlling bitrates when streaming (especially when the scene change is big). If you are looking at similar issues and a solution, this information may help you:
The CBR and VBR methods would not adhere to the required bitrate to conform to HDR during big scene changes, thus resulting in occasional spikes in encoded frame sizes. Since then, the SDK has been trying to add more bitrate control methods for different use cases, and one such method is Look Ahead. You can find more information about it here - https://software.intel.com/en-us/articles/common-bitrate-control-methods-in-intel-media-sdk
Quoting from the article - " It distributes available bit budget between frames to produce the best possible encoding quality. This method is not a HRD compliant. It generates good results on the complex data such as fast motion video, computer generated sequences."
ALSO - Can you please share any high scene change video you may be using for your development? We could use customer provided videos as test cases, which will be helpful to both.
If you do the following:
sts = m_pmfxENC-> EncodeFrameAsync (NULL, & m_pEncSurfaces [nEncSurfIdx], & pCurrentTask-> mfxBS, & pCurrentTask-> EncSyncP);
How do I know if I am on the current frame is a key frame?
Or Do I know from another function?