From patchwork Tue Jan 24 02:25:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasi Inguva X-Patchwork-Id: 2300 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp1517726vsb; Mon, 23 Jan 2017 18:26:19 -0800 (PST) X-Received: by 10.223.170.3 with SMTP id p3mr13201141wrd.100.1485224779759; Mon, 23 Jan 2017 18:26:19 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y22si16440270wmh.29.2017.01.23.18.26.19; Mon, 23 Jan 2017 18:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 380B668A39B; Tue, 24 Jan 2017 04:26:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1ACF968A35D for ; Tue, 24 Jan 2017 04:26:10 +0200 (EET) Received: by mail-pf0-f181.google.com with SMTP id e4so45814309pfg.1 for ; Mon, 23 Jan 2017 18:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MojiP3KDP4jUdbPa9QDhG6Th4fTiyfVf21gPxKOcZFM=; b=sY/pe4OknmB7JoUA47W/kt8LRZ92/u+nLZI10TDoh7PrtYRb3FlYxDJ+SOgqP/JSAc z2MKuD029kd4QkXg715z0NREzJtraHXo+rn2uqr3S84ChBqzuES7lh58VF06QR58a6NL IzgASV4SMkIkOz8EYYZQpcLEScZTJ43JUmDuZQfriE0qilZOxAzABO3E/advz2Hwyydg w/INiEAUEQ32Y48153zwjtNX7jNa6FSOZJMb6KVxngMHcrmSmbibKfkGm+4K8ydjAUul SkK/h+1hicEwCbofJ3jK9YRBNXS4sNe0Bb0sxzHF53NsE9lG4Cp2A5w5qM5iDB+qNSUQ wCAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MojiP3KDP4jUdbPa9QDhG6Th4fTiyfVf21gPxKOcZFM=; b=jWcC5nZjTlaCwJ1ZGy2m5LTaDoiY2CUQS+c/n3JpFg8x5UHCmIq2cuZIZK4/55L2c7 L57HwuRbZvwHi9N2bvFfxVDN7ASKMyBjXljWpUvOuHDLctJq7RL881x+4ivsne87iBRf 69WCbti3X3lKFakf8YAsb+boy7CoKcHFX3uppjjcnrZku0g9mDnEjNUSjD4qkfxEhUG/ ZvKT8YWXNu9o9sGo3L/GwXF65q6JAxz+BN3GswoovS067qdcHXhcO03IyDrpAO1Snspe YqQl+7ybty0oGYdBFKVes4nFsubkB30cbeL12YUCxkpOvD8sfSUMnz4kpKhG6sBQ8pPg L2XQ== X-Gm-Message-State: AIkVDXLxHUDX2zASp2/BDGIVkOYUXiUr5DjNwiju2V6lHYmTV6N4b3ce+KDP/XVDdQ9KvbEy X-Received: by 10.98.73.74 with SMTP id w71mr36161372pfa.52.1485224768090; Mon, 23 Jan 2017 18:26:08 -0800 (PST) Received: from isasi.mtv.corp.google.com ([172.27.82.89]) by smtp.gmail.com with ESMTPSA id r8sm39768375pfi.82.2017.01.23.18.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 18:26:07 -0800 (PST) From: Sasi Inguva To: ffmpeg-devel@ffmpeg.org Date: Mon, 23 Jan 2017 18:25:45 -0800 Message-Id: <20170124022545.21113-1-isasi@google.com> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog Subject: [FFmpeg-devel] [PATCH] ffmpeg_opt.c: Introduce a -vstats_version option and document the existing -vstats format. 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 Cc: Sasi Inguva MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Sasi Inguva --- doc/ffmpeg.texi | 4 ++++ ffmpeg.c | 1 + ffmpeg.h | 1 + ffmpeg_opt.c | 3 +++ 4 files changed, 9 insertions(+) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index b56bdbe261..cdea1a271f 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -636,6 +636,10 @@ Calculate PSNR of compressed frames. Dump video coding statistics to @file{vstats_HHMMSS.log}. @item -vstats_file @var{file} Dump video coding statistics to @var{file}. +@item -vstats_version @var{file} +Specifies which version of the vstats format to use. If version is 1, format is + +@code{frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s} @item -top[:@var{stream_specifier}] @var{n} (@emph{output,per-stream}) top=1/bottom=0/auto=-1 field first @item -dc @var{precision} diff --git a/ffmpeg.c b/ffmpeg.c index 977708c069..d42adf86ee 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1347,6 +1347,7 @@ static void do_video_stats(OutputStream *ost, int frame_size) enc = ost->enc_ctx; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->st->nb_frames; + fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, ost->quality / (float)FF_QP2LAMBDA); diff --git a/ffmpeg.h b/ffmpeg.h index 75bf50ec29..458bb8a3dc 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -597,6 +597,7 @@ extern char *videotoolbox_pixfmt; extern int filter_nbthreads; extern int filter_complex_nbthreads; +extern int vstats_version; extern const AVIOInterruptCB int_cb; diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index a1c02fc29b..b1a62e8620 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -121,6 +121,7 @@ int frame_bits_per_raw_sample = 0; float max_error_rate = 2.0/3; int filter_nbthreads = 0; int filter_complex_nbthreads = 0; +int vstats_version = 1; static int intra_only = 0; @@ -3547,6 +3548,8 @@ const OptionDef options[] = { "dump video coding statistics to file" }, { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file }, "dump video coding statistics to file", "file" }, + { "vstats_version", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &vstats_version }, + "Version of the vstats format to use."}, { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters }, "set video filters", "filter_graph" }, { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |