Message ID | 20201221092122.1658-2-ffmpeg@gyani.pro |
---|---|
State | Accepted |
Commit | 3e47bbad56e8a00bf502829403f298e17c69dd1a |
Headers | show |
Series | [FFmpeg-devel,1/2] ffmpeg: add option stats_period | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Mon, Dec 21, 2020 at 02:51:21PM +0530, Gyan Doshi wrote: > 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 | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) This breaks ffmpeg output: ./ffmpeg -i ~/videos/mm-short.mpg -y file.avi Produces a line like this: Output #0, avi, to 'file.avi':= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A thx [...]
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 6d25f1bca9..2c0820aacf 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -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); }