diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index bebf610fe5..085ea7d46a 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -959,6 +959,13 @@ error: exit_program(1); } +static void convertSecondsTotime(int* secs, int* mins, int* hours) { + *mins = *secs / 60; + *hours = *mins / 60; + *mins %= 60; + *secs %= 60; +} + static void do_subtitle_out(OutputFile *of, OutputStream *ost, AVSubtitle *sub) @@ -1517,7 +1524,7 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(int64_t total_size) +static void print_final_stats(int64_t total_size, int processingtime) { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; @@ -1544,7 +1551,11 @@ static void print_final_stats(int64_t total_size) if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; - av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + int s = processingtime, m, h; + convertSecondsTotime(&s, &m, &h); + + av_log(NULL, AV_LOG_INFO, "time=%02d:%02d:%02d video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + h, m, s, video_size / 1024.0, audio_size / 1024.0, subtitle_size / 1024.0, @@ -1751,10 +1762,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti secs = FFABS(pts) / AV_TIME_BASE; us = FFABS(pts) % AV_TIME_BASE; - mins = secs / 60; - secs %= 60; - hours = mins / 60; - mins %= 60; + convertSecondsTotime(&secs, &mins, &hours); hours_sign = (pts < 0) ? "-" : ""; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; @@ -1815,9 +1823,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti //get remaining frames int64_t remaining_frames = max_frames_hint - frame_number; secs = remaining_frames / fps; - mins = secs / 60; //secs %= 60 done later - hours = mins / 60; - mins %= 60; //calculate finish date time_t rawtime; @@ -1828,8 +1833,10 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti time_t timef = time + secs; //time finished timeinfo = localtime(&timef); - secs %= 60; - char* timebuf[20]; //max: 2019-10-10 12:34:00 (18) +1 + + convertSecondsTotime(&secs, &mins, &hours); + + char timebuf[20]; //max: 2019-10-10 12:34:00 (18) +1 if(timef - time > 86400) //longer than one day? strftime(timebuf, 20, "%F %T", timeinfo); //full information else @@ -1866,7 +1873,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti } if (is_last_report) - print_final_stats(total_size); + print_final_stats(total_size, t); } static void ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par)