Fix the packet duration when flushing the encoder.
authorThierry Foucu <tfoucu@gmail.com>
Wed, 7 Nov 2012 19:33:41 +0000 (11:33 -0800)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 7 Nov 2012 21:29:11 +0000 (22:29 +0100)
A similar patch was posted by Justin Ruggles <justin.ruggles@gmail.com>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c

index f8cf6b7..3554d9e 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1289,6 +1289,8 @@ static void flush_encoders(void)
                     pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
                 if (pkt.dts != AV_NOPTS_VALUE)
                     pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
+                if (pkt.duration > 0)
+                    pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base);
                 write_frame(os, &pkt, ost);
             }