--- libavcodec/nvenc.c.orig	2019-08-05 22:52:21.000000000 +0200
+++ libavcodec/nvenc.c	2019-09-08 19:41:32.162180966 +0200
@@ -1860,8 +1860,11 @@
         tmpoutsurf->input_surface = NULL;
     }
 
+    avctx->coded_frame->key_frame = 0;
+
     switch (lock_params.pictureType) {
     case NV_ENC_PIC_TYPE_IDR:
+        avctx->coded_frame->key_frame = 1;
         pkt->flags |= AV_PKT_FLAG_KEY;
     case NV_ENC_PIC_TYPE_I:
         pict_type = AV_PICTURE_TYPE_I;
