[FFmpeg-devel] [PATCH] ffmpeg: exclude finished and subtitles streams for the report time.

Nicolas George nicolas.george at normalesup.org
Mon Aug 20 23:32:14 CEST 2012

Avoid having the time stuck at the shortest stream while other
streams are still being encoded or at the last subtitle packet.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
 ffmpeg.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Not completely sure about the subtitle part: it enhances things a lot when
there are subtitles, because the time stops progressing when people stop
talking, but it breaks the time when there are only subtitles being
transcoded. This could be fixed by doing a second round, but that makes a
lot of code for something not very important.

Or it could print the time of the most advanced stream instead, that would
solve the subtitles problem in a different way.

diff --git a/ffmpeg.c b/ffmpeg.c
index de17a96..ecda3ed 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1172,8 +1172,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
             vid = 1;
         /* compute min output value */
-        pts = FFMIN(pts, av_rescale_q(ost->st->pts.val,
-                                      ost->st->time_base, AV_TIME_BASE_Q));
+        if (!ost->finished && enc->codec_type != AVMEDIA_TYPE_SUBTITLE)
+            pts = FFMIN(pts, av_rescale_q(ost->st->pts.val,
+                                          ost->st->time_base, AV_TIME_BASE_Q));
     secs = pts / AV_TIME_BASE;

More information about the ffmpeg-devel mailing list