diff --git a/ffmpeg.c b/ffmpeg.c
index 37c4a64f530109a4c1b84e45754c406e27de81b0..c3633739b2255dd8d7261d01925ab0cb9e72e535 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1339,7 +1339,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
                             opkt.pts= AV_NOPTS_VALUE;
 
                         if (pkt->dts == AV_NOPTS_VALUE)
-                            opkt.dts = av_rescale_q(ist->next_pts, AV_TIME_BASE_Q, ost->st->time_base);
+                            opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base);
                         else
                             opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);