From patchwork Fri Jun 26 21:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Cao X-Patchwork-Id: 20636 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D9C1B44B1E2 for ; Sat, 27 Jun 2020 00:28:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B69CD68B051; Sat, 27 Jun 2020 00:28:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6840568AA64 for ; Sat, 27 Jun 2020 00:28:39 +0300 (EEST) Received: by mail-pf1-f193.google.com with SMTP id t11so304622pfq.11 for ; Fri, 26 Jun 2020 14:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BP5rf0XCjU5/bOW3h0N2pBZP0J1F59sYX9j5dwdpUrU=; b=lDQTdNCkT8pJqzQe3iURrx1Mm/W4DQIc9sNqv+rPkf8J/QRAkMHowm+c1la/5lFWXN oBlpLJitqarJv3kCKPP4X4cLow1wDR8Goy2asjjM4Ft5/K/oBW+YLCFKHvOctb//oack eBGjbhUqi929D2Wj71BaktiffrNvrKD9GkyAISUuG8tGpR6nU7Bkuo7ItRq7sO1Ip1mP 2R3lOz8gcRELSeVc3vfBYt1GM2jZ3COov5a++r/Oa8iUe9osYcNlEchOG144fQO32FoR 19UCfbwFvtz52BmdGXoPIXIhzbyv21e6ntSBJhsv4dOFdgGEoonQjJJH+b5yQbjMjbTd tT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BP5rf0XCjU5/bOW3h0N2pBZP0J1F59sYX9j5dwdpUrU=; b=C7ZeDsRPzP8yFyC/ceZJjRIXQYYXjJmybf8Tg4+zYlGY1m6qHsTvp01LZhcZ1WFu4i eBl77b0xaWmYsx4lwu0uMKZ9lyKH5kRDFWL3g31SU5lLjA5fY5+yHdGWcrjtKhz8N7X6 ZDa2N5z8+Vm3wjhRD7IR/wl3u9sFZ1isSwNlfwyiZLKku1y7LwQMEsGjV5NEWUjmpZ3f c7GCwEt/MAEH1cHCmsBgdk3p5Bh5QKCMZ2FlwVMpD5n7YLGMije0bqWmtT9YVXmUFG7n np8xvP63GGMQt2uwrNgDFyABX7xGI6cu6AMqmFz5hhPB08yrOOaal+tQiq3tQ1CA3mF3 gieg== X-Gm-Message-State: AOAM531r1Z2WvdOILmWNuoqTN3ATQxDQmcuYc7yKoxo85Z1Cu/GgvZXR f9N3lWPWSTDB+7H8nenuKvgU1VBOSLI= X-Google-Smtp-Source: ABdhPJx0OytXUAKW5AgqPzp8gJ7rhXoEouizPBL0oKAmg/E7EvVtdopxDdk8cvTEvSbIm4OwHJOjUA== X-Received: by 2002:a65:640c:: with SMTP id a12mr675423pgv.88.1593206917093; Fri, 26 Jun 2020 14:28:37 -0700 (PDT) Received: from wangcao.mtv.corp.google.com ([2620:0:1000:4011:7b84:dc77:c8b2:63c]) by smtp.gmail.com with ESMTPSA id p10sm11866495pjp.52.2020.06.26.14.28.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 14:28:36 -0700 (PDT) From: Wang Cao X-Google-Original-From: Wang Cao To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 14:28:29 -0700 Message-Id: <20200626212830.1734049-1-wangcao@google.com> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg.c: Use the streams from the first output in print_final_stats. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Wang Cao It appears the initial intention was to print stats for the first output. Currently all output streams are aggregated for the final stats which is inconsistent with the "size" reported in print_report. For example, when two outputs are specified, output 0 has size of 100 kB and output 1 has size of 50 kB. The output would look like: frame= 206 fps=3.6 q=0.0 LPSNR=Y:45.57 U:50.04 V:50.07 *:46.62 size= 100kB time=00:00:07.10 bitrate=1362.7kbits/s speed=0.124x video:140kB audio:79kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.382502% The "video" reported is larger than the previous line and this is confusing. Signed-off-by: Wang Cao --- fftools/ffmpeg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 2e9448ea2b..07396204b6 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1516,6 +1516,7 @@ static int reap_filters(int flush) static void print_final_stats(int64_t total_size) { + AVFormatContext *oc; uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; uint64_t data_size = 0; @@ -1523,7 +1524,9 @@ static void print_final_stats(int64_t total_size) int i, j; int pass1_used = 1; - for (i = 0; i < nb_output_streams; i++) { + oc = output_files[0]->ctx; + + for (i = 0; i < oc->nb_streams; i++) { OutputStream *ost = output_streams[i]; switch (ost->enc_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; @@ -1674,7 +1677,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti vid = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); - for (i = 0; i < nb_output_streams; i++) { + for (i = 0; i < oc->nb_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx;