63 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
77 for (; *p != -1; p++) {
86 "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
144 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
145 static char *choose_ ## var ## s(OutputStream *ost) \
147 if (ost->st->codec->var != none) { \
148 get_name(ost->st->codec->var); \
149 return av_strdup(name); \
150 } else if (ost->enc && ost->enc->supported_list) { \
152 AVIOContext *s = NULL; \
156 if (avio_open_dyn_buf(&s) < 0) \
159 for (p = ost->enc->supported_list; *p != none; p++) { \
161 avio_printf(s, "%s|", name); \
163 len = avio_close_dyn_buf(s, &ret); \
205 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
230 int file_idx = strtol(in->
name, &p, 0);
241 if (stream_type != type &&
263 if (i == nb_input_streams) {
265 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
288 const char *filter_name)
303 "recording time.\n", name);
311 if (duration != INT64_MAX) {
351 name, NULL, NULL, fg->
graph);
360 snprintf(args,
sizeof(args),
"%d:%d:0x%X",
364 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
367 name, args, NULL, fg->
graph)) < 0)
369 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
378 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
382 "format", pix_fmts, NULL,
387 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
400 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
403 name, args, NULL, fg->
graph);
414 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
417 &last_filter, &pad_idx, name);
442 name, NULL, NULL, fg->
graph);
448 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
449 AVFilterContext *filt_ctx; \
451 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
452 "similarly to -af " filter_name "=%s.\n", arg); \
454 ret = avfilter_graph_create_filter(&filt_ctx, \
455 avfilter_get_by_name(filter_name), \
456 filter_name, arg, NULL, fg->graph); \
460 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
464 last_filter = filt_ctx; \
484 sample_fmts = choose_sample_fmts(ost);
485 sample_rates = choose_sample_rates(ost);
486 channel_layouts = choose_channel_layouts(ost);
487 if (sample_fmts || sample_rates || channel_layouts) {
496 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
499 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
506 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
510 name, args, NULL, fg->
graph);
518 last_filter = format;
537 if (i<of->ctx->nb_streams) {
543 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
546 &last_filter, &pad_idx, name);
556 #define DESCRIBE_FILTER_LINK(f, inout, in) \
558 AVFilterContext *ctx = inout->filter_ctx; \
559 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
560 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
563 if (avio_open_dyn_buf(&pb) < 0) \
566 avio_printf(pb, "%s", ctx->filter->name); \
568 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
570 avio_close_dyn_buf(pb, &f->name); \
634 int ret, pad_idx = 0;
657 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
665 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
669 args.str, NULL, fg->
graph)) < 0)
671 last_filter = ifilter->
filter;
676 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
687 last_filter = setpts;
693 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
707 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
728 int ret, pad_idx = 0;
736 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
741 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
745 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
749 name, args.str, NULL,
752 last_filter = ifilter->
filter;
754 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
755 AVFilterContext *filt_ctx; \
757 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
758 "similarly to -af " filter_name "=%s.\n", arg); \
760 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
761 fg->index, filter_name, ist->file_index, ist->st->index); \
762 ret = avfilter_graph_create_filter(&filt_ctx, \
763 avfilter_get_by_name(filter_name), \
764 name, arg, NULL, fg->graph); \
768 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
772 last_filter = filt_ctx; \
776 char args[256] = {0};
803 "audio filter instead.\n");
809 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
860 args[strlen(args)-1] = 0;
869 args[strlen(args) - 1] =
'\0';
880 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
882 "exactly one input and output.\n", graph_desc);
886 for (cur = inputs; !simple && init && cur; cur = cur->
next)
889 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
894 if (!init || simple) {
897 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
905 for (cur = outputs; cur;) {