diff mbox

[FFmpeg-devel] ffmpeg.c: Add output file index and stream index to vstats file.

Message ID CAGD_KHdKQ7J03qqcNnrZWVTuJADrhNQCoYuyio9RPhdWZWmAcA@mail.gmail.com
State Accepted
Headers show

Commit Message

Sasi Inguva Jan. 26, 2017, 12:43 a.m. UTC
Updated the patch with using vstats_version. PTAL.

On Sat, Jan 21, 2017 at 3:52 AM, Michael Niedermayer <michaelni@gmx.at>
wrote:

> On Fri, Jan 20, 2017 at 07:31:09PM -0800, Sasi Inguva wrote:
> > Couldn't find any version that relates to vstats. There is nothing that
> > says format may change any time , but there is no defined format either.
> > Let me know the version enum I have to update if I need to.
>
> i dont think theres a enum
> I think the way to resolve this is to send a patch that updates the
> docs and either state that vstats format can change at any time or
> that it cannot in which case something like a -vtstats_version
> parameter would need to be added
>
> When the docs patch passes review, that is everyone is happy with the
> solution it describes then the change with or without a version
> check which either way then matches the docs can be pushed
>
> thx
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Dictatorship: All citizens are under surveillance, all their steps and
> actions recorded, for the politicians to enforce control.
> Democracy: All politicians are under surveillance, all their steps and
> actions recorded, for the citizens to enforce control.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
diff mbox

Patch

From 9bc4d038af3478467eddc45a634b0e03e163dc39 Mon Sep 17 00:00:00 2001
From: Sasi Inguva <isasi@google.com>
Date: Thu, 19 Jan 2017 14:33:32 -0800
Subject: [PATCH] ffmpeg.c: Add output file index and stream index to vstats
 file.

Signed-off-by: Sasi Inguva <isasi@google.com>
---
 doc/ffmpeg.texi | 8 +++++++-
 ffmpeg.c        | 9 +++++++--
 ffmpeg_opt.c    | 2 +-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index cdea1a271f..996d6a6cc4 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -637,9 +637,15 @@  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
+Specifies which version of the vstats format to use. Default is 2.
+
+version = 1 :
 
 @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}
+
+version > 1:
+
+@code{out= %2d st= %2d 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..0a8f448995 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1347,8 +1347,13 @@  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);
+        if (vstats_version <= 1) {
+            fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number,
+                    ost->quality / (float)FF_QP2LAMBDA);
+        } else  {
+            fprintf(vstats_file, "out= %2d st= %2d frame= %5d q= %2.1f ", ost->file_index, ost->index, frame_number,
+                    ost->quality / (float)FF_QP2LAMBDA);
+        }
 
         if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR))
             fprintf(vstats_file, "PSNR= %6.2f ", psnr(ost->error[0] / (enc->width * enc->height * 255.0 * 255.0)));
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index b1a62e8620..6a47d32b53 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -121,7 +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;
+int vstats_version = 2;
 
 
 static int intra_only         = 0;
-- 
2.11.0.483.g087da7b7c-goog