diff --git a/ffmpeg.c b/ffmpeg.c
index f91fb7b..844a03c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3864,6 +3864,11 @@ static int process_input(int file_index)
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
+if (pkt.pts == AV_NOPTS_VALUE)
+pkt.pts = av_rescale_q(i
diff --git a/ffmpeg.c b/ffmpeg.c
index f91fb7b..22766b3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3864,6 +3864,9 @@ static int process_input(int file_index)
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts *= ist->ts_scale;
+if(pkt.pts == AV_NOPTS_VALUE)
+pkt.pts = ist->next_pts;
+