diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3df8c51ddd525cdef8cfda12415257665a87bac2..60242056f186f322cd5c350addeb8bb46ddd24cf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3967,6 +3967,10 @@ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
         local_pkt.dts = av_rescale_q(pkt->dts,
                                      src->streams[pkt->stream_index]->time_base,
                                      dst->streams[dst_stream]->time_base);
+    if (pkt->duration)
+        local_pkt.duration = av_rescale_q(pkt->duration,
+                                          src->streams[pkt->stream_index]->time_base,
+                                          dst->streams[dst_stream]->time_base);
     return av_write_frame(dst, &local_pkt);
 }