diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 1d6a09ee39ef650d41664fbc5247e4aeaef9d064..de9110a4e2c687193b8deb6bc2af0810b0d96fc6 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -2178,7 +2178,7 @@ static void mpeg4_encode_gop_header(MpegEncContext * s){
     put_bits(&s->pb, 16, 0);
     put_bits(&s->pb, 16, GOP_STARTCODE);
     
-    if(s->current_picture_ptr->pts){
+    if(s->current_picture_ptr->pts && s->reordered_input_picture[1]){
         time= FFMIN(s->reordered_input_picture[1]->pts, s->current_picture_ptr->pts);
         time= (time*s->time_increment_resolution + 500*1000)/(1000*1000);
     }else