61 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
75 for (; *p != -1; p++) {
84 "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
137 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
138 static char *choose_ ## var ## s(OutputStream *ost) \
140 if (ost->st->codec->var != none) { \
141 get_name(ost->st->codec->var); \
142 return av_strdup(name); \
143 } else if (ost->enc && ost->enc->supported_list) { \
145 AVIOContext *s = NULL; \
149 if (avio_open_dyn_buf(&s) < 0) \
152 for (p = ost->enc->supported_list; *p != none; p++) { \
154 avio_printf(s, "%s|", name); \
156 len = avio_close_dyn_buf(s, &ret); \
198 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
223 int file_idx = strtol(in->
name, &p, 0);
234 if (stream_type != type &&
256 if (i == nb_input_streams) {
258 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
286 char filter_name[128];
299 "recording time.\n", name);
303 snprintf(filter_name,
sizeof(filter_name),
"%s for output stream %d:%d",
348 name, NULL, NULL, fg->
graph);
357 snprintf(args,
sizeof(args),
"%d:%d:0x%X",
361 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
364 name, args, NULL, fg->
graph)) < 0)
366 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
375 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
379 "format", pix_fmts, NULL,
384 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
397 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
400 name, args, NULL, fg->
graph);
436 name, NULL, NULL, fg->
graph);
442 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
443 AVFilterContext *filt_ctx; \
445 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
446 "similarly to -af " filter_name "=%s.\n", arg); \
448 ret = avfilter_graph_create_filter(&filt_ctx, \
449 avfilter_get_by_name(filter_name), \
450 filter_name, arg, NULL, fg->graph); \
454 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
458 last_filter = filt_ctx; \
478 sample_fmts = choose_sample_fmts(ost);
479 sample_rates = choose_sample_rates(ost);
480 channel_layouts = choose_channel_layouts(ost);
481 if (sample_fmts || sample_rates || channel_layouts) {
490 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
493 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
500 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
504 name, args, NULL, fg->
graph);
512 last_filter = format;
531 if (i<of->ctx->nb_streams) {
547 #define DESCRIBE_FILTER_LINK(f, inout, in) \
549 AVFilterContext *ctx = inout->filter_ctx; \
550 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
551 int nb_pads = in ? ctx->input_count : ctx->output_count; \
554 if (avio_open_dyn_buf(&pb) < 0) \
557 avio_printf(pb, "%s", ctx->filter->name); \
559 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
561 avio_close_dyn_buf(pb, &f->name); \
643 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
650 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
654 args.str, NULL, fg->
graph)) < 0)
660 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
668 if ((ret =
avfilter_link(setpts, 0, first_filter, pad_idx)) < 0)
671 first_filter = setpts;
678 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
686 if ((ret =
avfilter_link(yadif, 0, first_filter, pad_idx)) < 0)
689 first_filter = yadif;
710 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
715 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
719 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
723 name, args.str, NULL,
727 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
728 AVFilterContext *filt_ctx; \
730 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
731 "similarly to -af " filter_name "=%s.\n", arg); \
733 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
734 fg->index, filter_name, ist->file_index, ist->st->index); \
735 ret = avfilter_graph_create_filter(&filt_ctx, \
736 avfilter_get_by_name(filter_name), \
737 name, arg, NULL, fg->graph); \
741 ret = avfilter_link(filt_ctx, 0, first_filter, pad_idx); \
745 first_filter = filt_ctx; \
749 char args[256] = {0};
776 "audio filter instead.\n");
825 args[strlen(args)-1] = 0;
834 args[strlen(args) - 1] =
'\0';
841 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
843 "exactly one input and output.\n", graph_desc);
847 for (cur = inputs; !simple && init && cur; cur = cur->
next)
850 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
855 if (!init || simple) {
858 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
866 for (cur = outputs; cur;) {