int stdin_interaction = 1;
int frame_bits_per_raw_sample = 0;
float max_error_rate = 2.0/3;
+int filter_nbthreads = 0;
+int filter_complex_nbthreads = 0;
static int intra_only = 0;
MATCH_PER_STREAM_OPT(disposition, str, ost->disposition, oc, st);
ost->disposition = av_strdup(ost->disposition);
+ ost->max_muxing_queue_size = 128;
+ MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
+ ost->max_muxing_queue_size *= sizeof(AVPacket);
+
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
ost->last_mux_dts = AV_NOPTS_VALUE;
+ ost->muxing_queue = av_fifo_alloc(8 * sizeof(AVPacket));
+ if (!ost->muxing_queue)
+ exit_program(1);
+
return ost;
}
ost->filter = ofilter;
ofilter->ost = ost;
+ ofilter->format = -1;
if (ost->stream_copy) {
av_log(NULL, AV_LOG_ERROR, "Streamcopy requested for output stream %d:%d, "
static int configure_complex_filters(void)
{
- int i, ret = 0;
+ int i, j, ret = 0;
+
+ for (i = 0; i < nb_filtergraphs; i++) {
+ FilterGraph *fg = filtergraphs[i];
+
+ if (filtergraph_is_simple(fg))
+ continue;
- for (i = 0; i < nb_filtergraphs; i++)
- if (!filtergraph_is_simple(filtergraphs[i]) &&
- (ret = configure_filtergraph(filtergraphs[i])) < 0)
+ for (j = 0; j < fg->nb_inputs; j++) {
+ ret = ifilter_parameters_from_decoder(fg->inputs[j],
+ fg->inputs[j]->ist->dec_ctx);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Error initializing filtergraph %d input %d\n", i, j);
+ return ret;
+ }
+ }
+
+ ret = configure_filtergraph(filtergraphs[i]);
+ if (ret < 0)
return ret;
+ }
return 0;
}
InputStream *ist;
AVDictionary *unused_opts = NULL;
AVDictionaryEntry *e = NULL;
-
+ int format_flags = 0;
if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
o->stop_time = INT64_MAX;
file_oformat= oc->oformat;
oc->interrupt_callback = int_cb;
+ e = av_dict_get(o->g->format_opts, "fflags", NULL, 0);
+ if (e) {
+ const AVOption *o = av_opt_find(oc, "fflags", NULL, 0, 0);
+ av_opt_eval_flags(oc, o, e->value, &format_flags);
+ }
+
/* create streams for all unlabeled output pads */
for (i = 0; i < nb_filtergraphs; i++) {
FilterGraph *fg = filtergraphs[i];
/* ffserver seeking with date=... needs a date reference */
if (!strcmp(file_oformat->name, "ffm") &&
+ !(format_flags & AVFMT_FLAG_BITEXACT) &&
av_strstart(filename, "http:", NULL)) {
int err = parse_option(o, "metadata", "creation_time=now", options);
if (err < 0) {
}
}
}
+
+ /* set the filter output constraints */
+ if (ost->filter) {
+ OutputFilter *f = ost->filter;
+ int count;
+ switch (ost->enc_ctx->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ f->frame_rate = ost->frame_rate;
+ f->width = ost->enc_ctx->width;
+ f->height = ost->enc_ctx->height;
+ if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
+ f->format = ost->enc_ctx->pix_fmt;
+ } else if (ost->enc->pix_fmts) {
+ count = 0;
+ while (ost->enc->pix_fmts[count] != AV_PIX_FMT_NONE)
+ count++;
+ f->formats = av_mallocz_array(count + 1, sizeof(*f->formats));
+ if (!f->formats)
+ exit_program(1);
+ memcpy(f->formats, ost->enc->pix_fmts, (count + 1) * sizeof(*f->formats));
+ }
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) {
+ f->format = ost->enc_ctx->sample_fmt;
+ } else if (ost->enc->sample_fmts) {
+ count = 0;
+ while (ost->enc->sample_fmts[count] != AV_SAMPLE_FMT_NONE)
+ count++;
+ f->formats = av_mallocz_array(count + 1, sizeof(*f->formats));
+ if (!f->formats)
+ exit_program(1);
+ memcpy(f->formats, ost->enc->sample_fmts, (count + 1) * sizeof(*f->formats));
+ }
+ if (ost->enc_ctx->sample_rate) {
+ f->sample_rate = ost->enc_ctx->sample_rate;
+ } else if (ost->enc->supported_samplerates) {
+ count = 0;
+ while (ost->enc->supported_samplerates[count])
+ count++;
+ f->sample_rates = av_mallocz_array(count + 1, sizeof(*f->sample_rates));
+ if (!f->sample_rates)
+ exit_program(1);
+ memcpy(f->sample_rates, ost->enc->supported_samplerates,
+ (count + 1) * sizeof(*f->sample_rates));
+ }
+ if (ost->enc_ctx->channels) {
+ f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels);
+ } else if (ost->enc->channel_layouts) {
+ count = 0;
+ while (ost->enc->channel_layouts[count])
+ count++;
+ f->channel_layouts = av_mallocz_array(count + 1, sizeof(*f->channel_layouts));
+ if (!f->channel_layouts)
+ exit_program(1);
+ memcpy(f->channel_layouts, ost->enc->channel_layouts,
+ (count + 1) * sizeof(*f->channel_layouts));
+ }
+ break;
+ }
+ }
}
/* check filename in case of an image number is expected */
"set profile", "profile" },
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph" },
+ { "filter_threads", HAS_ARG | OPT_INT, { &filter_nbthreads },
+ "number of non-complex filter threads" },
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
{ "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
"reinit filtergraph on input parameter changes", "" },
{ "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
+ { "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads },
+ "number of threads for -filter_complex" },
{ "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
"create a complex filtergraph", "graph_description" },
{ "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script },
"set the subtitle options to the indicated preset", "preset" },
{ "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
"set options from indicated preset file", "filename" },
+
+ { "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
+ "maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
+
/* data codec support */
{ "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
"force data codec ('copy' to copy stream)", "codec" },