[FFmpeg-cvslog] avconv: make the -pass option per-stream.

Anton Khirnov git at videolan.org
Fri Aug 31 13:08:34 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Aug 19 08:29:44 2012 +0200| [038c0b1e06cadffdd6ac50f058dcc6bc075b9019] | committer: Anton Khirnov

avconv: make the -pass option per-stream.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=038c0b1e06cadffdd6ac50f058dcc6bc075b9019
---

 Changelog       |    3 ++-
 avconv.h        |    2 ++
 avconv_opt.c    |   13 +++----------
 doc/avconv.texi |    2 +-
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/Changelog b/Changelog
index 4326c68..d175c12 100644
--- a/Changelog
+++ b/Changelog
@@ -42,7 +42,8 @@ version <next>:
 - RTMPE protocol support
 - RTMPTE protocol support
 - Canopus Lossless Codec decoder
-- avconv -shortest option is now per-output file
+- avconv -shortest option is now per-output file,
+  -pass is now per-output stream
 - Ut Video encoder
 
 
diff --git a/avconv.h b/avconv.h
index 94b3f67..7a51ccb 100644
--- a/avconv.h
+++ b/avconv.h
@@ -158,6 +158,8 @@ typedef struct OptionsContext {
     int        nb_copy_initial_nonkeyframes;
     SpecifierOpt *filters;
     int        nb_filters;
+    SpecifierOpt *pass;
+    int        nb_pass;
 } OptionsContext;
 
 typedef struct InputFilter {
diff --git a/avconv_opt.c b/avconv_opt.c
index 4e483de..28bd926 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -77,7 +77,6 @@ int same_quant        = 0;
 static int file_overwrite     = 0;
 static int video_discard      = 0;
 static int intra_dc_precision = 8;
-static int do_pass            = 0;
 static int using_stdin        = 0;
 static int input_sync;
 
@@ -886,6 +885,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
         char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
         char *intra_matrix = NULL, *inter_matrix = NULL;
         const char *filters = "null";
+        int do_pass = 0;
         int i;
 
         MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
@@ -958,6 +958,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
         video_enc->intra_dc_precision = intra_dc_precision - 8;
 
         /* two pass mode */
+        MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
         if (do_pass) {
             if (do_pass == 1) {
                 video_enc->flags |= CODEC_FLAG_PASS1;
@@ -1495,14 +1496,6 @@ loop_end:
     reset_options(o);
 }
 
-/* same option as mencoder */
-static int opt_pass(const char *opt, const char *arg)
-{
-    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
-    return 0;
-}
-
-
 static int opt_target(void *optctx, const char *opt, const char *arg)
 {
     OptionsContext *o = optctx;
@@ -1972,7 +1965,7 @@ const OptionDef options[] = {
         "force video codec ('copy' to copy stream)", "codec" },
     { "same_quant",   OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &same_quant },
         "use same quantizer as source (implies VBR)" },
-    { "pass",         OPT_VIDEO | HAS_ARG ,                                      { opt_pass },
+    { "pass",         OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT,                  { .off = OFFSET(pass) },
         "select the pass number (1 or 2)", "n" },
     { "passlogfile",  OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT,             { &pass_logfilename_prefix },
         "select two pass log file name prefix", "prefix" },
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 9f06ddf..58b530c 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -479,7 +479,7 @@ Use same quantizer as source (implies VBR).
 Note that this is NOT SAME QUALITY. Do not use this option unless you know you
 need it.
 
- at item -pass @var{n}
+ at item -pass[:@var{stream_specifier}] @var{n} (@emph{output,per-stream})
 Select the pass number (1 or 2). It is used to do two-pass
 video encoding. The statistics of the video are recorded in the first
 pass into a log file (see also the option -passlogfile),



More information about the ffmpeg-cvslog mailing list