FFmpeg
ffmpeg_filter.c
Go to the documentation of this file.
1 /*
2  * ffmpeg filter configuration
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdint.h>
22 
23 #include "ffmpeg.h"
24 
25 #include "libavfilter/avfilter.h"
26 #include "libavfilter/buffersink.h"
27 #include "libavfilter/buffersrc.h"
28 
29 #include "libavutil/avassert.h"
30 #include "libavutil/avstring.h"
31 #include "libavutil/bprint.h"
33 #include "libavutil/display.h"
34 #include "libavutil/opt.h"
35 #include "libavutil/pixdesc.h"
36 #include "libavutil/pixfmt.h"
37 #include "libavutil/imgutils.h"
38 #include "libavutil/samplefmt.h"
39 
40 // FIXME: YUV420P etc. are actually supported with full color range,
41 // yet the latter information isn't available here.
42 static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *codec, const enum AVPixelFormat default_formats[])
43 {
44  static const enum AVPixelFormat mjpeg_formats[] =
47 
48  if (!strcmp(codec->name, "mjpeg")) {
49  return mjpeg_formats;
50  } else {
51  return default_formats;
52  }
53 }
54 
56  const AVCodec *codec, enum AVPixelFormat target)
57 {
58  if (codec && codec->pix_fmts) {
59  const enum AVPixelFormat *p = codec->pix_fmts;
61  //FIXME: This should check for AV_PIX_FMT_FLAG_ALPHA after PAL8 pixel format without alpha is implemented
62  int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
63  enum AVPixelFormat best= AV_PIX_FMT_NONE;
64 
66  p = get_compliance_normal_pix_fmts(codec, p);
67  }
68  for (; *p != AV_PIX_FMT_NONE; p++) {
69  best = av_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL);
70  if (*p == target)
71  break;
72  }
73  if (*p == AV_PIX_FMT_NONE) {
74  if (target != AV_PIX_FMT_NONE)
76  "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
77  av_get_pix_fmt_name(target),
78  codec->name,
79  av_get_pix_fmt_name(best));
80  return best;
81  }
82  }
83  return target;
84 }
85 
86 /* May return NULL (no pixel format found), a static string or a string
87  * backed by the bprint. Nothing has been written to the AVBPrint in case
88  * NULL is returned. The AVBPrint provided should be clean. */
89 static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
90 {
92  const AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
93  if (strict_dict)
94  // used by choose_pixel_fmt() and below
95  av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0);
96 
97  if (ost->keep_pix_fmt) {
101  return NULL;
103  }
104  if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
106  } else if (ost->enc && ost->enc->pix_fmts) {
107  const enum AVPixelFormat *p;
108 
109  p = ost->enc->pix_fmts;
112  }
113 
114  for (; *p != AV_PIX_FMT_NONE; p++) {
115  const char *name = av_get_pix_fmt_name(*p);
116  av_bprintf(bprint, "%s%c", name, p[1] == AV_PIX_FMT_NONE ? '\0' : '|');
117  }
118  if (!av_bprint_is_complete(bprint))
119  exit_program(1);
120  return bprint->str;
121  } else
122  return NULL;
123 }
124 
125 /* Define a function for appending a list of allowed formats
126  * to an AVBPrint. If nonempty, the list will have a header. */
127 #define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name) \
128 static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \
129 { \
130  if (ofilter->var == none && !ofilter->supported_list) \
131  return; \
132  av_bprintf(bprint, #name "="); \
133  if (ofilter->var != none) { \
134  av_bprintf(bprint, printf_format, get_name(ofilter->var)); \
135  } else { \
136  const type *p; \
137  \
138  for (p = ofilter->supported_list; *p != none; p++) { \
139  av_bprintf(bprint, printf_format "|", get_name(*p)); \
140  } \
141  if (bprint->len > 0) \
142  bprint->str[--bprint->len] = '\0'; \
143  } \
144  av_bprint_chars(bprint, ':', 1); \
145 }
146 
147 //DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, AV_PIX_FMT_NONE,
148 // GET_PIX_FMT_NAME)
149 
152 
154  "%d", )
155 
156 DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 0,
157  "0x%"PRIx64, )
158 
160 {
161  FilterGraph *fg = av_mallocz(sizeof(*fg));
164 
165  if (!fg)
166  exit_program(1);
168 
170  ofilter->ost = ost;
171  ofilter->graph = fg;
173 
175 
178  ifilter->graph = fg;
179  ifilter->format = -1;
180 
182  if (!ifilter->frame_queue)
183  exit_program(1);
184 
185  GROW_ARRAY(ist->filters, ist->nb_filters);
186  ist->filters[ist->nb_filters - 1] = ifilter;
187 
190 
191  return 0;
192 }
193 
194 static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in)
195 {
196  AVFilterContext *ctx = inout->filter_ctx;
197  AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
198  int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
199  char *res;
200 
201  if (nb_pads > 1)
202  res = av_strdup(ctx->filter->name);
203  else
204  res = av_asprintf("%s:%s", ctx->filter->name,
205  avfilter_pad_get_name(pads, inout->pad_idx));
206  if (!res)
207  exit_program(1);
208  return res;
209 }
210 
212 {
213  InputStream *ist = NULL;
216  int i;
217 
218  // TODO: support other filter types
220  av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported "
221  "currently.\n");
222  exit_program(1);
223  }
224 
225  if (in->name) {
227  AVStream *st = NULL;
228  char *p;
229  int file_idx = strtol(in->name, &p, 0);
230 
231  if (file_idx < 0 || file_idx >= nb_input_files) {
232  av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n",
233  file_idx, fg->graph_desc);
234  exit_program(1);
235  }
236  s = input_files[file_idx]->ctx;
237 
238  for (i = 0; i < s->nb_streams; i++) {
239  enum AVMediaType stream_type = s->streams[i]->codecpar->codec_type;
240  if (stream_type != type &&
241  !(stream_type == AVMEDIA_TYPE_SUBTITLE &&
242  type == AVMEDIA_TYPE_VIDEO /* sub2video hack */))
243  continue;
244  if (check_stream_specifier(s, s->streams[i], *p == ':' ? p + 1 : p) == 1) {
245  st = s->streams[i];
246  break;
247  }
248  }
249  if (!st) {
250  av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
251  "matches no streams.\n", p, fg->graph_desc);
252  exit_program(1);
253  }
254  ist = input_streams[input_files[file_idx]->ist_index + st->index];
255  if (ist->user_set_discard == AVDISCARD_ALL) {
256  av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
257  "matches a disabled input stream.\n", p, fg->graph_desc);
258  exit_program(1);
259  }
260  } else {
261  /* find the first unused stream of corresponding type */
262  for (i = 0; i < nb_input_streams; i++) {
263  ist = input_streams[i];
264  if (ist->user_set_discard == AVDISCARD_ALL)
265  continue;
266  if (ist->dec_ctx->codec_type == type && ist->discard)
267  break;
268  }
269  if (i == nb_input_streams) {
270  av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for "
271  "unlabeled input pad %d on filter %s\n", in->pad_idx,
272  in->filter_ctx->name);
273  exit_program(1);
274  }
275  }
276  av_assert0(ist);
277 
278  ist->discard = 0;
279  ist->decoding_needed |= DECODING_FOR_FILTER;
280  ist->st->discard = AVDISCARD_NONE;
281 
283  ifilter->ist = ist;
284  ifilter->graph = fg;
285  ifilter->format = -1;
286  ifilter->type = ist->st->codecpar->codec_type;
287  ifilter->name = describe_filter_link(fg, in, 1);
288 
289  ifilter->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
290  if (!ifilter->frame_queue)
291  exit_program(1);
292 
293  GROW_ARRAY(ist->filters, ist->nb_filters);
294  ist->filters[ist->nb_filters - 1] = ifilter;
295 }
296 
298 {
299  AVFilterInOut *inputs, *outputs, *cur;
301  int ret = 0;
302 
303  /* this graph is only used for determining the kinds of inputs
304  * and outputs we have, and is discarded on exit from this function */
306  if (!graph)
307  return AVERROR(ENOMEM);
308  graph->nb_threads = 1;
309 
311  if (ret < 0)
312  goto fail;
313 
314  for (cur = inputs; cur; cur = cur->next)
315  init_input_filter(fg, cur);
316 
317  for (cur = outputs; cur;) {
319 
320  ofilter->graph = fg;
321  ofilter->out_tmp = cur;
323  cur->pad_idx);
324  ofilter->name = describe_filter_link(fg, cur, 0);
325  cur = cur->next;
326  ofilter->out_tmp->next = NULL;
327  }
328 
329 fail:
332  return ret;
333 }
334 
335 static int insert_trim(int64_t start_time, int64_t duration,
336  AVFilterContext **last_filter, int *pad_idx,
337  const char *filter_name)
338 {
339  AVFilterGraph *graph = (*last_filter)->graph;
341  const AVFilter *trim;
342  enum AVMediaType type = avfilter_pad_get_type((*last_filter)->output_pads, *pad_idx);
343  const char *name = (type == AVMEDIA_TYPE_VIDEO) ? "trim" : "atrim";
344  int ret = 0;
345 
346  if (duration == INT64_MAX && start_time == AV_NOPTS_VALUE)
347  return 0;
348 
349  trim = avfilter_get_by_name(name);
350  if (!trim) {
351  av_log(NULL, AV_LOG_ERROR, "%s filter not present, cannot limit "
352  "recording time.\n", name);
354  }
355 
356  ctx = avfilter_graph_alloc_filter(graph, trim, filter_name);
357  if (!ctx)
358  return AVERROR(ENOMEM);
359 
360  if (duration != INT64_MAX) {
361  ret = av_opt_set_int(ctx, "durationi", duration,
363  }
364  if (ret >= 0 && start_time != AV_NOPTS_VALUE) {
365  ret = av_opt_set_int(ctx, "starti", start_time,
367  }
368  if (ret < 0) {
369  av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name);
370  return ret;
371  }
372 
374  if (ret < 0)
375  return ret;
376 
377  ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
378  if (ret < 0)
379  return ret;
380 
381  *last_filter = ctx;
382  *pad_idx = 0;
383  return 0;
384 }
385 
386 static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
387  const char *filter_name, const char *args)
388 {
389  AVFilterGraph *graph = (*last_filter)->graph;
391  int ret;
392 
394  avfilter_get_by_name(filter_name),
395  filter_name, args, NULL, graph);
396  if (ret < 0)
397  return ret;
398 
399  ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
400  if (ret < 0)
401  return ret;
402 
403  *last_filter = ctx;
404  *pad_idx = 0;
405  return 0;
406 }
407 
409 {
412  AVFilterContext *last_filter = out->filter_ctx;
413  AVBPrint bprint;
414  int pad_idx = out->pad_idx;
415  int ret;
416  const char *pix_fmts;
417  char name[255];
418 
419  snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
421  avfilter_get_by_name("buffersink"),
422  name, NULL, NULL, fg->graph);
423 
424  if (ret < 0)
425  return ret;
426 
427  if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) {
428  char args[255];
430  const AVDictionaryEntry *e = NULL;
431 
432  snprintf(args, sizeof(args), "%d:%d",
434 
435  while ((e = av_dict_get(ost->sws_dict, "", e,
437  av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
438  }
439 
440  snprintf(name, sizeof(name), "scaler_out_%d_%d",
441  ost->file_index, ost->index);
443  name, args, NULL, fg->graph)) < 0)
444  return ret;
445  if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
446  return ret;
447 
448  last_filter = filter;
449  pad_idx = 0;
450  }
451 
453  if ((pix_fmts = choose_pix_fmts(ofilter, &bprint))) {
455 
457  avfilter_get_by_name("format"),
458  "format", pix_fmts, NULL, fg->graph);
459  av_bprint_finalize(&bprint, NULL);
460  if (ret < 0)
461  return ret;
462  if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
463  return ret;
464 
465  last_filter = filter;
466  pad_idx = 0;
467  }
468 
469  if (ost->frame_rate.num && 0) {
470  AVFilterContext *fps;
471  char args[255];
472 
473  snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
474  ost->frame_rate.den);
475  snprintf(name, sizeof(name), "fps_out_%d_%d",
476  ost->file_index, ost->index);
478  name, args, NULL, fg->graph);
479  if (ret < 0)
480  return ret;
481 
482  ret = avfilter_link(last_filter, pad_idx, fps, 0);
483  if (ret < 0)
484  return ret;
485  last_filter = fps;
486  pad_idx = 0;
487  }
488 
489  snprintf(name, sizeof(name), "trim_out_%d_%d",
490  ost->file_index, ost->index);
492  &last_filter, &pad_idx, name);
493  if (ret < 0)
494  return ret;
495 
496 
497  if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
498  return ret;
499 
500  return 0;
501 }
502 
504 {
507  AVCodecContext *codec = ost->enc_ctx;
508  AVFilterContext *last_filter = out->filter_ctx;
509  int pad_idx = out->pad_idx;
510  AVBPrint args;
511  char name[255];
512  int ret;
513 
514  snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
516  avfilter_get_by_name("abuffersink"),
517  name, NULL, NULL, fg->graph);
518  if (ret < 0)
519  return ret;
520  if ((ret = av_opt_set_int(ofilter->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
521  return ret;
522 
523 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
524  AVFilterContext *filt_ctx; \
525  \
526  av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
527  "similarly to -af " filter_name "=%s.\n", arg); \
528  \
529  ret = avfilter_graph_create_filter(&filt_ctx, \
530  avfilter_get_by_name(filter_name), \
531  filter_name, arg, NULL, fg->graph); \
532  if (ret < 0) \
533  goto fail; \
534  \
535  ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
536  if (ret < 0) \
537  goto fail; \
538  \
539  last_filter = filt_ctx; \
540  pad_idx = 0; \
541 } while (0)
543  if (ost->audio_channels_mapped) {
544  int i;
545  av_bprintf(&args, "0x%"PRIx64,
547  for (i = 0; i < ost->audio_channels_mapped; i++)
548  if (ost->audio_channels_map[i] != -1)
549  av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]);
550 
551  AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
552  av_bprint_clear(&args);
553  }
554 
555  if (codec->channels && !codec->channel_layout)
557 
558  choose_sample_fmts(ofilter, &args);
559  choose_sample_rates(ofilter, &args);
560  choose_channel_layouts(ofilter, &args);
561  if (!av_bprint_is_complete(&args)) {
562  ret = AVERROR(ENOMEM);
563  goto fail;
564  }
565  if (args.len) {
567 
568  snprintf(name, sizeof(name), "format_out_%d_%d",
569  ost->file_index, ost->index);
571  avfilter_get_by_name("aformat"),
572  name, args.str, NULL, fg->graph);
573  if (ret < 0)
574  goto fail;
575 
576  ret = avfilter_link(last_filter, pad_idx, format, 0);
577  if (ret < 0)
578  goto fail;
579 
580  last_filter = format;
581  pad_idx = 0;
582  }
583 
584  if (ost->apad && of->shortest) {
585  int i;
586 
587  for (i=0; i<of->ctx->nb_streams; i++)
589  break;
590 
591  if (i<of->ctx->nb_streams) {
592  AUTO_INSERT_FILTER("-apad", "apad", ost->apad);
593  }
594  }
595 
596  snprintf(name, sizeof(name), "trim for output stream %d:%d",
597  ost->file_index, ost->index);
599  &last_filter, &pad_idx, name);
600  if (ret < 0)
601  goto fail;
602 
603  if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
604  goto fail;
605 fail:
606  av_bprint_finalize(&args, NULL);
607 
608  return ret;
609 }
610 
613 {
614  if (!ofilter->ost) {
615  av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", ofilter->name);
616  exit_program(1);
617  }
618 
619  switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) {
622  default: av_assert0(0); return 0;
623  }
624 }
625 
627 {
628  int i;
629  for (i = 0; i < nb_filtergraphs; i++) {
630  int n;
631  for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
632  OutputFilter *output = filtergraphs[i]->outputs[n];
633  if (!output->ost) {
634  av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
635  exit_program(1);
636  }
637  }
638  }
639 }
640 
642 {
643  AVFormatContext *avf = input_files[ist->file_index]->ctx;
644  int i, w, h;
645 
646  /* Compute the size of the canvas for the subtitles stream.
647  If the subtitles codecpar has set a size, use it. Otherwise use the
648  maximum dimensions of the video streams in the same file. */
649  w = ifilter->width;
650  h = ifilter->height;
651  if (!(w && h)) {
652  for (i = 0; i < avf->nb_streams; i++) {
654  w = FFMAX(w, avf->streams[i]->codecpar->width);
655  h = FFMAX(h, avf->streams[i]->codecpar->height);
656  }
657  }
658  if (!(w && h)) {
659  w = FFMAX(w, 720);
660  h = FFMAX(h, 576);
661  }
662  av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h);
663  }
664  ist->sub2video.w = ifilter->width = w;
665  ist->sub2video.h = ifilter->height = h;
666 
667  ifilter->width = ist->dec_ctx->width ? ist->dec_ctx->width : ist->sub2video.w;
668  ifilter->height = ist->dec_ctx->height ? ist->dec_ctx->height : ist->sub2video.h;
669 
670  /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the
671  palettes for all rectangles are identical or compatible */
673 
674  ist->sub2video.frame = av_frame_alloc();
675  if (!ist->sub2video.frame)
676  return AVERROR(ENOMEM);
677  ist->sub2video.last_pts = INT64_MIN;
678  ist->sub2video.end_pts = INT64_MIN;
679 
680  /* sub2video structure has been (re-)initialized.
681  Mark it as such so that the system will be
682  initialized with the first received heartbeat. */
683  ist->sub2video.initialize = 1;
684 
685  return 0;
686 }
687 
689  AVFilterInOut *in)
690 {
691  AVFilterContext *last_filter;
692  const AVFilter *buffer_filt = avfilter_get_by_name("buffer");
693  const AVPixFmtDescriptor *desc;
695  InputFile *f = input_files[ist->file_index];
696  AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
697  ist->st->time_base;
698  AVRational fr = ist->framerate;
699  AVRational sar;
700  AVBPrint args;
701  char name[255];
702  int ret, pad_idx = 0;
703  int64_t tsoffset = 0;
705 
706  if (!par)
707  return AVERROR(ENOMEM);
708  memset(par, 0, sizeof(*par));
709  par->format = AV_PIX_FMT_NONE;
710 
711  if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
712  av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n");
713  ret = AVERROR(EINVAL);
714  goto fail;
715  }
716 
717  if (!fr.num)
718  fr = av_guess_frame_rate(input_files[ist->file_index]->ctx, ist->st, NULL);
719 
720  if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
722  if (ret < 0)
723  goto fail;
724  }
725 
727  if(!sar.den)
728  sar = (AVRational){0,1};
730  av_bprintf(&args,
731  "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
732  "pixel_aspect=%d/%d",
734  tb.num, tb.den, sar.num, sar.den);
735  if (fr.num && fr.den)
736  av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den);
737  snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
738  ist->file_index, ist->st->index);
739 
740 
741  if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name,
742  args.str, NULL, fg->graph)) < 0)
743  goto fail;
746  if (ret < 0)
747  goto fail;
748  av_freep(&par);
749  last_filter = ifilter->filter;
750 
752  av_assert0(desc);
753 
754  // TODO: insert hwaccel enabled filters like transpose_vaapi into the graph
755  if (ist->autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
756  int32_t *displaymatrix = ifilter->displaymatrix;
757  double theta;
758 
759  if (!displaymatrix)
761  theta = get_rotation(displaymatrix);
762 
763  if (fabs(theta - 90) < 1.0) {
764  ret = insert_filter(&last_filter, &pad_idx, "transpose",
765  displaymatrix[3] > 0 ? "cclock_flip" : "clock");
766  } else if (fabs(theta - 180) < 1.0) {
767  if (displaymatrix[0] < 0) {
768  ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
769  if (ret < 0)
770  return ret;
771  }
772  if (displaymatrix[4] < 0) {
773  ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
774  }
775  } else if (fabs(theta - 270) < 1.0) {
776  ret = insert_filter(&last_filter, &pad_idx, "transpose",
777  displaymatrix[3] < 0 ? "clock_flip" : "cclock");
778  } else if (fabs(theta) > 1.0) {
779  char rotate_buf[64];
780  snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta);
781  ret = insert_filter(&last_filter, &pad_idx, "rotate", rotate_buf);
782  } else if (fabs(theta) < 1.0) {
783  if (displaymatrix && displaymatrix[4] < 0) {
784  ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
785  }
786  }
787  if (ret < 0)
788  return ret;
789  }
790 
791  snprintf(name, sizeof(name), "trim_in_%d_%d",
792  ist->file_index, ist->st->index);
793  if (copy_ts) {
794  tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
795  if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
796  tsoffset += f->ctx->start_time;
797  }
798  ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
799  AV_NOPTS_VALUE : tsoffset, f->recording_time,
800  &last_filter, &pad_idx, name);
801  if (ret < 0)
802  return ret;
803 
804  if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
805  return ret;
806  return 0;
807 fail:
808  av_freep(&par);
809 
810  return ret;
811 }
812 
814  AVFilterInOut *in)
815 {
816  AVFilterContext *last_filter;
817  const AVFilter *abuffer_filt = avfilter_get_by_name("abuffer");
819  InputFile *f = input_files[ist->file_index];
820  AVBPrint args;
821  char name[255];
822  int ret, pad_idx = 0;
823  int64_t tsoffset = 0;
824 
825  if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) {
826  av_log(NULL, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n");
827  return AVERROR(EINVAL);
828  }
829 
831  av_bprintf(&args, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s",
832  1, ifilter->sample_rate,
835  if (ifilter->channel_layout)
836  av_bprintf(&args, ":channel_layout=0x%"PRIx64,
838  else
839  av_bprintf(&args, ":channels=%d", ifilter->channels);
840  snprintf(name, sizeof(name), "graph_%d_in_%d_%d", fg->index,
841  ist->file_index, ist->st->index);
842 
843  if ((ret = avfilter_graph_create_filter(&ifilter->filter, abuffer_filt,
844  name, args.str, NULL,
845  fg->graph)) < 0)
846  return ret;
847  last_filter = ifilter->filter;
848 
849 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \
850  AVFilterContext *filt_ctx; \
851  \
852  av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
853  "similarly to -af " filter_name "=%s.\n", arg); \
854  \
855  snprintf(name, sizeof(name), "graph_%d_%s_in_%d_%d", \
856  fg->index, filter_name, ist->file_index, ist->st->index); \
857  ret = avfilter_graph_create_filter(&filt_ctx, \
858  avfilter_get_by_name(filter_name), \
859  name, arg, NULL, fg->graph); \
860  if (ret < 0) \
861  return ret; \
862  \
863  ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
864  if (ret < 0) \
865  return ret; \
866  \
867  last_filter = filt_ctx; \
868 } while (0)
869 
870  if (audio_sync_method > 0) {
871  char args[256] = {0};
872 
873  av_strlcatf(args, sizeof(args), "async=%d", audio_sync_method);
874  if (audio_drift_threshold != 0.1)
875  av_strlcatf(args, sizeof(args), ":min_hard_comp=%f", audio_drift_threshold);
876  if (!fg->reconfiguration)
877  av_strlcatf(args, sizeof(args), ":first_pts=0");
878  AUTO_INSERT_FILTER_INPUT("-async", "aresample", args);
879  }
880 
881 // if (ost->audio_channels_mapped) {
882 // int i;
883 // AVBPrint pan_buf;
884 // av_bprint_init(&pan_buf, 256, 8192);
885 // av_bprintf(&pan_buf, "0x%"PRIx64,
886 // av_get_default_channel_layout(ost->audio_channels_mapped));
887 // for (i = 0; i < ost->audio_channels_mapped; i++)
888 // if (ost->audio_channels_map[i] != -1)
889 // av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]);
890 // AUTO_INSERT_FILTER_INPUT("-map_channel", "pan", pan_buf.str);
891 // av_bprint_finalize(&pan_buf, NULL);
892 // }
893 
894  if (audio_volume != 256) {
895  char args[256];
896 
897  av_log(NULL, AV_LOG_WARNING, "-vol has been deprecated. Use the volume "
898  "audio filter instead.\n");
899 
900  snprintf(args, sizeof(args), "%f", audio_volume / 256.);
901  AUTO_INSERT_FILTER_INPUT("-vol", "volume", args);
902  }
903 
904  snprintf(name, sizeof(name), "trim for input stream %d:%d",
905  ist->file_index, ist->st->index);
906  if (copy_ts) {
907  tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
908  if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE)
909  tsoffset += f->ctx->start_time;
910  }
911  ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
912  AV_NOPTS_VALUE : tsoffset, f->recording_time,
913  &last_filter, &pad_idx, name);
914  if (ret < 0)
915  return ret;
916 
917  if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
918  return ret;
919 
920  return 0;
921 }
922 
924  AVFilterInOut *in)
925 {
926  if (!ifilter->ist->dec) {
928  "No decoder for stream #%d:%d, filtering impossible\n",
931  }
932  switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
935  default: av_assert0(0); return 0;
936  }
937 }
938 
940 {
941  int i;
942  for (i = 0; i < fg->nb_outputs; i++)
943  fg->outputs[i]->filter = (AVFilterContext *)NULL;
944  for (i = 0; i < fg->nb_inputs; i++)
945  fg->inputs[i]->filter = (AVFilterContext *)NULL;
947 }
948 
950 {
951  return f->nb_inputs == 0 &&
952  (!strcmp(f->filter->name, "buffersrc") ||
953  !strcmp(f->filter->name, "abuffersrc"));
954 }
955 
957 {
958  for (unsigned i = 0; i < graph->nb_filters; i++) {
959  const AVFilterContext *f = graph->filters[i];
960 
961  /* in addition to filters flagged as meta, also
962  * disregard sinks and buffersources (but not other sources,
963  * since they introduce data we are not aware of)
964  */
965  if (!((f->filter->flags & AVFILTER_FLAG_METADATA_ONLY) ||
966  f->nb_outputs == 0 ||
968  return 0;
969  }
970  return 1;
971 }
972 
974 {
975  AVFilterInOut *inputs, *outputs, *cur;
976  int ret, i, simple = filtergraph_is_simple(fg);
977  const char *graph_desc = simple ? fg->outputs[0]->ost->avfilter :
978  fg->graph_desc;
979 
981  if (!(fg->graph = avfilter_graph_alloc()))
982  return AVERROR(ENOMEM);
983 
984  if (simple) {
985  OutputStream *ost = fg->outputs[0]->ost;
986  char args[512];
987  const AVDictionaryEntry *e = NULL;
988 
989  if (filter_nbthreads) {
990  ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
991  if (ret < 0)
992  goto fail;
993  } else {
994  e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
995  if (e)
996  av_opt_set(fg->graph, "threads", e->value, 0);
997  }
998 
999  args[0] = 0;
1000  e = NULL;
1001  while ((e = av_dict_get(ost->sws_dict, "", e,
1003  av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
1004  }
1005  if (strlen(args)) {
1006  args[strlen(args)-1] = 0;
1007  fg->graph->scale_sws_opts = av_strdup(args);
1008  }
1009 
1010  args[0] = 0;
1011  e = NULL;
1012  while ((e = av_dict_get(ost->swr_opts, "", e,
1014  av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
1015  }
1016  if (strlen(args))
1017  args[strlen(args)-1] = 0;
1018  av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
1019  } else {
1021  }
1022 
1023  if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
1024  goto fail;
1025 
1027  if (ret < 0)
1028  goto fail;
1029 
1030  if (simple && (!inputs || inputs->next || !outputs || outputs->next)) {
1031  const char *num_inputs;
1032  const char *num_outputs;
1033  if (!outputs) {
1034  num_outputs = "0";
1035  } else if (outputs->next) {
1036  num_outputs = ">1";
1037  } else {
1038  num_outputs = "1";
1039  }
1040  if (!inputs) {
1041  num_inputs = "0";
1042  } else if (inputs->next) {
1043  num_inputs = ">1";
1044  } else {
1045  num_inputs = "1";
1046  }
1047  av_log(NULL, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
1048  "to have exactly 1 input and 1 output."
1049  " However, it had %s input(s) and %s output(s)."
1050  " Please adjust, or use a complex filtergraph (-filter_complex) instead.\n",
1051  graph_desc, num_inputs, num_outputs);
1052  ret = AVERROR(EINVAL);
1053  goto fail;
1054  }
1055 
1056  for (cur = inputs, i = 0; cur; cur = cur->next, i++)
1057  if ((ret = configure_input_filter(fg, fg->inputs[i], cur)) < 0) {
1060  goto fail;
1061  }
1063 
1064  for (cur = outputs, i = 0; cur; cur = cur->next, i++)
1065  configure_output_filter(fg, fg->outputs[i], cur);
1067 
1070  if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
1071  goto fail;
1072 
1073  fg->is_meta = graph_is_meta(fg->graph);
1074 
1075  /* limit the lists of allowed formats to the ones selected, to
1076  * make sure they stay the same if the filtergraph is reconfigured later */
1077  for (i = 0; i < fg->nb_outputs; i++) {
1078  OutputFilter *ofilter = fg->outputs[i];
1079  AVFilterContext *sink = ofilter->filter;
1080 
1082 
1085 
1088  }
1089 
1090  fg->reconfiguration = 1;
1091 
1092  for (i = 0; i < fg->nb_outputs; i++) {
1093  OutputStream *ost = fg->outputs[i]->ost;
1094  if (!ost->enc) {
1095  /* identical to the same check in ffmpeg.c, needed because
1096  complex filter graphs are initialized earlier */
1097  av_log(NULL, AV_LOG_ERROR, "Encoder (codec %s) not found for output stream #%d:%d\n",
1099  ret = AVERROR(EINVAL);
1100  goto fail;
1101  }
1102  if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
1103  !(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
1105  ost->enc_ctx->frame_size);
1106  }
1107 
1108  for (i = 0; i < fg->nb_inputs; i++) {
1109  while (av_fifo_size(fg->inputs[i]->frame_queue)) {
1110  AVFrame *tmp;
1111  av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
1113  av_frame_free(&tmp);
1114  if (ret < 0)
1115  goto fail;
1116  }
1117  }
1118 
1119  /* send the EOFs for the finished inputs */
1120  for (i = 0; i < fg->nb_inputs; i++) {
1121  if (fg->inputs[i]->eof) {
1123  if (ret < 0)
1124  goto fail;
1125  }
1126  }
1127 
1128  /* process queued up subtitle packets */
1129  for (i = 0; i < fg->nb_inputs; i++) {
1130  InputStream *ist = fg->inputs[i]->ist;
1131  if (ist->sub2video.sub_queue && ist->sub2video.frame) {
1132  while (av_fifo_size(ist->sub2video.sub_queue)) {
1133  AVSubtitle tmp;
1134  av_fifo_generic_read(ist->sub2video.sub_queue, &tmp, sizeof(tmp), NULL);
1135  sub2video_update(ist, INT64_MIN, &tmp);
1136  avsubtitle_free(&tmp);
1137  }
1138  }
1139  }
1140 
1141  return 0;
1142 
1143 fail:
1144  cleanup_filtergraph(fg);
1145  return ret;
1146 }
1147 
1149 {
1150  AVFrameSideData *sd;
1151 
1153 
1154  ifilter->format = frame->format;
1155 
1156  ifilter->width = frame->width;
1157  ifilter->height = frame->height;
1158  ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
1159 
1160  ifilter->sample_rate = frame->sample_rate;
1161  ifilter->channels = frame->channels;
1162  ifilter->channel_layout = frame->channel_layout;
1163 
1166  if (sd)
1167  ifilter->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9);
1168 
1169  if (frame->hw_frames_ctx) {
1170  ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
1171  if (!ifilter->hw_frames_ctx)
1172  return AVERROR(ENOMEM);
1173  }
1174 
1175  return 0;
1176 }
1177 
1179 {
1180  return !fg->graph_desc;
1181 }
AVSubtitle
Definition: avcodec.h:2289
formats
formats
Definition: signature.h:48
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1012
init_complex_filtergraph
int init_complex_filtergraph(FilterGraph *fg)
Definition: ffmpeg_filter.c:297
ost
OutputStream * ost
Definition: ffmpeg_filter.c:160
InputFilter::sample_aspect_ratio
AVRational sample_aspect_ratio
Definition: ffmpeg.h:250
AVCodec
AVCodec.
Definition: codec.h:202
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
audio_sync_method
int audio_sync_method
Definition: ffmpeg_opt.c:149
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
OutputFilter::graph
struct FilterGraph * graph
Definition: ffmpeg.h:265
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
nb_input_files
int nb_input_files
Definition: ffmpeg.c:151
opt.h
OutputStream::enc
AVCodecContext * enc
Definition: muxing.c:56
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
AVFilterGraph::nb_threads
int nb_threads
Maximum number of threads used by filters in this graph.
Definition: avfilter.h:887
avfilter_pad_get_name
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
Definition: avfilter.c:972
AVCodecContext::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1043
InputFilter::width
int width
Definition: ffmpeg.h:249
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:234
InputFilter::displaymatrix
int32_t * displaymatrix
Definition: ffmpeg.h:257
out
FILE * out
Definition: movenc.c:54
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:68
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:617
FilterGraph::graph_desc
const char * graph_desc
Definition: ffmpeg.h:288
ALLOC_ARRAY_ELEM
#define ALLOC_ARRAY_ELEM(array, nb_elems)
Definition: cmdutils.h:647
OutputStream::enc_ctx
AVCodecContext * enc_ctx
Definition: ffmpeg.h:473
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2660
FilterGraph::inputs
InputFilter ** inputs
Definition: ffmpeg.h:296
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
OutputStream::keep_pix_fmt
int keep_pix_fmt
Definition: ffmpeg.h:541
AVCodec::pix_fmts
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
Definition: codec.h:224
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:109
OutputFile::start_time
int64_t start_time
start time in microseconds == AV_TIME_BASE units
Definition: ffmpeg.h:581
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
AVFilterInOut::next
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
Definition: avfilter.h:1032
pixdesc.h
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1268
w
uint8_t w
Definition: llviddspenc.c:38
OutputStream::index
int index
Definition: ffmpeg.h:453
ist
ifilter ist
Definition: ffmpeg_filter.c:177
av_buffersrc_add_frame
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:146
FilterGraph::index
int index
Definition: ffmpeg.h:287
check_filter_outputs
void check_filter_outputs(void)
Definition: ffmpeg_filter.c:626
AV_DICT_IGNORE_SUFFIX
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
Definition: dict.h:68
OutputStream::sws_dict
AVDictionary * sws_dict
Definition: ffmpeg.h:522
ffmpeg.h
FilterGraph::nb_inputs
int nb_inputs
Definition: ffmpeg.h:297
AV_FRAME_DATA_DISPLAYMATRIX
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:84
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilterContext::output_pads
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:413
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
av_fifo_generic_read
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
Definition: fifo.c:219
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:101
sample_rate
sample_rate
Definition: ffmpeg_filter.c:153
FF_COMPLIANCE_UNOFFICIAL
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
Definition: avcodec.h:1284
AVFILTER_AUTO_CONVERT_NONE
@ AVFILTER_AUTO_CONVERT_NONE
all automatic conversions disabled
Definition: avfilter.h:994
avfilter_graph_free
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
Definition: avfiltergraph.c:121
InputFilter::channel_layout
uint64_t channel_layout
Definition: ffmpeg.h:254
InputFilter::ist
struct InputStream * ist
Definition: ffmpeg.h:239
init_simple_filtergraph
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
configure_filtergraph
int configure_filtergraph(FilterGraph *fg)
Definition: ffmpeg_filter.c:973
AUTO_INSERT_FILTER
#define AUTO_INSERT_FILTER(opt_name, filter_name, arg)
av_memdup
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Definition: mem.c:311
exit_program
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
Definition: cmdutils.c:128
InputStream
Definition: ffmpeg.h:302
filter_nbthreads
char * filter_nbthreads
Definition: ffmpeg_opt.c:166
avfilter_graph_create_filter
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
Definition: avfiltergraph.c:140
av_buffersink_set_frame_size
void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
Set the frame size for an audio buffer sink.
Definition: buffersink.c:198
avfilter_graph_alloc_filter
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
Definition: avfiltergraph.c:167
graph
ofilter graph
Definition: ffmpeg_filter.c:171
fail
#define fail()
Definition: checkasm.h:128
InputFilter::type
enum AVMediaType type
Definition: ffmpeg.h:242
avfilter_graph_alloc
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
Definition: avfiltergraph.c:84
AV_PIX_FMT_FLAG_HWACCEL
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition: pixdesc.h:128
samplefmt.h
AVDISCARD_NONE
@ AVDISCARD_NONE
discard nothing
Definition: defs.h:48
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
OutputFilter::sample_rate
int sample_rate
Definition: ffmpeg.h:276
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
InputFilter::frame_queue
AVFifoBuffer * frame_queue
Definition: ffmpeg.h:244
AV_PKT_DATA_DISPLAYMATRIX
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: packet.h:108
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:468
graph_is_meta
static int graph_is_meta(AVFilterGraph *graph)
Definition: ffmpeg_filter.c:956
AVRational::num
int num
Numerator.
Definition: rational.h:59
InputFile
Definition: ffmpeg.h:399
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: avcodec.c:425
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:97
AVFilterContext::input_pads
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:409
check_stream_specifier
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
Definition: cmdutils.c:2112
OutputFile::shortest
int shortest
Definition: ffmpeg.h:584
avfilter_inout_free
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
Definition: graphparser.c:212
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
duration
int64_t duration
Definition: movenc.c:64
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:40
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
OutputFilter::width
int width
Definition: ffmpeg.h:273
input_streams
InputStream ** input_streams
Definition: ffmpeg.c:148
s
#define s(width, name)
Definition: cbs_vp9.c:257
FilterGraph::outputs
OutputFilter ** outputs
Definition: ffmpeg.h:298
configure_input_audio_filter
static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
Definition: ffmpeg_filter.c:813
AVDictionaryEntry::key
char * key
Definition: dict.h:80
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:126
OutputStream::audio_channels_mapped
int audio_channels_mapped
Definition: ffmpeg.h:511
InputFilter
Definition: ffmpeg.h:237
av_buffersink_get_format
int av_buffersink_get_format(const AVFilterContext *ctx)
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:172
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
OutputFilter::ost
struct OutputStream * ost
Definition: ffmpeg.h:264
OutputStream::avfilter
char * avfilter
Definition: ffmpeg.h:517
ctx
AVFormatContext * ctx
Definition: movenc.c:48
audio_drift_threshold
float audio_drift_threshold
Definition: ffmpeg_opt.c:144
InputFilter::graph
struct FilterGraph * graph
Definition: ffmpeg.h:240
av_get_sample_fmt_name
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition: samplefmt.c:49
f
#define f(width, name)
Definition: cbs_vp9.c:255
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
OutputStream::encoder_opts
AVDictionary * encoder_opts
Definition: ffmpeg.h:521
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:54
AVFormatContext
Format I/O context.
Definition: avformat.h:1200
avfilter_get_by_name
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
Definition: allfilters.c:579
OutputFilter::height
int height
Definition: ffmpeg.h:273
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1095
OutputFilter::name
uint8_t * name
Definition: ffmpeg.h:266
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
avfilter_graph_config
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
Definition: avfiltergraph.c:1156
NULL
#define NULL
Definition: coverity.c:32
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
InputStream::st
AVStream * st
Definition: ffmpeg.h:304
avfilter_graph_set_auto_convert
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
Definition: avfiltergraph.c:162
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AVFilterContext::name
char * name
name of this filter instance
Definition: avfilter.h:407
OutputStream::audio_channels_map
int * audio_channels_map
Definition: ffmpeg.h:510
InputFilter::channels
int channels
Definition: ffmpeg.h:253
OutputStream::frame_rate
AVRational frame_rate
Definition: ffmpeg.h:486
InputFilter::eof
int eof
Definition: ffmpeg.h:259
AV_CODEC_CAP_VARIABLE_FRAME_SIZE
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
Definition: codec.h:134
OutputFilter::channel_layout
uint64_t channel_layout
Definition: ffmpeg.h:277
AVFilterGraph
Definition: avfilter.h:861
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
nb_input_streams
int nb_input_streams
Definition: ffmpeg.c:149
avfilter_graph_parse2
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
Definition: graphparser.c:418
av_buffersink_get_channel_layout
uint64_t av_buffersink_get_channel_layout(const AVFilterContext *ctx)
FilterGraph::nb_outputs
int nb_outputs
Definition: ffmpeg.h:299
av_opt_set_int
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
Definition: opt.c:589
input_files
InputFile ** input_files
Definition: ffmpeg.c:150
av_bprint_is_complete
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Definition: bprint.h:185
FilterGraph
Definition: ffmpeg.h:286
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1256
InputFilter::filter
AVFilterContext * filter
Definition: ffmpeg.h:238
AVFilterInOut::pad_idx
int pad_idx
index of the filt_ctx pad to use for linking
Definition: avfilter.h:1029
AVFilterGraph::scale_sws_opts
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
Definition: avfilter.h:866
OutputStream::filter
OutputFilter * filter
Definition: ffmpeg.h:516
AVMediaType
AVMediaType
Definition: avutil.h:199
av_buffersrc_parameters_alloc
AVBufferSrcParameters * av_buffersrc_parameters_alloc(void)
Allocate a new AVBufferSrcParameters instance.
Definition: buffersrc.c:86
InputStream::file_index
int file_index
Definition: ffmpeg.h:303
AVFilterInOut::filter_ctx
AVFilterContext * filter_ctx
filter context associated to this input/output
Definition: avfilter.h:1026
output_files
OutputFile ** output_files
Definition: ffmpeg.c:155
avfilter_link
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
Definition: avfilter.c:161
AVBufferSrcParameters::hw_frames_ctx
AVBufferRef * hw_frames_ctx
Video with a hwaccel pixel format only.
Definition: buffersrc.h:106
start_time
static int64_t start_time
Definition: ffplay.c:330
FilterGraph::graph
AVFilterGraph * graph
Definition: ffmpeg.h:290
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
insert_trim
static int insert_trim(int64_t start_time, int64_t duration, AVFilterContext **last_filter, int *pad_idx, const char *filter_name)
Definition: ffmpeg_filter.c:335
copy_ts
int copy_ts
Definition: ffmpeg_opt.c:156
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
av_guess_frame_rate
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
Definition: utils.c:1387
AVFrameSideData::data
uint8_t * data
Definition: frame.h:225
format
ofilter format
Definition: ffmpeg_filter.c:172
sub2video_update
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
Definition: ffmpeg.c:241
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:559
OutputFilter::filter
AVFilterContext * filter
Definition: ffmpeg.h:263
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:377
filter_is_buffersrc
static int filter_is_buffersrc(const AVFilterContext *f)
Definition: ffmpeg_filter.c:949
OutputFilter::type
enum AVMediaType type
Definition: ffmpeg.h:270
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
sample_rates
sample_rates
Definition: ffmpeg_filter.c:153
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:993
avfilter_init_str
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
Definition: avfilter.c:938
buffersink.h
choose_pixel_fmt
static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, const AVCodec *codec, enum AVPixelFormat target)
Definition: ffmpeg_filter.c:55
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:443
ifilter_parameters_from_frame
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
Definition: ffmpeg_filter.c:1148
av_buffersink_get_w
int av_buffersink_get_w(const AVFilterContext *ctx)
OutputStream::apad
char * apad
Definition: ffmpeg.h:524
bprint.h
av_buffersrc_parameters_set
int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param)
Initialize the buffersrc or abuffersrc filter with the provided parameters.
Definition: buffersrc.c:97
DECODING_FOR_FILTER
#define DECODING_FOR_FILTER
Definition: ffmpeg.h:309
configure_input_filter
static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
Definition: ffmpeg_filter.c:923
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
configure_output_filter
static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
Definition: ffmpeg_filter.c:611
AVCodecParameters::height
int height
Definition: codec_par.h:127
display.h
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
hw_device_setup_for_filter
int hw_device_setup_for_filter(FilterGraph *fg)
Definition: ffmpeg_hw.c:551
InputFile::ctx
AVFormatContext * ctx
Definition: ffmpeg.h:400
tb
#define tb
Definition: regdef.h:68
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:263
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:209
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
init_input_filter
static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
Definition: ffmpeg_filter.c:211
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:593
av_buffersink_get_h
int av_buffersink_get_h(const AVFilterContext *ctx)
AVFilter
Filter definition.
Definition: avfilter.h:165
ofilter
OutputFilter * ofilter
Definition: ffmpeg_filter.c:162
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:935
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:174
pixfmt.h
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
InputFilter::name
uint8_t * name
Definition: ffmpeg.h:241
AVCodecContext::strict_std_compliance
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
Definition: avcodec.h:1280
GROW_ARRAY
GROW_ARRAY(ist->filters, ist->nb_filters)
insert_filter
static int insert_filter(AVFilterContext **last_filter, int *pad_idx, const char *filter_name, const char *args)
Definition: ffmpeg_filter.c:386
av_stream_get_side_data
uint8_t * av_stream_get_side_data(const AVStream *stream, enum AVPacketSideDataType type, size_t *size)
Get side information from stream.
Definition: utils.c:1721
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:93
InputFile::ist_index
int ist_index
Definition: ffmpeg.h:403
ifilter
InputFilter * ifilter
Definition: ffmpeg_filter.c:163
get_compliance_normal_pix_fmts
static enum AVPixelFormat * get_compliance_normal_pix_fmts(const AVCodec *codec, const enum AVPixelFormat default_formats[])
Definition: ffmpeg_filter.c:42
InputFilter::sample_rate
int sample_rate
Definition: ffmpeg.h:252
avfilter_pad_get_type
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
Definition: avfilter.c:977
OutputFilter::format
int format
Definition: ffmpeg.h:275
configure_input_video_filter
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
Definition: ffmpeg_filter.c:688
AVCodecContext
main external API structure.
Definition: avcodec.h:383
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:943
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:226
av_find_best_pix_fmt_of_2
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another.
Definition: pixdesc.c:2951
DEF_CHOOSE_FORMAT
#define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name)
Definition: ffmpeg_filter.c:127
channel_layout.h
AVBufferSrcParameters
This structure contains the parameters describing the frames that will be passed to this filter.
Definition: buffersrc.h:73
av_buffersink_get_sample_rate
int av_buffersink_get_sample_rate(const AVFilterContext *ctx)
InputFilter::format
int format
Definition: ffmpeg.h:247
AVBufferSrcParameters::format
int format
video: the pixel format, value corresponds to enum AVPixelFormat audio: the sample format,...
Definition: buffersrc.h:78
describe_filter_link
static char * describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in)
Definition: ffmpeg_filter.c:194
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
avfilter.h
FilterGraph::is_meta
int is_meta
Definition: ffmpeg.h:294
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:137
InputFilter::height
int height
Definition: ffmpeg.h:249
AVERROR_FILTER_NOT_FOUND
#define AVERROR_FILTER_NOT_FOUND
Filter not found.
Definition: error.h:60
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
OutputFilter
Definition: ffmpeg.h:262
cleanup_filtergraph
static void cleanup_filtergraph(FilterGraph *fg)
Definition: ffmpeg_filter.c:939
AVERROR_DECODER_NOT_FOUND
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
Definition: error.h:54
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:279
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
start_at_zero
int start_at_zero
Definition: ffmpeg_opt.c:157
OutputStream::file_index
int file_index
Definition: ffmpeg.h:452
audio_volume
int audio_volume
Definition: ffmpeg_opt.c:148
OutputFile::ctx
AVFormatContext * ctx
Definition: ffmpeg.h:577
OutputFilter::out_tmp
AVFilterInOut * out_tmp
Definition: ffmpeg.h:269
av_get_default_channel_layout
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
Definition: channel_layout.c:231
auto_conversion_filters
int auto_conversion_filters
Definition: ffmpeg_opt.c:169
av_fifo_size
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
Definition: fifo.c:71
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:223
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
OutputStream::autoscale
int autoscale
Definition: ffmpeg.h:493
InputFilter::hw_frames_ctx
AVBufferRef * hw_frames_ctx
Definition: ffmpeg.h:256
AVDictionaryEntry
Definition: dict.h:79
choose_pix_fmts
static const char * choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
Definition: ffmpeg_filter.c:89
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
channel_layouts
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:114
FilterGraph::reconfiguration
int reconfiguration
Definition: ffmpeg.h:291
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
filtergraph_is_simple
int filtergraph_is_simple(FilterGraph *fg)
Definition: ffmpeg_filter.c:1178
nb_filtergraphs
int nb_filtergraphs
Definition: ffmpeg.c:159
AVFilterInOut::name
char * name
unique name for this input/output in the list
Definition: avfilter.h:1023
d
d
Definition: ffmpeg_filter.c:153
int32_t
int32_t
Definition: audioconvert.c:56
av_fifo_alloc
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
Definition: fifo.c:44
imgutils.h
OutputStream
Definition: muxing.c:54
OutputStream::st
AVStream * st
Definition: muxing.c:55
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
configure_output_video_filter
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
Definition: ffmpeg_filter.c:408
h
h
Definition: vp9dsp_template.c:2038
AVDictionaryEntry::value
char * value
Definition: dict.h:81
get_rotation
double get_rotation(int32_t *displaymatrix)
Definition: cmdutils.c:2229
avstring.h
OutputStream::swr_opts
AVDictionary * swr_opts
Definition: ffmpeg.h:523
OutputFile::recording_time
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
Definition: ffmpeg.h:580
AVFilterInOut
A linked-list of the inputs/outputs of the filter chain.
Definition: avfilter.h:1021
InputStream::dec
const AVCodec * dec
Definition: ffmpeg.h:312
snprintf
#define snprintf
Definition: snprintf.h:34
filter
ost filter
Definition: ffmpeg_filter.c:174
buffersrc.h
AUTO_INSERT_FILTER_INPUT
#define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg)
configure_output_audio_filter
static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
Definition: ffmpeg_filter.c:503
filtergraphs
filtergraphs[nb_filtergraphs - 1]
Definition: ffmpeg_filter.c:189
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2580
filter_complex_nbthreads
int filter_complex_nbthreads
Definition: ffmpeg_opt.c:167
OutputFile
Definition: ffmpeg.h:576
sub2video_prepare
static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
Definition: ffmpeg_filter.c:641