diff --git a/ffmpeg.c b/ffmpeg.c
index 3d6853fb627e5a35b4665d9ffbf2482f593a66ec..d140eefde3d70bcdfb82954488cf227bf49055b1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1650,6 +1650,7 @@ static void do_subtitle_out(AVFormatContext *s,
         pkt.data = subtitle_out;
         pkt.size = subtitle_out_size;
         pkt.pts  = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
+        pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->st->time_base);
         if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
             /* XXX: the pts correction is handled here. Maybe handling
                it in the codec would be better */