diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c
index fc36b5f..71156af 100644
--- a/ext/vp8/gstvp8enc.c
+++ b/ext/vp8/gstvp8enc.c
@@ -990,6 +990,9 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
       encoder->keyframe_distance++;
     }
 
+    encoder->last_invisible_ts = encoder->last_timestamp + 1;
+    GST_BUFFER_TIMESTAMP (buf) = encoder->last_timestamp + 1;
+    GST_BUFFER_DURATION (buf) = encoder->last_duration;
     GST_BUFFER_OFFSET_END (buf) =
         _to_granulepos (frame->presentation_frame_number + 1,
         inv_count, encoder->keyframe_distance);
@@ -1010,6 +1013,12 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
   buf = frame->src_buffer;
   frame->src_buffer = NULL;
 
+  encoder->last_timestamp = GST_BUFFER_TIMESTAMP (buf);
+  encoder->last_duration = GST_BUFFER_DURATION (buf);
+
+  if (encoder->last_invisible_ts == encoder->last_timestamp)
+    GST_WARNING_OBJECT (encoder, "oops, last_invisible_ts == currnet_timestamp");
+
   if (!hook->invisible && frame->is_sync_point) {
     GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
     encoder->keyframe_distance = 0;
diff --git a/ext/vp8/gstvp8enc.h b/ext/vp8/gstvp8enc.h
index cbfddc2..744768c 100644
--- a/ext/vp8/gstvp8enc.h
+++ b/ext/vp8/gstvp8enc.h
@@ -84,6 +84,9 @@ struct _GstVP8Enc
 
   int n_frames;
   int keyframe_distance;
+  GstClockTime last_timestamp;
+  GstClockTime last_duration;
+  GstClockTime last_invisible_ts;
 };
 
 struct _GstVP8EncClass
