62 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
76 for (; *p != -1; p++) {
85 "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
138 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name, separator)\
139 static char *choose_ ## var ## s(OutputStream *ost) \
141 if (ost->st->codec->var != none) { \
142 get_name(ost->st->codec->var); \
143 return av_strdup(name); \
144 } else if (ost->enc && ost->enc->supported_list) { \
146 AVIOContext *s = NULL; \
150 if (avio_open_dyn_buf(&s) < 0) \
153 for (p = ost->enc->supported_list; *p != none; p++) { \
155 avio_printf(s, "%s" separator, name); \
157 len = avio_close_dyn_buf(s, &ret); \
199 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
224 int file_idx = strtol(in->
name, &p, 0);
235 if (stream_type != type &&
257 if (i == nb_input_streams) {
259 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
304 snprintf(args,
sizeof(args),
"%d:%d:flags=0x%X",
308 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
313 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
322 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
326 "format", pix_fmts,
NULL,
329 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
343 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
369 char *
sample_fmts, *sample_rates, *channel_layouts;
385 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
386 AVFilterContext *filt_ctx; \
388 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
389 "similarly to -af " filter_name "=%s.\n", arg); \
391 ret = avfilter_graph_create_filter(&filt_ctx, \
392 avfilter_get_by_name(filter_name), \
393 filter_name, arg, NULL, fg->graph); \
397 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
401 last_filter = filt_ctx; \
421 sample_fmts = choose_sample_fmts(ost);
422 sample_rates = choose_sample_rates(ost);
423 channel_layouts = choose_channel_layouts(ost);
424 if (sample_fmts || sample_rates || channel_layouts) {
433 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
436 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
443 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
455 last_filter = format;
472 #define DESCRIBE_FILTER_LINK(f, inout, in) \
474 AVFilterContext *ctx = inout->filter_ctx; \
475 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
476 int nb_pads = in ? ctx->input_count : ctx->output_count; \
479 if (avio_open_dyn_buf(&pb) < 0) \
482 avio_printf(pb, "%s", ctx->filter->name); \
484 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
486 avio_close_dyn_buf(pb, &f->name); \
536 memset(image[0], 0, h * linesize[0]);
556 ist->
st->r_frame_rate;
585 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
592 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
602 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
610 if ((ret =
avfilter_link(setpts, 0, first_filter, pad_idx)) < 0)
613 first_filter = setpts;
634 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
639 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
643 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
647 name, args.str,
NULL,
651 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
652 AVFilterContext *filt_ctx; \
654 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
655 "similarly to -af " filter_name "=%s.\n", arg); \
657 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
658 fg->index, filter_name, ist->file_index, ist->st->index); \
659 ret = avfilter_graph_create_filter(&filt_ctx, \
660 avfilter_get_by_name(filter_name), \
661 name, arg, NULL, fg->graph); \
665 ret = avfilter_link(filt_ctx, 0, first_filter, pad_idx); \
669 first_filter = filt_ctx; \
673 char args[256] = {0};
700 "audio filter instead.\n");
749 args[strlen(args)-1] = 0;
758 args[strlen(args) - 1] =
'\0';
765 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
767 "exactly one input and output.\n", graph_desc);
771 for (cur = inputs; !simple && init && cur; cur = cur->
next)
774 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
779 if (!init || simple) {
782 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
790 for (cur = outputs; cur;) {