diff mbox

[FFmpeg-devel] ffmpeg_opt.c: Introduce a -vstats_version option and document the existing -vstats format.

Message ID 20170124022545.21113-1-isasi@google.com
State Accepted
Headers show

Commit Message

Sasi Inguva Jan. 24, 2017, 2:25 a.m. UTC
Signed-off-by: Sasi Inguva <isasi@google.com>
---
 doc/ffmpeg.texi | 4 ++++
 ffmpeg.c        | 1 +
 ffmpeg.h        | 1 +
 ffmpeg_opt.c    | 3 +++
 4 files changed, 9 insertions(+)

Comments

Moritz Barsnick Jan. 24, 2017, 2:45 p.m. UTC | #1
On Mon, Jan 23, 2017 at 18:25:45 -0800, Sasi Inguva wrote:

> +@item -vstats_version @var{file}
                         ^ @var{int}

> +++ 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,

Totally useless and unrelated change.

> +        "Version of the vstats format to use."},
            ^ for consistency, this probably shouldn't be a capital letter.

Moritz
Moritz Barsnick Jan. 24, 2017, 2:47 p.m. UTC | #2
On Tue, Jan 24, 2017 at 15:45:27 +0100, Moritz Barsnick wrote:
> On Mon, Jan 23, 2017 at 18:25:45 -0800, Sasi Inguva wrote:
> 
> > +@item -vstats_version @var{file}
>                          ^ @var{int}
> 
> > +++ 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,
> 
> Totally useless and unrelated change.

Actually, I think you lost your change which makes actual use of the
variable vstats_version to allow two different outputs!
Sasi Inguva Jan. 24, 2017, 4:21 p.m. UTC | #3
I have it in a separate patch. Sorry about the newline.

On Tue, Jan 24, 2017 at 6:47 AM, Moritz Barsnick <barsnick@gmx.net> wrote:

> On Tue, Jan 24, 2017 at 15:45:27 +0100, Moritz Barsnick wrote:
> > On Mon, Jan 23, 2017 at 18:25:45 -0800, Sasi Inguva wrote:
> >
> > > +@item -vstats_version @var{file}
> >                          ^ @var{int}
> >
> > > +++ 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,
> >
> > Totally useless and unrelated change.
>
> Actually, I think you lost your change which makes actual use of the
> variable vstats_version to allow two different outputs!
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
diff mbox

Patch

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 |