68 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
82 for (; *p != -1; p++) {
91 "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
149 #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
150 static char *choose_ ## var ## s(OutputStream *ost) \
152 if (ost->enc_ctx->var != none) { \
153 get_name(ost->enc_ctx->var); \
154 return av_strdup(name); \
155 } else if (ost->enc && ost->enc->supported_list) { \
157 AVIOContext *s = NULL; \
161 if (avio_open_dyn_buf(&s) < 0) \
164 for (p = ost->enc->supported_list; *p != none; p++) { \
166 avio_printf(s, "%s|", name); \
168 len = avio_close_dyn_buf(s, &ret); \
210 ist->filters[ist->nb_filters - 1] = fg->
inputs[0];
235 int file_idx = strtol(in->
name, &p, 0);
246 if (stream_type != type &&
268 if (i == nb_input_streams) {
270 "unlabeled input pad %d on filter %s\n", in->
pad_idx,
293 const char *filter_name)
308 "recording time.\n", name);
316 if (duration != INT64_MAX) {
356 name, NULL, NULL, fg->
graph);
365 snprintf(args,
sizeof(args),
"%d:%d:0x%X",
369 snprintf(name,
sizeof(name),
"scaler for output stream %d:%d",
372 name, args, NULL, fg->
graph)) < 0)
374 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
383 snprintf(name,
sizeof(name),
"pixel format for output stream %d:%d",
387 "format", pix_fmts, NULL,
392 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
405 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
408 name, args, NULL, fg->
graph);
419 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
422 &last_filter, &pad_idx, name);
447 name, NULL, NULL, fg->
graph);
453 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
454 AVFilterContext *filt_ctx; \
456 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
457 "similarly to -af " filter_name "=%s.\n", arg); \
459 ret = avfilter_graph_create_filter(&filt_ctx, \
460 avfilter_get_by_name(filter_name), \
461 filter_name, arg, NULL, fg->graph); \
465 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
469 last_filter = filt_ctx; \
489 sample_fmts = choose_sample_fmts(ost);
490 sample_rates = choose_sample_rates(ost);
491 channel_layouts = choose_channel_layouts(ost);
492 if (sample_fmts || sample_rates || channel_layouts) {
501 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
504 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
511 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
515 name, args, NULL, fg->
graph);
523 last_filter = format;
542 if (i<of->ctx->nb_streams) {
548 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
551 &last_filter, &pad_idx, name);
561 #define DESCRIBE_FILTER_LINK(f, inout, in) \
563 AVFilterContext *ctx = inout->filter_ctx; \
564 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
565 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
568 if (avio_open_dyn_buf(&pb) < 0) \
571 avio_printf(pb, "%s", ctx->filter->name); \
573 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
575 avio_close_dyn_buf(pb, &f->name); \
639 int ret, pad_idx = 0;
662 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
670 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
674 args.str, NULL, fg->
graph)) < 0)
676 last_filter = ifilter->
filter;
681 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
692 last_filter = setpts;
698 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
712 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
733 int ret, pad_idx = 0;
741 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
746 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
750 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
754 name, args.str, NULL,
757 last_filter = ifilter->
filter;
759 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
760 AVFilterContext *filt_ctx; \
762 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
763 "similarly to -af " filter_name "=%s.\n", arg); \
765 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
766 fg->index, filter_name, ist->file_index, ist->st->index); \
767 ret = avfilter_graph_create_filter(&filt_ctx, \
768 avfilter_get_by_name(filter_name), \
769 name, arg, NULL, fg->graph); \
773 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
777 last_filter = filt_ctx; \
781 char args[256] = {0};
808 "audio filter instead.\n");
814 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
865 args[strlen(args)-1] = 0;
874 args[strlen(args) - 1] =
'\0';
885 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
887 "exactly one input and output.\n", graph_desc);
891 for (cur = inputs; !simple && init && cur; cur = cur->
next)
894 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
899 if (!init || simple) {
902 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
910 for (cur = outputs; cur;) {