Force all frames as I-Frame

I am trying to encode each frame as an I-Frame. The purpose of this is to capture Instant Replay and store in a .avi container. The problem is that Initial two frames are not appearing in the bitstream. The third frame type = IDR and the rest of the frames type is I. The nvStatus of nvEncEncodePicture is NV_ENC_SUCCESS for every frame. Still initial two frames are nil. I am unable to understand where the things are going wrong.
Following are the parameters that have set.

  1. Codec GUID = NV_ENC_CODEC_H264_GUID
  2. Preset GUID = NV_ENC_PRESET_DEFAULT_GUID
  3. Profile GUID = NV_ENC_H264_PROFILE_MAIN_GUID
  4. goplength = 1
  5. frameIntervalP = 0
  6. enablePTD = 0
  7. idrPeriod = NVENC_INFINITE_GOPLENGTH (To avoid any IDR frame insertion)
  8. pictureType = NV_ENC_PIC_TYPE_I
  9. encodePicFlags = NV_ENC_PIC_FLAG_FORCEINTRA ( for every frame)
  10. encodePicFlags = (NV_ENC_PIC_FLAG_OUTPUT_SPSPPS | NV_ENC_PIC_FLAG_FORCEINTRA) (for the first frame only)
  11. refPicFlag = 1 (for the first frame only, 0 for remaining frame)
  12. displayPOCSyntax = IframCnt (Incremental)
  13. frameIdx = IframCnt (Incremental)
  14. rateControlMode = NV_ENC_PARAMS_RC_CONSTQP