]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: don't delay printing initial stats
authorGyan Doshi <ffmpeg@gyani.pro>
Mon, 21 Dec 2020 09:16:15 +0000 (14:46 +0530)
committerGyan Doshi <ffmpeg@gyani.pro>
Tue, 22 Dec 2020 19:11:20 +0000 (00:41 +0530)
The first stats is printed after the initial stats_period has elapsed. With a large period,
it may appear that ffmpeg has frozen at startup.

The initial stats is now printed after the first transcode_step.

fftools/ffmpeg.c

index 6d25f1bca93e539ef4bc48de61a903745537920b..2c0820aacf5633075c463c7b1c245f0db2d9f165 100644 (file)
@@ -1685,6 +1685,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
     double speed;
     int64_t pts = INT64_MIN + 1;
     static int64_t last_time = -1;
+    static int first_report = 1;
     static int qp_histogram[52];
     int hours, mins, secs, us;
     const char *hours_sign;
@@ -1697,9 +1698,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
     if (!is_last_report) {
         if (last_time == -1) {
             last_time = cur_time;
-            return;
         }
-        if ((cur_time - last_time) < stats_period)
+        if ((cur_time - last_time) < stats_period && !first_report)
             return;
         last_time = cur_time;
     }
@@ -1876,6 +1876,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         }
     }
 
+    first_report = 0;
+
     if (is_last_report)
         print_final_stats(total_size);
 }