avconv: make the -passlogfile option per-stream.

pull/28/head
Anton Khirnov 13 years ago
parent 038c0b1e06
commit bbcedade00
  1. 2
      Changelog
  2. 4
      avconv.c
  3. 4
      avconv.h
  4. 8
      avconv_opt.c
  5. 2
      doc/avconv.texi

@ -43,7 +43,7 @@ version <next>:
- RTMPTE protocol support - RTMPTE protocol support
- Canopus Lossless Codec decoder - 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 -pass and -passlogfile are now per-output stream
- Ut Video encoder - Ut Video encoder

@ -183,6 +183,7 @@ void exit_program(int ret)
av_freep(&output_streams[i]->forced_keyframes); av_freep(&output_streams[i]->forced_keyframes);
av_freep(&output_streams[i]->avfilter); av_freep(&output_streams[i]->avfilter);
av_freep(&output_streams[i]->logfile_prefix);
av_freep(&output_streams[i]->filtered_frame); av_freep(&output_streams[i]->filtered_frame);
av_freep(&output_streams[i]); av_freep(&output_streams[i]);
} }
@ -1747,7 +1748,8 @@ static int transcode_init(void)
FILE *f; FILE *f;
snprintf(logfilename, sizeof(logfilename), "%s-%d.log", snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX, ost->logfile_prefix ? ost->logfile_prefix :
DEFAULT_PASS_LOGFILENAME_PREFIX,
i); i);
if (!strcmp(ost->enc->name, "libx264")) { if (!strcmp(ost->enc->name, "libx264")) {
av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);

@ -160,6 +160,8 @@ typedef struct OptionsContext {
int nb_filters; int nb_filters;
SpecifierOpt *pass; SpecifierOpt *pass;
int nb_pass; int nb_pass;
SpecifierOpt *passlogfiles;
int nb_passlogfiles;
} OptionsContext; } OptionsContext;
typedef struct InputFilter { typedef struct InputFilter {
@ -284,6 +286,7 @@ typedef struct OutputStream {
int forced_kf_index; int forced_kf_index;
char *forced_keyframes; char *forced_keyframes;
char *logfile_prefix;
FILE *logfile; FILE *logfile;
OutputFilter *filter; OutputFilter *filter;
@ -323,7 +326,6 @@ extern int nb_output_files;
extern FilterGraph **filtergraphs; extern FilterGraph **filtergraphs;
extern int nb_filtergraphs; extern int nb_filtergraphs;
extern char *pass_logfilename_prefix;
extern char *vstats_filename; extern char *vstats_filename;
extern float audio_drift_threshold; extern float audio_drift_threshold;

@ -54,7 +54,6 @@
}\ }\
} }
char *pass_logfilename_prefix = NULL;
char *vstats_filename; char *vstats_filename;
float audio_drift_threshold = 0.1; float audio_drift_threshold = 0.1;
@ -967,6 +966,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
} }
} }
MATCH_PER_STREAM_OPT(passlogfiles, str, ost->logfile_prefix, oc, st);
if (ost->logfile_prefix &&
!(ost->logfile_prefix = av_strdup(ost->logfile_prefix)))
exit_program(1);
MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st); MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st);
if (ost->forced_keyframes) if (ost->forced_keyframes)
ost->forced_keyframes = av_strdup(ost->forced_keyframes); ost->forced_keyframes = av_strdup(ost->forced_keyframes);
@ -1967,7 +1971,7 @@ const OptionDef options[] = {
"use same quantizer as source (implies VBR)" }, "use same quantizer as source (implies VBR)" },
{ "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT, { .off = OFFSET(pass) }, { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT, { .off = OFFSET(pass) },
"select the pass number (1 or 2)", "n" }, "select the pass number (1 or 2)", "n" },
{ "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT, { &pass_logfilename_prefix }, { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(passlogfiles) },
"select two pass log file name prefix", "prefix" }, "select two pass log file name prefix", "prefix" },
{ "deinterlace", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_deinterlace }, { "deinterlace", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_deinterlace },
"this option is deprecated, use the yadif filter instead" }, "this option is deprecated, use the yadif filter instead" },

@ -492,7 +492,7 @@ avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
@end example @end example
@item -passlogfile @var{prefix} (@emph{global}) @item -passlogfile[:@var{stream_specifier}] @var{prefix} (@emph{output,per-stream})
Set two-pass log file name prefix to @var{prefix}, the default file name Set two-pass log file name prefix to @var{prefix}, the default file name
prefix is ``av2pass''. The complete file name will be prefix is ``av2pass''. The complete file name will be
@file{PREFIX-N.log}, where N is a number specific to the output @file{PREFIX-N.log}, where N is a number specific to the output

Loading…
Cancel
Save