| 570 | } |
| 571 | |
| 572 | static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time, int64_t pts) |
| 573 | { |
| 574 | AVBPrint buf, buf_script; |
| 575 | int64_t total_size = of_filesize(output_files[0]); |
| 576 | int vid; |
| 577 | double bitrate; |
| 578 | double speed; |
| 579 | static int64_t last_time = -1; |
| 580 | static int first_report = 1; |
| 581 | uint64_t nb_frames_dup = 0, nb_frames_drop = 0; |
| 582 | int mins, secs, ms, us; |
| 583 | int64_t hours; |
| 584 | const char *hours_sign; |
| 585 | int ret; |
| 586 | float t; |
| 587 | |
| 588 | if (!print_stats && !is_last_report && !progress_avio) |
| 589 | return; |
| 590 | |
| 591 | if (!is_last_report) { |
| 592 | if (last_time == -1) { |
| 593 | last_time = cur_time; |
| 594 | } |
| 595 | if (((cur_time - last_time) < stats_period && !first_report) || |
| 596 | (first_report && atomic_load(&nb_output_dumped) < nb_output_files)) |
| 597 | return; |
| 598 | last_time = cur_time; |
| 599 | } |
| 600 | |
| 601 | t = (cur_time-timer_start) / 1000000.0; |
| 602 | |
| 603 | vid = 0; |
| 604 | av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); |
| 605 | av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); |
| 606 | |
| 607 | for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { |
| 608 | const float q = ost->enc ? atomic_load(&ost->quality) / (float) FF_QP2LAMBDA : -1; |
| 609 | |
| 610 | if (vid && ost->type == AVMEDIA_TYPE_VIDEO) { |
| 611 | av_bprintf(&buf, "q=%2.1f ", q); |
| 612 | av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", |
| 613 | ost->file->index, ost->index, q); |
| 614 | } |
| 615 | if (!vid && ost->type == AVMEDIA_TYPE_VIDEO) { |
| 616 | float fps; |
| 617 | uint64_t frame_number = atomic_load(&ost->packets_written); |
| 618 | |
| 619 | fps = t > 1 ? frame_number / t : 0; |
| 620 | av_bprintf(&buf, "frame=%5"PRId64" fps=%3.*f q=%3.1f ", |
| 621 | frame_number, fps < 9.95, fps, q); |
| 622 | av_bprintf(&buf_script, "frame=%"PRId64"\n", frame_number); |
| 623 | av_bprintf(&buf_script, "fps=%.2f\n", fps); |
| 624 | av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", |
| 625 | ost->file->index, ost->index, q); |
| 626 | if (is_last_report) |
| 627 | av_bprintf(&buf, "L"); |
| 628 | |
| 629 | if (ost->filter) { |
no test coverage detected