Skip to content

Commit

Permalink
ffmpeg: don't delay printing initial stats
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GyanD committed Dec 22, 2020
1 parent 842714b commit 3e47bba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fftools/ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 3e47bba

Please sign in to comment.