[FFmpeg-devel] [PATCH]Show "00:00" on status line if pts is unknown

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Mar 5 00:16:10 CET 2014


Hi!

If current pts is unknown in ffmpeg.c (because it is AV_NOPTS_VALUE), ffmpeg 
currently shows "time=-577014:-32:-22.-77" (INT64_MIN) on the status line.
Attached patch forces the output to "00:00" in this case, intends to fix 
ticket #3427.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/ffmpeg.c b/ffmpeg.c
index de9af44..55afbe5 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1191,7 +1191,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
     int64_t pts = INT64_MIN;
     static int64_t last_time = -1;
     static int qp_histogram[52];
-    int hours, mins, secs, us;
+    int hours, mins, secs = 0, us = 0;
 
     if (!print_stats && !is_last_report && !progress_avio)
         return;
@@ -1285,8 +1285,10 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
                                           ost->st->time_base, AV_TIME_BASE_Q));
     }
 
+    if (pts != INT64_MIN) {
     secs = pts / AV_TIME_BASE;
     us = pts % AV_TIME_BASE;
+    }
     mins = secs / 60;
     secs %= 60;
     hours = mins / 60;


More information about the ffmpeg-devel mailing list