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, fg->
graph);
391 if ((ret =
avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
404 snprintf(name,
sizeof(name),
"fps for output stream %d:%d",
407 name, args, NULL, fg->
graph);
418 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
421 &last_filter, &pad_idx, name);
446 name, NULL, NULL, fg->
graph);
452 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
453 AVFilterContext *filt_ctx; \
455 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
456 "similarly to -af " filter_name "=%s.\n", arg); \
458 ret = avfilter_graph_create_filter(&filt_ctx, \
459 avfilter_get_by_name(filter_name), \
460 filter_name, arg, NULL, fg->graph); \
464 ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
468 last_filter = filt_ctx; \
488 sample_fmts = choose_sample_fmts(ost);
489 sample_rates = choose_sample_rates(ost);
490 channel_layouts = choose_channel_layouts(ost);
491 if (sample_fmts || sample_rates || channel_layouts) {
500 av_strlcatf(args,
sizeof(args),
"sample_rates=%s:",
503 av_strlcatf(args,
sizeof(args),
"channel_layouts=%s:",
510 snprintf(name,
sizeof(name),
"audio format for output stream %d:%d",
514 name, args, NULL, fg->
graph);
522 last_filter = format;
541 if (i<of->ctx->nb_streams) {
547 snprintf(name,
sizeof(name),
"trim for output stream %d:%d",
550 &last_filter, &pad_idx, name);
560 #define DESCRIBE_FILTER_LINK(f, inout, in) \
562 AVFilterContext *ctx = inout->filter_ctx; \
563 AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
564 int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
567 if (avio_open_dyn_buf(&pb) < 0) \
570 avio_printf(pb, "%s", ctx->filter->name); \
572 avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
574 avio_close_dyn_buf(pb, &f->name); \
639 int ret, pad_idx = 0;
640 int64_t tsoffset = 0;
663 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
671 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
675 args.str, NULL, fg->
graph)) < 0)
677 last_filter = ifilter->
filter;
682 snprintf(name,
sizeof(name),
"force CFR for input from stream %d:%d",
693 last_filter = setpts;
699 snprintf(name,
sizeof(name),
"deinterlace input from stream %d:%d",
713 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
722 &last_filter, &pad_idx, name);
740 int ret, pad_idx = 0;
741 int64_t tsoffset = 0;
749 av_bprintf(&args,
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
754 av_bprintf(&args,
":channel_layout=0x%"PRIx64,
758 snprintf(name,
sizeof(name),
"graph %d input from stream %d:%d", fg->
index,
762 name, args.str, NULL,
765 last_filter = ifilter->
filter;
767 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
768 AVFilterContext *filt_ctx; \
770 av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
771 "similarly to -af " filter_name "=%s.\n", arg); \
773 snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
774 fg->index, filter_name, ist->file_index, ist->st->index); \
775 ret = avfilter_graph_create_filter(&filt_ctx, \
776 avfilter_get_by_name(filter_name), \
777 name, arg, NULL, fg->graph); \
781 ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
785 last_filter = filt_ctx; \
789 char args[256] = {0};
816 "audio filter instead.\n");
822 snprintf(name,
sizeof(name),
"trim for input stream %d:%d",
831 &last_filter, &pad_idx, name);
849 "No decoder for stream #%d:%d, filtering impossible\n",
885 args[strlen(args)-1] = 0;
894 args[strlen(args) - 1] =
'\0';
905 if (simple && (!inputs || inputs->
next || !outputs || outputs->
next)) {
907 "exactly one input and output.\n", graph_desc);
911 for (cur = inputs; !simple && init && cur; cur = cur->
next)
914 for (cur = inputs, i = 0; cur; cur = cur->
next, i++)
922 if (!init || simple) {
925 for (cur = outputs, i = 0; cur; cur = cur->
next, i++)
933 for (cur = outputs; cur;) {