diff --git a/vpx/src/svc_encodeframe.c b/vpx/src/svc_encodeframe.c
index 76aacd2f455a6bb8fa886c22e43fdbcdbe57c8e3..38c2d26e0e6fb2eb5ff360317d00b0ca6b6ea279 100644
--- a/vpx/src/svc_encodeframe.c
+++ b/vpx/src/svc_encodeframe.c
@@ -1000,8 +1000,10 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
               (int)si->frame_size, (int)pts);
     }
   }
-  ++si->frame_within_gop;
-  ++si->encode_frame_count;
+  if (rawimg != NULL) {
+    ++si->frame_within_gop;
+    ++si->encode_frame_count;
+  }
 
   return VPX_CODEC_OK;
 }