Limit Keyframe Size

In my application, I’m streaming 4K video over a lossy transport protocol. Normally this works well, but keyframes end up having such a large bitrate that frequently parts of the compressed video are dropped while being sent to the receiver, resulting in visible corruption.

I’ve set both averageBitRate and maxBitRate to my target bitrate, but when the IDR is created there is still a very large spike in birate, far in excess of what I had requested. Is there any setting to tell the encoder that I want to limit the size of the keyframe?