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",
142 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
143 static char *choose_ ## var ## s(OutputStream *ost) \
145 if (ost->st->codec->var != none) { \
146 get_name(ost->st->codec->var); \
147 return av_strdup(name); \
148 } else if (ost->enc && ost->enc->supported_list) { \
150 AVIOContext *s = NULL; \
154 if (avio_open_dyn_buf(&s) < 0) \
157 for (p = ost->enc->supported_list; *p != none; p++) { \
159 avio_printf(s, "%s|", name); \
161 len = avio_close_dyn_buf(s, &ret); \
203 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
228 int file_idx = strtol(in->
name, &p, 0);
239 if (stream_type != type &&
261 if (i == nb_input_streams) {
263 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
286 const char *filter_name)
301 "recording time.\n", name);
309 if (duration != INT64_MAX) {
349 name, NULL, NULL, fg->
graph);
358 snprintf(args,
sizeof(args),
"%d:%d:0x%X",
362 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
365 name, args, NULL, fg->
graph)) < 0)
367 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
376 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
380 "format", pix_fmts, NULL,
385 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
398 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
401 name, args, NULL, fg->
graph);
412 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
415 &last_filter, &pad_idx, name);
440 name, NULL, NULL, fg->
graph);
446 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
447 AVFilterContext *filt_ctx; \
449 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
450 "similarly to -af " filter_name "=%s.\n", arg); \
452 ret = avfilter_graph_create_filter(&filt_ctx, \
453 avfilter_get_by_name(filter_name), \
454 filter_name, arg, NULL, fg->graph); \
458 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
462 last_filter = filt_ctx; \
482 sample_fmts = choose_sample_fmts(ost);
483 sample_rates = choose_sample_rates(ost);
484 channel_layouts = choose_channel_layouts(ost);
485 if (sample_fmts || sample_rates || channel_layouts) {
494 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
497 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
504 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
508 name, args, NULL, fg->
graph);
516 last_filter = format;
535 if (i<of->ctx->nb_streams) {
541 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
544 &last_filter, &pad_idx, name);
554 #define DESCRIBE_FILTER_LINK(f, inout, in) \
556 AVFilterContext *ctx = inout->filter_ctx; \
557 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
558 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
561 if (avio_open_dyn_buf(&pb) < 0) \
564 avio_printf(pb, "%s", ctx->filter->name); \
566 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
568 avio_close_dyn_buf(pb, &f->name); \
632 int ret, pad_idx = 0;
655 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
662 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
666 args.str, NULL, fg->
graph)) < 0)
668 last_filter = ifilter->
filter;
673 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
684 last_filter = setpts;
690 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
704 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
725 int ret, pad_idx = 0;
733 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
738 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
742 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
746 name, args.str, NULL,
749 last_filter = ifilter->
filter;
751 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
752 AVFilterContext *filt_ctx; \
754 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
755 "similarly to -af " filter_name "=%s.\n", arg); \
757 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
758 fg->index, filter_name, ist->file_index, ist->st->index); \
759 ret = avfilter_graph_create_filter(&filt_ctx, \
760 avfilter_get_by_name(filter_name), \
761 name, arg, NULL, fg->graph); \
765 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
769 last_filter = filt_ctx; \
773 char args[256] = {0};
800 "audio filter instead.\n");
806 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
857 args[strlen(args)-1] = 0;
866 args[strlen(args) - 1] =
'\0';
877 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
879 "exactly one input and output.\n", graph_desc);
883 for (cur = inputs; !simple && init && cur; cur = cur->
next)
886 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
891 if (!init || simple) {
894 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
902 for (cur = outputs; cur;) {