From 98cbbabadb70282a80fdb952a51f832d5f322d93 Mon Sep 17 00:00:00 2001 From: Thierry Foucu Date: Wed, 7 Nov 2012 11:33:41 -0800 Subject: [PATCH] Fix the packet duration when flushing the encoder. A similar patch was posted by Justin Ruggles Signed-off-by: Michael Niedermayer --- ffmpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index f8cf6b7701..3554d9e08c 100644 --- 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); }