FFmpeg
ffmpeg_opt.c
Go to the documentation of this file.
1 /*
2  * ffmpeg option parsing
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 "config.h"
22 
23 #include <stdint.h>
24 
25 #if HAVE_SYS_RESOURCE_H
26 #include <sys/time.h>
27 #include <sys/resource.h>
28 #endif
29 
30 #include "ffmpeg.h"
31 #include "ffmpeg_sched.h"
32 #include "cmdutils.h"
33 #include "opt_common.h"
34 
35 #include "libavformat/avformat.h"
36 
37 #include "libavcodec/avcodec.h"
38 #include "libavcodec/bsf.h"
39 
40 #include "libavfilter/avfilter.h"
41 
42 #include "libavutil/avassert.h"
43 #include "libavutil/avstring.h"
44 #include "libavutil/avutil.h"
45 #include "libavutil/mathematics.h"
46 #include "libavutil/mem.h"
47 #include "libavutil/opt.h"
48 #include "libavutil/parseutils.h"
49 #include "libavutil/stereo3d.h"
50 #include "graph/graphprint.h"
51 
53 
55 
57 float dts_error_threshold = 3600*30;
58 
60 int do_benchmark = 0;
62 int do_hex_dump = 0;
63 int do_pkt_dump = 0;
64 int copy_ts = 0;
65 int start_at_zero = 0;
66 int copy_tb = -1;
67 int debug_ts = 0;
68 int exit_on_error = 0;
70 int print_stats = -1;
72 float max_error_rate = 2.0/3;
77 int print_graphs = 0;
82 
83 
84 static int file_overwrite = 0;
85 static int no_file_overwrite = 0;
88 int recast_media = 0;
89 
90 // this struct is passed as the optctx argument
91 // to func_arg() for global options
92 typedef struct GlobalOptionsContext {
94 
95  char **filtergraphs;
98 
100 {
101  /* all OPT_SPEC and OPT_TYPE_STRING can be freed in generic way */
102  for (const OptionDef *po = options; po->name; po++) {
103  void *dst;
104 
105  if (!(po->flags & OPT_FLAG_OFFSET))
106  continue;
107 
108  dst = (uint8_t*)o + po->u.off;
109  if (po->flags & OPT_FLAG_SPEC) {
110  SpecifierOptList *so = dst;
111  for (int i = 0; i < so->nb_opt; i++) {
112  av_freep(&so->opt[i].specifier);
113  if (po->flags & OPT_FLAG_PERSTREAM)
115  if (po->type == OPT_TYPE_STRING)
116  av_freep(&so->opt[i].u.str);
117  }
118  av_freep(&so->opt);
119  so->nb_opt = 0;
120  } else if (po->type == OPT_TYPE_STRING)
121  av_freep(dst);
122  }
123 
124  for (int i = 0; i < o->nb_stream_maps; i++)
126  av_freep(&o->stream_maps);
127 
128  for (int i = 0; i < o->nb_attachments; i++)
129  av_freep(&o->attachments[i]);
130  av_freep(&o->attachments);
131 
132  av_dict_free(&o->streamid);
133 }
134 
136 {
137  memset(o, 0, sizeof(*o));
138 
139  o->stop_time = INT64_MAX;
140  o->mux_max_delay = 0.7;
143  o->recording_time = INT64_MAX;
144  o->limit_filesize = INT64_MAX;
145  o->chapters_input_file = INT_MAX;
146  o->accurate_seek = 1;
147  o->thread_queue_size = 0;
148  o->input_sync_ref = -1;
149  o->find_stream_info = 1;
150  o->shortest_buf_duration = 10.f;
151 }
152 
153 static int show_hwaccels(void *optctx, const char *opt, const char *arg)
154 {
156 
157  printf("Hardware acceleration methods:\n");
158  while ((type = av_hwdevice_iterate_types(type)) !=
161  printf("\n");
162  return 0;
163 }
164 
166  char mediatype)
167 {
168  av_assert0(!sol->nb_opt || sol->type == OPT_TYPE_STRING);
169 
170  for (int i = 0; i < sol->nb_opt; i++) {
171  const char *spec = sol->opt[i].specifier;
172  if (spec[0] == mediatype && !spec[1])
173  return sol->opt[i].u.str;
174  }
175  return NULL;
176 }
177 
178 static unsigned opt_match_per_stream(void *logctx, enum OptionType type,
179  const SpecifierOptList *sol,
181 {
182  int matches = 0, match_idx = -1;
183 
184  av_assert0((type == sol->type) || !sol->nb_opt);
185 
186  for (int i = 0; i < sol->nb_opt; i++) {
187  const StreamSpecifier *ss = &sol->opt[i].stream_spec;
188 
189  if (stream_specifier_match(ss, fc, st, logctx)) {
190  match_idx = i;
191  matches++;
192  }
193  }
194 
195  if (matches > 1 && sol->opt_canon) {
196  const SpecifierOpt *so = &sol->opt[match_idx];
197  const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";
198 
199  char namestr[128] = "";
200  char optval_buf[32];
201  const char *optval = optval_buf;
202 
203  snprintf(namestr, sizeof(namestr), "-%s", sol->opt_canon->name);
204  if (sol->opt_canon->flags & OPT_HAS_ALT) {
205  const char * const *names_alt = sol->opt_canon->u1.names_alt;
206  for (int i = 0; names_alt[i]; i++)
207  av_strlcatf(namestr, sizeof(namestr), "/-%s", names_alt[i]);
208  }
209 
210  switch (sol->type) {
211  case OPT_TYPE_STRING: optval = so->u.str; break;
212  case OPT_TYPE_INT: snprintf(optval_buf, sizeof(optval_buf), "%d", so->u.i); break;
213  case OPT_TYPE_INT64: snprintf(optval_buf, sizeof(optval_buf), "%"PRId64, so->u.i64); break;
214  case OPT_TYPE_FLOAT: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.f); break;
215  case OPT_TYPE_DOUBLE: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.dbl); break;
216  default: av_assert0(0);
217  }
218 
219  av_log(logctx, AV_LOG_WARNING, "Multiple %s options specified for "
220  "stream %d, only the last option '-%s%s%s %s' will be used.\n",
221  namestr, st->index, sol->opt_canon->name, spec[0] ? ":" : "",
222  spec, optval);
223  }
224 
225  return match_idx + 1;
226 }
227 
228 #define OPT_MATCH_PER_STREAM(name, type, opt_type, m) \
229 void opt_match_per_stream_ ## name(void *logctx, const SpecifierOptList *sol, \
230  AVFormatContext *fc, AVStream *st, type *out) \
231 { \
232  unsigned ret = opt_match_per_stream(logctx, opt_type, sol, fc, st); \
233  if (ret > 0) \
234  *out = sol->opt[ret - 1].u.m; \
235 }
236 
237 OPT_MATCH_PER_STREAM(str, const char *, OPT_TYPE_STRING, str);
240 OPT_MATCH_PER_STREAM(dbl, double, OPT_TYPE_DOUBLE, dbl);
241 
242 static unsigned opt_match_per_stream_group(void *logctx, enum OptionType type,
243  const SpecifierOptList *sol,
245 {
246  int matches = 0, match_idx = -1;
247 
248  av_assert0((type == sol->type) || !sol->nb_opt);
249 
250  for (int i = 0; i < sol->nb_opt; i++) {
251  const StreamSpecifier *ss = &sol->opt[i].stream_spec;
252 
253  if (stream_group_specifier_match(ss, fc, stg, logctx)) {
254  match_idx = i;
255  matches++;
256  }
257  }
258 
259  if (matches > 1 && sol->opt_canon) {
260  const SpecifierOpt *so = &sol->opt[match_idx];
261  const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";
262 
263  char namestr[128] = "";
264  char optval_buf[32];
265  const char *optval = optval_buf;
266 
267  snprintf(namestr, sizeof(namestr), "-%s", sol->opt_canon->name);
268  if (sol->opt_canon->flags & OPT_HAS_ALT) {
269  const char * const *names_alt = sol->opt_canon->u1.names_alt;
270  for (int i = 0; names_alt[i]; i++)
271  av_strlcatf(namestr, sizeof(namestr), "/-%s", names_alt[i]);
272  }
273 
274  switch (sol->type) {
275  case OPT_TYPE_STRING: optval = so->u.str; break;
276  case OPT_TYPE_INT: snprintf(optval_buf, sizeof(optval_buf), "%d", so->u.i); break;
277  case OPT_TYPE_INT64: snprintf(optval_buf, sizeof(optval_buf), "%"PRId64, so->u.i64); break;
278  case OPT_TYPE_FLOAT: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.f); break;
279  case OPT_TYPE_DOUBLE: snprintf(optval_buf, sizeof(optval_buf), "%f", so->u.dbl); break;
280  default: av_assert0(0);
281  }
282 
283  av_log(logctx, AV_LOG_WARNING, "Multiple %s options specified for "
284  "stream group %d, only the last option '-%s%s%s %s' will be used.\n",
285  namestr, stg->index, sol->opt_canon->name, spec[0] ? ":" : "",
286  spec, optval);
287  }
288 
289  return match_idx + 1;
290 }
291 
292 #define OPT_MATCH_PER_STREAM_GROUP(name, type, opt_type, m) \
293 void opt_match_per_stream_group_ ## name(void *logctx, const SpecifierOptList *sol, \
294  AVFormatContext *fc, AVStreamGroup *stg, type *out) \
295 { \
296  unsigned ret = opt_match_per_stream_group(logctx, opt_type, sol, fc, stg); \
297  if (ret > 0) \
298  *out = sol->opt[ret - 1].u.m; \
299 }
300 
301 OPT_MATCH_PER_STREAM_GROUP(str, const char *, OPT_TYPE_STRING, str);
305 
306 int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
307 {
308  const char *spec = *pspec;
309  char *endptr;
310 
312 
313  if (!strncmp(spec, "view:", 5)) {
314  spec += 5;
315 
316  if (!strncmp(spec, "all", 3)) {
317  spec += 3;
319  } else {
321  vs->val = strtoul(spec, &endptr, 0);
322  if (endptr == spec) {
323  av_log(NULL, AV_LOG_ERROR, "Invalid view ID: %s\n", spec);
324  return AVERROR(EINVAL);
325  }
326  spec = endptr;
327  }
328  } else if (!strncmp(spec, "vidx:", 5)) {
329  spec += 5;
331  vs->val = strtoul(spec, &endptr, 0);
332  if (endptr == spec) {
333  av_log(NULL, AV_LOG_ERROR, "Invalid view index: %s\n", spec);
334  return AVERROR(EINVAL);
335  }
336  spec = endptr;
337  } else if (!strncmp(spec, "vpos:", 5)) {
338  spec += 5;
340 
341  if (!strncmp(spec, "left", 4) && !cmdutils_isalnum(spec[4])) {
342  spec += 4;
344  } else if (!strncmp(spec, "right", 5) && !cmdutils_isalnum(spec[5])) {
345  spec += 5;
347  } else {
348  av_log(NULL, AV_LOG_ERROR, "Invalid view position: %s\n", spec);
349  return AVERROR(EINVAL);
350  }
351  } else
352  return 0;
353 
354  *pspec = spec;
355 
356  return 0;
357 }
358 
359 int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx)
360 {
361  if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
362  else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR;
363  else if (!av_strcasecmp(arg, "passthrough")) *vsync_var = VSYNC_PASSTHROUGH;
364  else if (!av_strcasecmp(arg, "auto")) *vsync_var = VSYNC_AUTO;
365  else {
366  av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx);
367  return AVERROR(EINVAL);
368  }
369 
370  return 0;
371 }
372 
373 /* Correct input file start times based on enabled streams */
374 static void correct_input_start_times(void)
375 {
376  for (int i = 0; i < nb_input_files; i++) {
377  InputFile *ifile = input_files[i];
378  AVFormatContext *is = ifile->ctx;
379  int64_t new_start_time = INT64_MAX, diff, abs_start_seek;
380 
381  ifile->start_time_effective = is->start_time;
382 
383  if (is->start_time == AV_NOPTS_VALUE ||
384  !(is->iformat->flags & AVFMT_TS_DISCONT))
385  continue;
386 
387  for (int j = 0; j < is->nb_streams; j++) {
388  AVStream *st = is->streams[j];
389  if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)
390  continue;
391  new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));
392  }
393 
394  diff = new_start_time - is->start_time;
395  if (diff) {
396  av_log(NULL, AV_LOG_VERBOSE, "Correcting start time of Input #%d by %"PRId64" us.\n", i, diff);
397  ifile->start_time_effective = new_start_time;
398  if (copy_ts && start_at_zero)
399  ifile->ts_offset = -new_start_time;
400  else if (!copy_ts) {
401  abs_start_seek = is->start_time + ((ifile->start_time != AV_NOPTS_VALUE) ? ifile->start_time : 0);
402  ifile->ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
403  } else if (copy_ts)
404  ifile->ts_offset = 0;
405 
406  ifile->ts_offset += ifile->input_ts_offset;
407  }
408  }
409 }
410 
411 static int apply_sync_offsets(void)
412 {
413  for (int i = 0; i < nb_input_files; i++) {
414  InputFile *ref, *self = input_files[i];
415  int64_t adjustment;
416  int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
417  int start_times_set = 1;
418 
419  if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
420  if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) {
421  av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref);
422  return AVERROR(EINVAL);
423  }
424 
425  if (copy_ts && !start_at_zero) {
426  av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n");
427  return AVERROR(EINVAL);
428  }
429 
430  ref = input_files[self->input_sync_ref];
431  if (ref->input_sync_ref != -1 && ref->input_sync_ref != self->input_sync_ref) {
432  av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced input %d. Sync not set.\n", i, self->input_sync_ref);
433  continue;
434  }
435 
436  if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && ref->ctx->start_time_realtime != AV_NOPTS_VALUE) {
437  self_start_time = self->ctx->start_time_realtime;
438  ref_start_time = ref->ctx->start_time_realtime;
439  } else if (self->start_time_effective != AV_NOPTS_VALUE && ref->start_time_effective != AV_NOPTS_VALUE) {
440  self_start_time = self->start_time_effective;
441  ref_start_time = ref->start_time_effective;
442  } else {
443  start_times_set = 0;
444  }
445 
446  if (start_times_set) {
447  self_seek_start = self->start_time == AV_NOPTS_VALUE ? 0 : self->start_time;
448  ref_seek_start = ref->start_time == AV_NOPTS_VALUE ? 0 : ref->start_time;
449 
450  adjustment = (self_start_time - ref_start_time) + !copy_ts*(self_seek_start - ref_seek_start) + ref->input_ts_offset;
451 
452  self->ts_offset += adjustment;
453 
454  av_log(NULL, AV_LOG_INFO, "Adjusted ts offset for Input #%d by %"PRId64" us to sync with Input #%d.\n", i, adjustment, self->input_sync_ref);
455  } else {
456  av_log(NULL, AV_LOG_INFO, "Unable to identify start times for Inputs #%d and %d both. No sync adjustment made.\n", i, self->input_sync_ref);
457  }
458  }
459 
460  return 0;
461 }
462 
463 static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
464 {
467  return 0;
468 }
469 
470 static int opt_abort_on(void *optctx, const char *opt, const char *arg)
471 {
472  static const AVOption opts[] = {
473  { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, (double)INT64_MAX, .unit = "flags" },
474  { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT }, .unit = "flags" },
475  { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" },
476  { NULL },
477  };
478  static const AVClass class = {
479  .class_name = "",
480  .item_name = av_default_item_name,
481  .option = opts,
482  .version = LIBAVUTIL_VERSION_INT,
483  };
484  const AVClass *pclass = &class;
485 
486  return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags);
487 }
488 
489 static int opt_stats_period(void *optctx, const char *opt, const char *arg)
490 {
491  int64_t user_stats_period;
492  int ret = av_parse_time(&user_stats_period, arg, 1);
493  if (ret < 0)
494  return ret;
495 
496  if (user_stats_period <= 0) {
497  av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg);
498  return AVERROR(EINVAL);
499  }
500 
501  stats_period = user_stats_period;
502  av_log(NULL, AV_LOG_INFO, "ffmpeg stats and -progress period set to %s.\n", arg);
503 
504  return 0;
505 }
506 
507 static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
508 {
509  OptionsContext *o = optctx;
510  return parse_option(o, "codec:a", arg, options);
511 }
512 
513 static int opt_video_codec(void *optctx, const char *opt, const char *arg)
514 {
515  OptionsContext *o = optctx;
516  return parse_option(o, "codec:v", arg, options);
517 }
518 
519 static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
520 {
521  OptionsContext *o = optctx;
522  return parse_option(o, "codec:s", arg, options);
523 }
524 
525 static int opt_data_codec(void *optctx, const char *opt, const char *arg)
526 {
527  OptionsContext *o = optctx;
528  return parse_option(o, "codec:d", arg, options);
529 }
530 
531 static int opt_map(void *optctx, const char *opt, const char *arg)
532 {
533  OptionsContext *o = optctx;
534  StreamMap *m = NULL;
536  int i, negative = 0, file_idx, disabled = 0;
537  int ret, allow_unused = 0;
538 
539  memset(&ss, 0, sizeof(ss));
540 
541  if (*arg == '-') {
542  negative = 1;
543  arg++;
544  }
545 
546  if (arg[0] == '[') {
547  ViewSpecifier vs;
548  /* this mapping refers to lavfi output */
549  const char *c = arg + 1;
550  char *endptr;
551 
553  if (ret < 0)
554  goto fail;
555 
556  m = &o->stream_maps[o->nb_stream_maps - 1];
557  m->linklabel = av_get_token(&c, "]");
558  if (!m->linklabel) {
559  av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", arg);
560  ret = AVERROR(EINVAL);
561  goto fail;
562  }
563 
564  arg++;
565 
566  m->group_index = -1;
567  file_idx = strtol(arg, &endptr, 0);
568  if (file_idx >= nb_input_files || file_idx < 0)
569  goto end;
570 
571  arg = endptr;
572  ret = stream_specifier_parse(&ss, *arg == ':' ? arg + 1 : arg, 1, NULL);
573  if (ret < 0)
574  goto end;
575 
576  arg = ss.remainder ? ss.remainder : "";
577  ret = view_specifier_parse(&arg, &vs);
578  if (ret < 0 || (*arg && strcmp(arg, "]")))
579  goto end;
580 
581  m->file_index = file_idx;
582  m->stream_index = ss.idx;
583  m->group_index = ss.stream_list == STREAM_LIST_GROUP_IDX ? ss.list_id : -1;
584  } else {
585  ViewSpecifier vs;
586  char *endptr;
587 
588  file_idx = strtol(arg, &endptr, 0);
589  if (file_idx >= nb_input_files || file_idx < 0) {
590  av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
591  ret = AVERROR(EINVAL);
592  goto fail;
593  }
594  arg = endptr;
595 
596  ret = stream_specifier_parse(&ss, *arg == ':' ? arg + 1 : arg, 1, NULL);
597  if (ret < 0) {
598  av_log(NULL, AV_LOG_ERROR, "Invalid stream specifier: %s\n", arg);
599  goto fail;
600  }
601 
602  arg = ss.remainder ? ss.remainder : "";
603 
604  ret = view_specifier_parse(&arg, &vs);
605  if (ret < 0)
606  goto fail;
607 
608  if (*arg) {
609  if (!strcmp(arg, "?"))
610  allow_unused = 1;
611  else {
613  "Trailing garbage after stream specifier: %s\n", arg);
614  ret = AVERROR(EINVAL);
615  goto fail;
616  }
617  }
618 
619  if (negative)
620  /* disable some already defined maps */
621  for (i = 0; i < o->nb_stream_maps; i++) {
622  m = &o->stream_maps[i];
623  if (file_idx == m->file_index &&
624  !m->linklabel &&
625  m->stream_index >= 0 &&
630  NULL))
631  m->disabled = 1;
632  }
633  else
634  for (i = 0; i < input_files[file_idx]->nb_streams; i++) {
636  input_files[file_idx]->ctx,
637  input_files[file_idx]->ctx->streams[i],
638  NULL))
639  continue;
640  if (input_files[file_idx]->streams[i]->user_set_discard == AVDISCARD_ALL) {
641  disabled = 1;
642  continue;
643  }
645  if (ret < 0)
646  goto fail;
647 
648  m = &o->stream_maps[o->nb_stream_maps - 1];
649 
650  m->file_index = file_idx;
651  m->stream_index = i;
652  m->group_index = ss.stream_list == STREAM_LIST_GROUP_IDX ? ss.list_id : -1;
653  m->vs = vs;
654  }
655  }
656 
657  if (!m) {
658  if (allow_unused) {
659  av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; ignoring.\n", arg);
660  } else if (disabled) {
661  av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches disabled streams.\n"
662  "To ignore this, add a trailing '?' to the map.\n", arg);
663  ret = AVERROR(EINVAL);
664  goto fail;
665  } else {
666  av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
667  "To ignore this, add a trailing '?' to the map.\n", arg);
668  ret = AVERROR(EINVAL);
669  goto fail;
670  }
671  }
672 end:
673  ret = 0;
674 fail:
676  return ret;
677 }
678 
679 static int opt_attach(void *optctx, const char *opt, const char *arg)
680 {
681  OptionsContext *o = optctx;
683  if (ret < 0)
684  return ret;
685 
686  o->attachments[o->nb_attachments - 1] = av_strdup(arg);
687  if (!o->attachments[o->nb_attachments - 1])
688  return AVERROR(ENOMEM);
689 
690  return 0;
691 }
692 
693 static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
694 {
695  GlobalOptionsContext *go = optctx;
696  return sch_sdp_filename(go->sch, arg);
697 }
698 
699 #if CONFIG_VAAPI
700 static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
701 {
702  const char *prefix = "vaapi:";
703  char *tmp;
704  int err;
705  tmp = av_asprintf("%s%s", prefix, arg);
706  if (!tmp)
707  return AVERROR(ENOMEM);
709  av_free(tmp);
710  return err;
711 }
712 #endif
713 
714 #if CONFIG_QSV
715 static int opt_qsv_device(void *optctx, const char *opt, const char *arg)
716 {
717  const char *prefix = "qsv=__qsv_device:hw_any,child_device=";
718  int err;
719  char *tmp = av_asprintf("%s%s", prefix, arg);
720 
721  if (!tmp)
722  return AVERROR(ENOMEM);
723 
725  av_free(tmp);
726 
727  return err;
728 }
729 #endif
730 
731 static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
732 {
733  if (!strcmp(arg, "list")) {
735  printf("Supported hardware device types:\n");
736  while ((type = av_hwdevice_iterate_types(type)) !=
739  printf("\n");
740  return AVERROR_EXIT;
741  } else {
743  }
744 }
745 
746 static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
747 {
748  if (filter_hw_device) {
749  av_log(NULL, AV_LOG_ERROR, "Only one filter device can be used.\n");
750  return AVERROR(EINVAL);
751  }
753  if (!filter_hw_device) {
754  av_log(NULL, AV_LOG_ERROR, "Invalid filter device %s.\n", arg);
755  return AVERROR(EINVAL);
756  }
757  return 0;
758 }
759 
760 static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
761 {
762  OptionsContext *o = optctx;
763  char buf[128];
764  int64_t recording_timestamp;
765  int ret;
766  struct tm time;
767 
768  ret = av_parse_time(&recording_timestamp, arg, 0);
769  if (ret < 0)
770  return ret;
771 
772  recording_timestamp /= 1e6;
773  time = *gmtime((time_t*)&recording_timestamp);
774  if (!strftime(buf, sizeof(buf), "creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
775  return -1;
776  parse_option(o, "metadata", buf, options);
777 
778  av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
779  "tag instead.\n", opt);
780  return 0;
781 }
782 
783 int find_codec(void *logctx, const char *name,
784  enum AVMediaType type, int encoder, const AVCodec **pcodec)
785 {
786  const AVCodecDescriptor *desc;
787  const char *codec_string = encoder ? "encoder" : "decoder";
788  const AVCodec *codec;
789 
790  codec = encoder ?
793 
794  if (!codec && (desc = avcodec_descriptor_get_by_name(name))) {
795  codec = encoder ? avcodec_find_encoder(desc->id) :
797  if (codec)
798  av_log(logctx, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n",
799  codec_string, codec->name, desc->name);
800  }
801 
802  if (!codec) {
803  av_log(logctx, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
804  return encoder ? AVERROR_ENCODER_NOT_FOUND :
806  }
807  if (codec->type != type && !recast_media) {
808  av_log(logctx, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
809  return AVERROR(EINVAL);
810  }
811 
812  *pcodec = codec;
813  return 0;;
814 }
815 
816 int assert_file_overwrite(const char *filename)
817 {
818  const char *proto_name = avio_find_protocol_name(filename);
819 
821  fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n");
822  return AVERROR(EINVAL);
823  }
824 
825  if (!file_overwrite) {
826  if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) {
828  fprintf(stderr,"File '%s' already exists. Overwrite? [y/N] ", filename);
829  fflush(stderr);
830  term_exit();
831  signal(SIGINT, SIG_DFL);
832  if (!read_yesno()) {
833  av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n");
834  return AVERROR_EXIT;
835  }
836  term_init();
837  }
838  else {
839  av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
840  return AVERROR_EXIT;
841  }
842  }
843  }
844 
845  if (proto_name && !strcmp(proto_name, "file")) {
846  for (int i = 0; i < nb_input_files; i++) {
847  InputFile *file = input_files[i];
848  if (file->ctx->iformat->flags & AVFMT_NOFILE)
849  continue;
850  if (!strcmp(filename, file->ctx->url)) {
851  av_log(NULL, AV_LOG_FATAL, "Output %s same as Input #%d - exiting\n", filename, i);
852  av_log(NULL, AV_LOG_WARNING, "FFmpeg cannot edit existing files in-place.\n");
853  return AVERROR(EINVAL);
854  }
855  }
856  }
857 
858  return 0;
859 }
860 
861 /* arg format is "output-stream-index:streamid-value". */
862 static int opt_streamid(void *optctx, const char *opt, const char *arg)
863 {
864  OptionsContext *o = optctx;
865  char *p;
866  char idx_str[16];
867 
868  av_strlcpy(idx_str, arg, sizeof(idx_str));
869  p = strchr(idx_str, ':');
870  if (!p) {
872  "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
873  arg, opt);
874  return AVERROR(EINVAL);
875  }
876  *p++ = '\0';
877 
878  return av_dict_set(&o->streamid, idx_str, p, 0);
879 }
880 
881 static int opt_target(void *optctx, const char *opt, const char *arg)
882 {
883  OptionsContext *o = optctx;
884  enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
885  static const char *const frame_rates[] = { "25", "30000/1001", "24000/1001" };
886 
887  if (!strncmp(arg, "pal-", 4)) {
888  norm = PAL;
889  arg += 4;
890  } else if (!strncmp(arg, "ntsc-", 5)) {
891  norm = NTSC;
892  arg += 5;
893  } else if (!strncmp(arg, "film-", 5)) {
894  norm = FILM;
895  arg += 5;
896  } else {
897  /* Try to determine PAL/NTSC by peeking in the input files */
898  if (nb_input_files) {
899  int i, j;
900  for (j = 0; j < nb_input_files; j++) {
901  for (i = 0; i < input_files[j]->nb_streams; i++) {
902  AVStream *st = input_files[j]->ctx->streams[i];
903  int64_t fr;
905  continue;
906  fr = st->time_base.den * 1000LL / st->time_base.num;
907  if (fr == 25000) {
908  norm = PAL;
909  break;
910  } else if ((fr == 29970) || (fr == 23976)) {
911  norm = NTSC;
912  break;
913  }
914  }
915  if (norm != UNKNOWN)
916  break;
917  }
918  }
919  if (norm != UNKNOWN)
920  av_log(NULL, AV_LOG_INFO, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
921  }
922 
923  if (norm == UNKNOWN) {
924  av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
925  av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
926  av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n");
927  return AVERROR(EINVAL);
928  }
929 
930  if (!strcmp(arg, "vcd")) {
931  opt_video_codec(o, "c:v", "mpeg1video");
932  opt_audio_codec(o, "c:a", "mp2");
933  parse_option(o, "f", "vcd", options);
934 
935  parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
936  parse_option(o, "r", frame_rates[norm], options);
937  opt_default(NULL, "g", norm == PAL ? "15" : "18");
938 
939  opt_default(NULL, "b:v", "1150000");
940  opt_default(NULL, "maxrate:v", "1150000");
941  opt_default(NULL, "minrate:v", "1150000");
942  opt_default(NULL, "bufsize:v", "327680"); // 40*1024*8;
943 
944  opt_default(NULL, "b:a", "224000");
945  parse_option(o, "ar", "44100", options);
946  parse_option(o, "ac", "2", options);
947 
948  opt_default(NULL, "packetsize", "2324");
949  opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;
950 
951  /* We have to offset the PTS, so that it is consistent with the SCR.
952  SCR starts at 36000, but the first two packs contain only padding
953  and the first pack from the other stream, respectively, may also have
954  been written before.
955  So the real data starts at SCR 36000+3*1200. */
956  o->mux_preload = (36000 + 3 * 1200) / 90000.0; // 0.44
957  } else if (!strcmp(arg, "svcd")) {
958 
959  opt_video_codec(o, "c:v", "mpeg2video");
960  opt_audio_codec(o, "c:a", "mp2");
961  parse_option(o, "f", "svcd", options);
962 
963  parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
964  parse_option(o, "r", frame_rates[norm], options);
965  parse_option(o, "pix_fmt", "yuv420p", options);
966  opt_default(NULL, "g", norm == PAL ? "15" : "18");
967 
968  opt_default(NULL, "b:v", "2040000");
969  opt_default(NULL, "maxrate:v", "2516000");
970  opt_default(NULL, "minrate:v", "0"); // 1145000;
971  opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
972  opt_default(NULL, "scan_offset", "1");
973 
974  opt_default(NULL, "b:a", "224000");
975  parse_option(o, "ar", "44100", options);
976 
977  opt_default(NULL, "packetsize", "2324");
978 
979  } else if (!strcmp(arg, "dvd")) {
980 
981  opt_video_codec(o, "c:v", "mpeg2video");
982  opt_audio_codec(o, "c:a", "ac3");
983  parse_option(o, "f", "dvd", options);
984 
985  parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
986  parse_option(o, "r", frame_rates[norm], options);
987  parse_option(o, "pix_fmt", "yuv420p", options);
988  opt_default(NULL, "g", norm == PAL ? "15" : "18");
989 
990  opt_default(NULL, "b:v", "6000000");
991  opt_default(NULL, "maxrate:v", "9000000");
992  opt_default(NULL, "minrate:v", "0"); // 1500000;
993  opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
994 
995  opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
996  opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
997 
998  opt_default(NULL, "b:a", "448000");
999  parse_option(o, "ar", "48000", options);
1000 
1001  } else if (!strncmp(arg, "dv", 2)) {
1002 
1003  parse_option(o, "f", "dv", options);
1004 
1005  parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
1006  parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
1007  norm == PAL ? "yuv420p" : "yuv411p", options);
1008  parse_option(o, "r", frame_rates[norm], options);
1009 
1010  parse_option(o, "ar", "48000", options);
1011  parse_option(o, "ac", "2", options);
1012 
1013  } else {
1014  av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg);
1015  return AVERROR(EINVAL);
1016  }
1017 
1020 
1021  return 0;
1022 }
1023 
1024 static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
1025 {
1028  return 0;
1029 }
1030 
1031 static int opt_vstats(void *optctx, const char *opt, const char *arg)
1032 {
1033  char filename[40];
1034  time_t today2 = time(NULL);
1035  struct tm *today = localtime(&today2);
1036 
1037  if (!today) { // maybe tomorrow
1038  av_log(NULL, AV_LOG_FATAL, "Unable to get current time: %s\n", strerror(errno));
1039  return AVERROR(errno);
1040  }
1041 
1042  snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
1043  today->tm_sec);
1044  return opt_vstats_file(NULL, opt, filename);
1045 }
1046 
1047 static int opt_video_frames(void *optctx, const char *opt, const char *arg)
1048 {
1049  OptionsContext *o = optctx;
1050  return parse_option(o, "frames:v", arg, options);
1051 }
1052 
1053 static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
1054 {
1055  OptionsContext *o = optctx;
1056  return parse_option(o, "frames:a", arg, options);
1057 }
1058 
1059 static int opt_data_frames(void *optctx, const char *opt, const char *arg)
1060 {
1061  OptionsContext *o = optctx;
1062  return parse_option(o, "frames:d", arg, options);
1063 }
1064 
1065 static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
1066 {
1067  int ret;
1068  AVDictionary *cbak = codec_opts;
1069  AVDictionary *fbak = format_opts;
1070  codec_opts = NULL;
1071  format_opts = NULL;
1072 
1073  ret = opt_default(NULL, opt, arg);
1074 
1075  av_dict_copy(&o->g->codec_opts , codec_opts, 0);
1079  codec_opts = cbak;
1080  format_opts = fbak;
1081 
1082  return ret;
1083 }
1084 
1085 static int opt_preset(void *optctx, const char *opt, const char *arg)
1086 {
1087  OptionsContext *o = optctx;
1088  FILE *f=NULL;
1089  char filename[1000], line[1000], tmp_line[1000];
1090  const char *codec_name = NULL;
1091  int ret = 0;
1092  int depth = o->depth;
1093 
1094  if (depth > 2) {
1095  av_log(NULL, AV_LOG_ERROR, "too deep recursion\n");
1096  return AVERROR(EINVAL);
1097  }
1098 
1099  codec_name = opt_match_per_type_str(&o->codec_names, *opt);
1100 
1101  if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
1102  if(!strncmp(arg, "libx264-lossless", strlen("libx264-lossless"))){
1103  av_log(NULL, AV_LOG_FATAL, "Please use -preset <speed> -qp 0\n");
1104  }else
1105  av_log(NULL, AV_LOG_FATAL, "File for preset '%s' not found\n", arg);
1106  return AVERROR(ENOENT);
1107  }
1108 
1109  o->depth ++;
1110  while (fgets(line, sizeof(line), f)) {
1111  char *key = tmp_line, *value, *endptr;
1112 
1113  if (strcspn(line, "#\n\r") == 0)
1114  continue;
1115  av_strlcpy(tmp_line, line, sizeof(tmp_line));
1116  if (!av_strtok(key, "=", &value) ||
1117  !av_strtok(value, "\r\n", &endptr)) {
1118  av_log(NULL, AV_LOG_FATAL, "%s: Invalid syntax: '%s'\n", filename, line);
1119  ret = AVERROR(EINVAL);
1120  goto fail;
1121  }
1122  av_log(NULL, AV_LOG_DEBUG, "ffpreset[%s]: set '%s' = '%s'\n", filename, key, value);
1123 
1124  if (!strcmp(key, "acodec")) opt_audio_codec (o, key, value);
1125  else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value);
1126  else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value);
1127  else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value);
1128  else if ((parse_option(o, key, value, options) < 0) &&
1129  (opt_default_new(o, key, value) < 0)) {
1130  av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
1131  filename, line, key, value);
1132  ret = AVERROR(EINVAL);
1133  goto fail;
1134  }
1135  }
1136 
1137 fail:
1138  o->depth = depth;
1139  fclose(f);
1140 
1141  return ret;
1142 }
1143 
1144 static int opt_old2new(void *optctx, const char *opt, const char *arg)
1145 {
1146  OptionsContext *o = optctx;
1147  int ret;
1148  char *s = av_asprintf("%s:%c", opt + 1, *opt);
1149  if (!s)
1150  return AVERROR(ENOMEM);
1151  ret = parse_option(o, s, arg, options);
1152  av_free(s);
1153  return ret;
1154 }
1155 
1156 static int opt_bitrate(void *optctx, const char *opt, const char *arg)
1157 {
1158  OptionsContext *o = optctx;
1159 
1160  if(!strcmp(opt, "ab")){
1161  av_dict_set(&o->g->codec_opts, "b:a", arg, 0);
1162  return 0;
1163  } else if(!strcmp(opt, "b")){
1164  av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n");
1165  av_dict_set(&o->g->codec_opts, "b:v", arg, 0);
1166  return 0;
1167  }
1168  av_dict_set(&o->g->codec_opts, opt, arg, 0);
1169  return 0;
1170 }
1171 
1172 static int opt_qscale(void *optctx, const char *opt, const char *arg)
1173 {
1174  OptionsContext *o = optctx;
1175  char *s;
1176  int ret;
1177  if(!strcmp(opt, "qscale")){
1178  av_log(NULL, AV_LOG_WARNING, "Please use -q:a or -q:v, -qscale is ambiguous\n");
1179  return parse_option(o, "q:v", arg, options);
1180  }
1181  s = av_asprintf("q%s", opt + 6);
1182  if (!s)
1183  return AVERROR(ENOMEM);
1184  ret = parse_option(o, s, arg, options);
1185  av_free(s);
1186  return ret;
1187 }
1188 
1189 static int opt_profile(void *optctx, const char *opt, const char *arg)
1190 {
1191  OptionsContext *o = optctx;
1192  if(!strcmp(opt, "profile")){
1193  av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n");
1194  av_dict_set(&o->g->codec_opts, "profile:v", arg, 0);
1195  return 0;
1196  }
1197  av_dict_set(&o->g->codec_opts, opt, arg, 0);
1198  return 0;
1199 }
1200 
1201 static int opt_video_filters(void *optctx, const char *opt, const char *arg)
1202 {
1203  OptionsContext *o = optctx;
1204  return parse_option(o, "filter:v", arg, options);
1205 }
1206 
1207 static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
1208 {
1209  OptionsContext *o = optctx;
1210  return parse_option(o, "filter:a", arg, options);
1211 }
1212 
1213 static int opt_timecode(void *optctx, const char *opt, const char *arg)
1214 {
1215  OptionsContext *o = optctx;
1216  int ret;
1217  char *tcr = av_asprintf("timecode=%s", arg);
1218  if (!tcr)
1219  return AVERROR(ENOMEM);
1220  ret = parse_option(o, "metadata:g", tcr, options);
1221  if (ret >= 0)
1222  ret = av_dict_set(&o->g->codec_opts, "gop_timecode", arg, 0);
1223  av_free(tcr);
1224  return ret;
1225 }
1226 
1227 static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
1228 {
1229  OptionsContext *o = optctx;
1230  return parse_option(o, "q:a", arg, options);
1231 }
1232 
1233 static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
1234 {
1235  GlobalOptionsContext *go = optctx;
1236  char *graph_desc;
1237  int ret;
1238 
1239  graph_desc = av_strdup(arg);
1240  if (!graph_desc)
1241  return AVERROR(ENOMEM);
1242 
1244  if (ret < 0) {
1245  av_freep(&graph_desc);
1246  return ret;
1247  }
1248  go->filtergraphs[go->nb_filtergraphs - 1] = graph_desc;
1249 
1250  return 0;
1251 }
1252 
1253 void show_help_default(const char *opt, const char *arg)
1254 {
1255  int show_advanced = 0, show_avoptions = 0;
1256 
1257  if (opt && *opt) {
1258  if (!strcmp(opt, "long"))
1259  show_advanced = 1;
1260  else if (!strcmp(opt, "full"))
1261  show_advanced = show_avoptions = 1;
1262  else
1263  av_log(NULL, AV_LOG_ERROR, "Unknown help option '%s'.\n", opt);
1264  }
1265 
1266  show_usage();
1267 
1268  printf("Getting help:\n"
1269  " -h -- print basic options\n"
1270  " -h long -- print more options\n"
1271  " -h full -- print all options (including all format and codec specific options, very long)\n"
1272  " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1273  " See man %s for detailed description of the options.\n"
1274  "\n"
1275  "Per-stream options can be followed by :<stream_spec> to apply that option to specific streams only. "
1276  "<stream_spec> can be a stream index, or v/a/s for video/audio/subtitle (see manual for full syntax).\n"
1277  "\n", program_name);
1278 
1279  show_help_options(options, "Print help / information / capabilities:",
1280  OPT_EXIT, OPT_EXPERT);
1281  if (show_advanced)
1282  show_help_options(options, "Advanced information / capabilities:",
1283  OPT_EXIT | OPT_EXPERT, 0);
1284 
1285  show_help_options(options, "Global options (affect whole program "
1286  "instead of just one file):",
1288  if (show_advanced)
1289  show_help_options(options, "Advanced global options:", OPT_EXPERT,
1290  OPT_PERFILE | OPT_EXIT);
1291 
1292  show_help_options(options, "Per-file options (input and output):",
1296  if (show_advanced)
1297  show_help_options(options, "Advanced per-file options (input and output):",
1301 
1302  show_help_options(options, "Per-file options (input-only):",
1306  if (show_advanced)
1307  show_help_options(options, "Advanced per-file options (input-only):",
1311 
1312  show_help_options(options, "Per-file options (output-only):",
1316  if (show_advanced)
1317  show_help_options(options, "Advanced per-file options (output-only):",
1321 
1322  show_help_options(options, "Per-stream options:",
1324  OPT_EXIT | OPT_EXPERT |
1326  if (show_advanced)
1327  show_help_options(options, "Advanced per-stream options:",
1329  OPT_EXIT |
1331 
1332  show_help_options(options, "Video options:",
1334  if (show_advanced)
1335  show_help_options(options, "Advanced Video options:",
1337 
1338  show_help_options(options, "Audio options:",
1340  if (show_advanced)
1341  show_help_options(options, "Advanced Audio options:",
1343 
1344  show_help_options(options, "Subtitle options:",
1346  if (show_advanced)
1347  show_help_options(options, "Advanced Subtitle options:",
1349 
1350  if (show_advanced)
1351  show_help_options(options, "Data stream options:",
1353  printf("\n");
1354 
1355  if (show_avoptions) {
1359 #if CONFIG_SWSCALE
1361 #endif
1362 #if CONFIG_SWRESAMPLE
1364 #endif
1367  }
1368 }
1369 
1370 void show_usage(void)
1371 {
1372  av_log(NULL, AV_LOG_INFO, "Universal media converter\n");
1373  av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
1374  av_log(NULL, AV_LOG_INFO, "\n");
1375 }
1376 
1377 enum OptGroup {
1378  GROUP_OUTFILE,
1379  GROUP_INFILE,
1380  GROUP_DECODER,
1381 };
1382 
1383 static const OptionGroupDef groups[] = {
1384  [GROUP_OUTFILE] = { "output url", NULL, OPT_OUTPUT },
1385  [GROUP_INFILE] = { "input url", "i", OPT_INPUT },
1386  [GROUP_DECODER] = { "loopback decoder", "dec", OPT_DECODER },
1387 };
1388 
1389 static int open_files(OptionGroupList *l, const char *inout, Scheduler *sch,
1390  int (*open_file)(const OptionsContext*, const char*,
1391  Scheduler*))
1392 {
1393  int i, ret;
1394 
1395  for (i = 0; i < l->nb_groups; i++) {
1396  OptionGroup *g = &l->groups[i];
1397  OptionsContext o;
1398 
1399  init_options(&o);
1400  o.g = g;
1401 
1402  ret = parse_optgroup(&o, g, options);
1403  if (ret < 0) {
1404  av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
1405  "%s.\n", inout, g->arg);
1406  uninit_options(&o);
1407  return ret;
1408  }
1409 
1410  av_log(NULL, AV_LOG_DEBUG, "Opening an %s file: %s.\n", inout, g->arg);
1411  ret = open_file(&o, g->arg, sch);
1412  uninit_options(&o);
1413  if (ret < 0) {
1414  av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n",
1415  inout, g->arg);
1416  return ret;
1417  }
1418  av_log(NULL, AV_LOG_DEBUG, "Successfully opened the file.\n");
1419  }
1420 
1421  return 0;
1422 }
1423 
1424 int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
1425 {
1426  GlobalOptionsContext go = { .sch = sch };
1427  OptionParseContext octx;
1428  const char *errmsg = NULL;
1429  int ret;
1430 
1431  memset(&octx, 0, sizeof(octx));
1432 
1433  /* split the commandline into an internal representation */
1434  ret = split_commandline(&octx, argc, argv, options, groups,
1435  FF_ARRAY_ELEMS(groups));
1436  if (ret < 0) {
1437  errmsg = "splitting the argument list";
1438  goto fail;
1439  }
1440 
1441  /* apply global options */
1442  ret = parse_optgroup(&go, &octx.global_opts, options);
1443  if (ret < 0) {
1444  errmsg = "parsing global options";
1445  goto fail;
1446  }
1447 
1448  /* configure terminal and setup signal handlers */
1449  term_init();
1450 
1451  /* create complex filtergraphs */
1452  for (int i = 0; i < go.nb_filtergraphs; i++) {
1453  ret = fg_create(NULL, &go.filtergraphs[i], sch, NULL);
1454  go.filtergraphs[i] = NULL;
1455  if (ret < 0)
1456  goto fail;
1457  }
1458 
1459  /* open input files */
1460  ret = open_files(&octx.groups[GROUP_INFILE], "input", sch, ifile_open);
1461  if (ret < 0) {
1462  errmsg = "opening input files";
1463  goto fail;
1464  }
1465 
1466  /* open output files */
1467  ret = open_files(&octx.groups[GROUP_OUTFILE], "output", sch, of_open);
1468  if (ret < 0) {
1469  errmsg = "opening output files";
1470  goto fail;
1471  }
1472 
1473  /* create loopback decoders */
1474  ret = open_files(&octx.groups[GROUP_DECODER], "decoder", sch, dec_create);
1475  if (ret < 0) {
1476  errmsg = "creating loopback decoders";
1477  goto fail;
1478  }
1479 
1480  // bind unbound filtegraph inputs/outputs and check consistency
1482  if (ret < 0) {
1483  errmsg = "binding filtergraph inputs/outputs";
1484  goto fail;
1485  }
1486 
1488 
1489  ret = apply_sync_offsets();
1490  if (ret < 0)
1491  goto fail;
1492 
1493 fail:
1494  for (int i = 0; i < go.nb_filtergraphs; i++)
1495  av_freep(&go.filtergraphs[i]);
1496  av_freep(&go.filtergraphs);
1497 
1498  uninit_parse_context(&octx);
1499  if (ret < 0 && ret != AVERROR_EXIT) {
1500  av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
1501  errmsg ? errmsg : "", av_err2str(ret));
1502  }
1503  return ret;
1504 }
1505 
1506 static int opt_progress(void *optctx, const char *opt, const char *arg)
1507 {
1508  AVIOContext *avio = NULL;
1509  int ret;
1510 
1511  if (!strcmp(arg, "-"))
1512  arg = "pipe:";
1513  ret = avio_open2(&avio, arg, AVIO_FLAG_WRITE, &int_cb, NULL);
1514  if (ret < 0) {
1515  av_log(NULL, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n",
1516  arg, av_err2str(ret));
1517  return ret;
1518  }
1519  progress_avio = avio;
1520  return 0;
1521 }
1522 
1523 int opt_timelimit(void *optctx, const char *opt, const char *arg)
1524 {
1525 #if HAVE_SETRLIMIT
1526  int ret;
1527  double lim;
1528  struct rlimit rl;
1529 
1530  ret = parse_number(opt, arg, OPT_TYPE_INT64, 0, INT_MAX, &lim);
1531  if (ret < 0)
1532  return ret;
1533 
1534  rl = (struct rlimit){ lim, lim + 1 };
1535  if (setrlimit(RLIMIT_CPU, &rl))
1536  perror("setrlimit");
1537 #else
1538  av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
1539 #endif
1540  return 0;
1541 }
1542 
1543 static const char *const alt_channel_layout[] = { "ch_layout", NULL};
1544 static const char *const alt_codec[] = { "c", "acodec", "vcodec", "scodec", "dcodec", NULL };
1545 static const char *const alt_filter[] = { "af", "vf", NULL };
1546 static const char *const alt_frames[] = { "aframes", "vframes", "dframes", NULL };
1547 static const char *const alt_pre[] = { "apre", "vpre", "spre", NULL};
1548 static const char *const alt_qscale[] = { "q", NULL};
1549 static const char *const alt_tag[] = { "atag", "vtag", "stag", NULL };
1550 
1551 #define OFFSET(x) offsetof(OptionsContext, x)
1552 const OptionDef options[] = {
1553  /* main options */
1556  { .off = OFFSET(format) },
1557  "force container format (auto-detected otherwise)", "fmt" },
1558  { "y", OPT_TYPE_BOOL, 0,
1559  { &file_overwrite },
1560  "overwrite output files" },
1561  { "n", OPT_TYPE_BOOL, 0,
1562  { &no_file_overwrite },
1563  "never overwrite output files" },
1564  { "ignore_unknown", OPT_TYPE_BOOL, OPT_EXPERT,
1566  "Ignore unknown stream types" },
1567  { "copy_unknown", OPT_TYPE_BOOL, OPT_EXPERT,
1568  { &copy_unknown_streams },
1569  "Copy unknown stream types" },
1570  { "recast_media", OPT_TYPE_BOOL, OPT_EXPERT,
1571  { &recast_media },
1572  "allow recasting stream type in order to force a decoder of different media type" },
1574  { .off = OFFSET(codec_names) },
1575  "select encoder/decoder ('copy' to copy stream without reencoding)", "codec",
1576  .u1.name_canon = "codec", },
1578  { .off = OFFSET(codec_names) },
1579  "alias for -c (select encoder/decoder)", "codec",
1580  .u1.names_alt = alt_codec, },
1582  { .off = OFFSET(presets) },
1583  "preset name", "preset",
1584  .u1.names_alt = alt_pre, },
1586  { .func_arg = opt_map },
1587  "set input stream mapping",
1588  "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1589  { "map_metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
1590  { .off = OFFSET(metadata_map) },
1591  "set metadata information of outfile from infile",
1592  "outfile[,metadata]:infile[,metadata]" },
1593  { "map_chapters", OPT_TYPE_INT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
1594  { .off = OFFSET(chapters_input_file) },
1595  "set chapters mapping", "input_file_index" },
1597  { .off = OFFSET(recording_time) },
1598  "stop transcoding after specified duration",
1599  "duration" },
1601  { .off = OFFSET(stop_time) },
1602  "stop transcoding after specified time is reached",
1603  "time_stop" },
1605  { .off = OFFSET(limit_filesize) },
1606  "set the limit file size in bytes", "limit_size" },
1608  { .off = OFFSET(start_time) },
1609  "start transcoding at specified time", "time_off" },
1610  { "sseof", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | OPT_EXPERT,
1611  { .off = OFFSET(start_time_eof) },
1612  "set the start time offset relative to EOF", "time_off" },
1613  { "seek_timestamp", OPT_TYPE_INT, OPT_OFFSET | OPT_INPUT | OPT_EXPERT,
1614  { .off = OFFSET(seek_timestamp) },
1615  "enable/disable seeking by timestamp with -ss" },
1616  { "accurate_seek", OPT_TYPE_BOOL, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1617  { .off = OFFSET(accurate_seek) },
1618  "enable/disable accurate seeking with -ss" },
1619  { "isync", OPT_TYPE_INT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1620  { .off = OFFSET(input_sync_ref) },
1621  "Indicate the input index for sync reference", "sync ref" },
1622  { "itsoffset", OPT_TYPE_TIME, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1623  { .off = OFFSET(input_ts_offset) },
1624  "set the input ts offset", "time_off" },
1626  { .off = OFFSET(ts_scale) },
1627  "set the input ts scale", "scale" },
1629  { .func_arg = opt_recording_timestamp },
1630  "set the recording timestamp ('now' to set the current time)", "time" },
1631  { "metadata", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
1632  { .off = OFFSET(metadata) },
1633  "add metadata", "key=value" },
1634  { "program", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT,
1635  { .off = OFFSET(program) },
1636  "add program with specified streams", "title=string:st=number..." },
1637  { "stream_group", OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | OPT_EXPERT,
1638  { .off = OFFSET(stream_groups) },
1639  "add stream group with specified streams and group type-specific arguments", "id=number:st=number..." },
1641  { .func_arg = opt_data_frames },
1642  "set the number of data frames to output", "number",
1643  .u1.name_canon = "frames" },
1644  { "benchmark", OPT_TYPE_BOOL, OPT_EXPERT,
1645  { &do_benchmark },
1646  "add timings for benchmarking" },
1647  { "benchmark_all", OPT_TYPE_BOOL, OPT_EXPERT,
1648  { &do_benchmark_all },
1649  "add timings for each task" },
1650  { "progress", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1651  { .func_arg = opt_progress },
1652  "write program-readable progress information", "url" },
1653  { "stdin", OPT_TYPE_BOOL, OPT_EXPERT,
1654  { &stdin_interaction },
1655  "enable or disable interaction on standard input" },
1656  { "timelimit", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1657  { .func_arg = opt_timelimit },
1658  "set max runtime in seconds in CPU user time", "limit" },
1659  { "dump", OPT_TYPE_BOOL, OPT_EXPERT,
1660  { &do_pkt_dump },
1661  "dump each input packet" },
1662  { "hex", OPT_TYPE_BOOL, OPT_EXPERT,
1663  { &do_hex_dump },
1664  "when dumping packets, also dump the payload" },
1666  { .off = OFFSET(rate_emu) },
1667  "read input at native frame rate; equivalent to -readrate 1", "" },
1668  { "readrate", OPT_TYPE_FLOAT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1669  { .off = OFFSET(readrate) },
1670  "read input at specified rate", "speed" },
1671  { "readrate_initial_burst", OPT_TYPE_DOUBLE, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1672  { .off = OFFSET(readrate_initial_burst) },
1673  "The initial amount of input to burst read before imposing any readrate", "seconds" },
1674  { "readrate_catchup", OPT_TYPE_FLOAT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT,
1675  { .off = OFFSET(readrate_catchup) },
1676  "Temporary readrate used to catch up if an input lags behind the specified readrate", "speed" },
1678  { .func_arg = opt_target },
1679  "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1680  "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
1681  { "frame_drop_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
1682  { &frame_drop_threshold },
1683  "frame drop threshold", "" },
1684  { "copyts", OPT_TYPE_BOOL, OPT_EXPERT,
1685  { &copy_ts },
1686  "copy timestamps" },
1687  { "start_at_zero", OPT_TYPE_BOOL, OPT_EXPERT,
1688  { &start_at_zero },
1689  "shift input timestamps to start at 0 when using copyts" },
1690  { "copytb", OPT_TYPE_INT, OPT_EXPERT,
1691  { &copy_tb },
1692  "copy input stream time base when stream copying", "mode" },
1693  { "shortest", OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
1694  { .off = OFFSET(shortest) },
1695  "finish encoding within shortest input" },
1696  { "shortest_buf_duration", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
1697  { .off = OFFSET(shortest_buf_duration) },
1698  "maximum buffering duration (in seconds) for the -shortest option" },
1700  { .off = OFFSET(bitexact) },
1701  "bitexact mode" },
1702  { "dts_delta_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
1703  { &dts_delta_threshold },
1704  "timestamp discontinuity delta threshold", "threshold" },
1705  { "dts_error_threshold", OPT_TYPE_FLOAT, OPT_EXPERT,
1706  { &dts_error_threshold },
1707  "timestamp error delta threshold", "threshold" },
1708  { "xerror", OPT_TYPE_BOOL, OPT_EXPERT,
1709  { &exit_on_error },
1710  "exit on error", "error" },
1711  { "abort_on", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1712  { .func_arg = opt_abort_on },
1713  "abort on the specified condition flags", "flags" },
1714  { "copyinkf", OPT_TYPE_BOOL, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1715  { .off = OFFSET(copy_initial_nonkeyframes) },
1716  "copy initial non-keyframes" },
1717  { "copypriorss", OPT_TYPE_INT, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1718  { .off = OFFSET(copy_prior_start) },
1719  "copy or discard frames before start time" },
1721  { .off = OFFSET(max_frames) },
1722  "set the number of frames to output", "number",
1723  .u1.names_alt = alt_frames, },
1725  { .off = OFFSET(codec_tags) },
1726  "force codec tag/fourcc", "fourcc/tag",
1727  .u1.names_alt = alt_tag, },
1729  { .off = OFFSET(qscale) },
1730  "use fixed quality scale (VBR)", "q",
1731  .u1.name_canon = "qscale", },
1733  { .func_arg = opt_qscale },
1734  "use fixed quality scale (VBR)", "q",
1735  .u1.names_alt = alt_qscale, },
1737  { .func_arg = opt_profile },
1738  "set profile", "profile" },
1740  { .off = OFFSET(filters) },
1741  "apply specified filters to audio/video", "filter_graph",
1742  .u1.names_alt = alt_filter, },
1743  { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1744  { .func_arg = opt_filter_threads },
1745  "number of non-complex filter threads" },
1746  { "filter_buffered_frames", OPT_TYPE_INT, OPT_EXPERT,
1748  "maximum number of buffered frames in a filter graph" },
1749  { "reinit_filter", OPT_TYPE_INT, OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1750  { .off = OFFSET(reinit_filters) },
1751  "reinit filtergraph on input parameter changes", "" },
1752  { "drop_changed", OPT_TYPE_INT, OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1753  { .off = OFFSET(drop_changed) },
1754  "drop frame instead of reiniting filtergraph on input parameter changes", "" },
1755  { "filter_complex", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1756  { .func_arg = opt_filter_complex },
1757  "create a complex filtergraph", "graph_description" },
1758  { "filter_complex_threads", OPT_TYPE_INT, OPT_EXPERT,
1760  "number of threads for -filter_complex" },
1761  { "lavfi", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1762  { .func_arg = opt_filter_complex },
1763  "create a complex filtergraph", "graph_description" },
1764  { "print_graphs", OPT_TYPE_BOOL, 0,
1765  { &print_graphs },
1766  "print execution graph data to stderr" },
1767  { "print_graphs_file", OPT_TYPE_STRING, 0,
1768  { &print_graphs_file },
1769  "write execution graph data to the specified file", "filename" },
1770  { "print_graphs_format", OPT_TYPE_STRING, 0,
1771  { &print_graphs_format },
1772  "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml, mermaid, mermaidhtml)", "format" },
1773  { "auto_conversion_filters", OPT_TYPE_BOOL, OPT_EXPERT,
1775  "enable automatic conversion filters globally" },
1776  { "stats", OPT_TYPE_BOOL, 0,
1777  { &print_stats },
1778  "print progress report during encoding", },
1779  { "stats_period", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
1780  { .func_arg = opt_stats_period },
1781  "set the period at which ffmpeg updates stats and -progress output", "time" },
1783  { .func_arg = opt_attach },
1784  "add an attachment to the output file", "filename" },
1785  { "dump_attachment", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_INPUT,
1786  { .off = OFFSET(dump_attachment) },
1787  "extract an attachment into a file", "filename" },
1788  { "stream_loop", OPT_TYPE_INT, OPT_EXPERT | OPT_INPUT | OPT_OFFSET,
1789  { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" },
1790  { "debug_ts", OPT_TYPE_BOOL, OPT_EXPERT,
1791  { &debug_ts },
1792  "print timestamp debugging info" },
1793  { "max_error_rate", OPT_TYPE_FLOAT, OPT_EXPERT,
1794  { &max_error_rate },
1795  "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" },
1797  { .off = OFFSET(discard) },
1798  "discard", "" },
1799  { "disposition", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | OPT_EXPERT,
1800  { .off = OFFSET(disposition) },
1801  "disposition", "" },
1802  { "thread_queue_size", OPT_TYPE_INT, OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
1803  { .off = OFFSET(thread_queue_size) },
1804  "set the maximum number of queued packets from the demuxer" },
1805  { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT | OPT_OFFSET,
1806  { .off = OFFSET(find_stream_info) },
1807  "read and decode the streams to fill missing information with heuristics" },
1808  { "bits_per_raw_sample", OPT_TYPE_INT, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1809  { .off = OFFSET(bits_per_raw_sample) },
1810  "set the number of bits per raw sample", "number" },
1811 
1812  { "stats_enc_pre", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1813  { .off = OFFSET(enc_stats_pre) },
1814  "write encoding stats before encoding" },
1815  { "stats_enc_post", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1816  { .off = OFFSET(enc_stats_post) },
1817  "write encoding stats after encoding" },
1818  { "stats_mux_pre", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1819  { .off = OFFSET(mux_stats) },
1820  "write packets stats before muxing" },
1821  { "stats_enc_pre_fmt", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1822  { .off = OFFSET(enc_stats_pre_fmt) },
1823  "format of the stats written with -stats_enc_pre" },
1824  { "stats_enc_post_fmt", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1825  { .off = OFFSET(enc_stats_post_fmt) },
1826  "format of the stats written with -stats_enc_post" },
1827  { "stats_mux_pre_fmt", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
1828  { .off = OFFSET(mux_stats_fmt) },
1829  "format of the stats written with -stats_mux_pre" },
1830 
1831  /* video options */
1833  { .func_arg = opt_video_frames },
1834  "set the number of video frames to output", "number",
1835  .u1.name_canon = "frames", },
1837  { .off = OFFSET(frame_rates) },
1838  "override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)", "rate" },
1840  { .off = OFFSET(max_frame_rates) },
1841  "set max frame rate (Hz value, fraction or abbreviation)", "rate" },
1843  { .off = OFFSET(frame_sizes) },
1844  "set frame size (WxH or abbreviation)", "size" },
1846  { .off = OFFSET(frame_aspect_ratios) },
1847  "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
1849  { .off = OFFSET(frame_pix_fmts) },
1850  "set pixel format", "format" },
1851  { "display_rotation", OPT_TYPE_DOUBLE, OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1852  { .off = OFFSET(display_rotations) },
1853  "set pure counter-clockwise rotation in degrees for stream(s)",
1854  "angle" },
1855  { "display_hflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1856  { .off = OFFSET(display_hflips) },
1857  "set display horizontal flip for stream(s) "
1858  "(overrides any display rotation if it is not set)"},
1859  { "display_vflip", OPT_TYPE_BOOL, OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1860  { .off = OFFSET(display_vflips) },
1861  "set display vertical flip for stream(s) "
1862  "(overrides any display rotation if it is not set)"},
1863  { "mastering_display", OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1864  { .off = OFFSET(mastering_displays) },
1865  "set SMPTE2084 mastering display color volume info" },
1866  { "content_light", OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | OPT_INPUT | OPT_EXPERT,
1867  { .off = OFFSET(content_lights) },
1868  "set SMPTE2084 Max CLL and Max FALL values" },
1870  { .off = OFFSET(video_disable) },
1871  "disable video" },
1873  { .off = OFFSET(rc_overrides) },
1874  "rate control override for specific intervals", "override" },
1876  { .func_arg = opt_video_codec },
1877  "alias for -c:v (select encoder/decoder for video streams)", "codec",
1878  .u1.name_canon = "codec", },
1880  { .func_arg = opt_timecode },
1881  "set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
1883  { .off = OFFSET(pass) },
1884  "select the pass number (1 to 3)", "n" },
1886  { .off = OFFSET(passlogfiles) },
1887  "select two pass log file name prefix", "prefix" },
1888  { "vstats", OPT_TYPE_FUNC, OPT_VIDEO | OPT_EXPERT,
1889  { .func_arg = opt_vstats },
1890  "dump video coding statistics to file" },
1891  { "vstats_file", OPT_TYPE_FUNC, OPT_VIDEO | OPT_FUNC_ARG | OPT_EXPERT,
1892  { .func_arg = opt_vstats_file },
1893  "dump video coding statistics to file", "file" },
1894  { "vstats_version", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT,
1895  { &vstats_version },
1896  "Version of the vstats format to use."},
1898  { .func_arg = opt_video_filters },
1899  "alias for -filter:v (apply filters to video streams)", "filter_graph",
1900  .u1.name_canon = "filter", },
1901  { "intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1902  { .off = OFFSET(intra_matrices) },
1903  "specify intra matrix coeffs", "matrix" },
1904  { "inter_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1905  { .off = OFFSET(inter_matrices) },
1906  "specify inter matrix coeffs", "matrix" },
1907  { "chroma_intra_matrix", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1908  { .off = OFFSET(chroma_intra_matrices) },
1909  "specify intra matrix coeffs", "matrix" },
1911  { .func_arg = opt_old2new },
1912  "force video tag/fourcc", "fourcc/tag",
1913  .u1.name_canon = "tag", },
1915  { .off = OFFSET(fps_mode) },
1916  "set framerate mode for matching video streams" },
1918  { .off = OFFSET(force_fps) },
1919  "force the selected framerate, disable the best supported framerate selection" },
1921  { .func_arg = opt_streamid },
1922  "set the value of an outfile streamid", "streamIndex:value" },
1923  { "force_key_frames", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1924  { .off = OFFSET(forced_key_frames) },
1925  "force key frames at specified timestamps", "timestamps" },
1927  { .func_arg = opt_bitrate },
1928  "video bitrate (please use -b:v)", "bitrate" },
1930  { .off = OFFSET(hwaccels) },
1931  "use HW accelerated decoding", "hwaccel name" },
1932  { "hwaccel_device", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
1933  { .off = OFFSET(hwaccel_devices) },
1934  "select a device for HW acceleration", "devicename" },
1935  { "hwaccel_output_format", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
1936  { .off = OFFSET(hwaccel_output_formats) },
1937  "select output format used with HW accelerated decoding", "format" },
1938  { "hwaccels", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT,
1939  { .func_arg = show_hwaccels },
1940  "show available HW acceleration methods" },
1941  { "autorotate", OPT_TYPE_BOOL, OPT_VIDEO | OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
1942  { .off = OFFSET(autorotate) },
1943  "automatically insert correct rotate filters" },
1945  { .off = OFFSET(autoscale) },
1946  "automatically insert a scale filter at the end of the filter graph" },
1947  { "apply_cropping", OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
1948  { .off = OFFSET(apply_cropping) },
1949  "select the cropping to apply" },
1950  { "fix_sub_duration_heartbeat", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
1951  { .off = OFFSET(fix_sub_duration_heartbeat) },
1952  "set this video output stream to be a heartbeat stream for "
1953  "fix_sub_duration, according to which subtitles should be split at "
1954  "random access points" },
1955 
1956  /* audio options */
1958  { .func_arg = opt_audio_frames },
1959  "set the number of audio frames to output", "number",
1960  .u1.name_canon = "frames", },
1962  { .func_arg = opt_audio_qscale },
1963  "set audio quality (codec-specific)", "quality", },
1965  { .off = OFFSET(audio_sample_rate) },
1966  "set audio sampling rate (in Hz)", "rate" },
1968  { .off = OFFSET(audio_channels) },
1969  "set number of audio channels", "channels" },
1971  { .off = OFFSET(audio_disable) },
1972  "disable audio" },
1974  { .func_arg = opt_audio_codec },
1975  "alias for -c:a (select encoder/decoder for audio streams)", "codec",
1976  .u1.name_canon = "codec", },
1978  { .func_arg = opt_bitrate },
1979  "alias for -b:a (select bitrate for audio streams)", "bitrate" },
1981  { .off = OFFSET(apad) },
1982  "audio pad", "" },
1984  { .func_arg = opt_old2new },
1985  "force audio tag/fourcc", "fourcc/tag",
1986  .u1.name_canon = "tag", },
1988  { .off = OFFSET(sample_fmts) },
1989  "set sample format", "format" },
1991  { .off = OFFSET(audio_ch_layouts) },
1992  "set channel layout", "layout",
1993  .u1.names_alt = alt_channel_layout, },
1995  { .off = OFFSET(audio_ch_layouts) },
1996  "set channel layout", "layout",
1997  .u1.name_canon = "channel_layout", },
1999  { .func_arg = opt_audio_filters },
2000  "alias for -filter:a (apply filters to audio streams)", "filter_graph",
2001  .u1.name_canon = "filter", },
2002  { "guess_layout_max", OPT_TYPE_INT, OPT_AUDIO | OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT,
2003  { .off = OFFSET(guess_layout_max) },
2004  "set the maximum number of channels to try to guess the channel layout" },
2005 
2006  /* subtitle options */
2008  { .off = OFFSET(subtitle_disable) },
2009  "disable subtitle" },
2011  { .func_arg = opt_subtitle_codec },
2012  "alias for -c:s (select encoder/decoder for subtitle streams)", "codec",
2013  .u1.name_canon = "codec", },
2015  { .func_arg = opt_old2new }
2016  , "force subtitle tag/fourcc", "fourcc/tag",
2017  .u1.name_canon = "tag" },
2018  { "fix_sub_duration", OPT_TYPE_BOOL, OPT_EXPERT | OPT_SUBTITLE | OPT_PERSTREAM | OPT_INPUT,
2019  { .off = OFFSET(fix_sub_duration) },
2020  "fix subtitles duration" },
2022  { .off = OFFSET(canvas_sizes) },
2023  "set canvas size (WxH or abbreviation)", "size" },
2024 
2025  /* muxer options */
2026  { "muxdelay", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
2027  { .off = OFFSET(mux_max_delay) },
2028  "set the maximum demux-decode delay", "seconds" },
2029  { "muxpreload", OPT_TYPE_FLOAT, OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT,
2030  { .off = OFFSET(mux_preload) },
2031  "set the initial demux-decode delay", "seconds" },
2032  { "sdp_file", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_OUTPUT,
2033  { .func_arg = opt_sdp_file },
2034  "specify a file in which to print sdp information", "file" },
2035 
2036  { "time_base", OPT_TYPE_STRING, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
2037  { .off = OFFSET(time_bases) },
2038  "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" },
2039  { "enc_time_base", OPT_TYPE_STRING, OPT_EXPERT | OPT_PERSTREAM | OPT_OUTPUT,
2040  { .off = OFFSET(enc_time_bases) },
2041  "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
2042  "two special values are defined - "
2043  "0 = use frame rate (video) or sample rate (audio),"
2044  "-1 = match source time base", "ratio" },
2045 
2047  { .off = OFFSET(bitstream_filters) },
2048  "A comma-separated list of bitstream filters", "bitstream_filters", },
2049 
2051  { .func_arg = opt_preset },
2052  "set the audio options to the indicated preset", "preset",
2053  .u1.name_canon = "pre", },
2055  { .func_arg = opt_preset },
2056  "set the video options to the indicated preset", "preset",
2057  .u1.name_canon = "pre", },
2059  { .func_arg = opt_preset },
2060  "set the subtitle options to the indicated preset", "preset",
2061  .u1.name_canon = "pre", },
2063  { .func_arg = opt_preset },
2064  "set options from indicated preset file", "filename",
2065  .u1.name_canon = "pre", },
2066 
2067  { "max_muxing_queue_size", OPT_TYPE_INT, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
2068  { .off = OFFSET(max_muxing_queue_size) },
2069  "maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
2070  { "muxing_queue_data_threshold", OPT_TYPE_INT, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
2071  { .off = OFFSET(muxing_queue_data_threshold) },
2072  "set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
2073 
2074  /* data codec support */
2076  { .func_arg = opt_data_codec },
2077  "alias for -c:d (select encoder/decoder for data streams)", "codec",
2078  .u1.name_canon = "codec", },
2080  { .off = OFFSET(data_disable) }, "disable data" },
2081 
2082 #if CONFIG_VAAPI
2083  { "vaapi_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
2084  { .func_arg = opt_vaapi_device },
2085  "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)", "device" },
2086 #endif
2087 
2088 #if CONFIG_QSV
2089  { "qsv_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
2090  { .func_arg = opt_qsv_device },
2091  "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"},
2092 #endif
2093 
2094  { "init_hw_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
2095  { .func_arg = opt_init_hw_device },
2096  "initialise hardware device", "args" },
2097  { "filter_hw_device", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
2098  { .func_arg = opt_filter_hw_device },
2099  "set hardware device used when filtering", "device" },
2100 
2101  { NULL, },
2102 };
flags
const SwsFlags flags[]
Definition: swscale.c:85
OPT_EXIT
#define OPT_EXIT
Definition: cmdutils.h:207
show_help_options
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
Definition: cmdutils.c:107
AVCodec
AVCodec.
Definition: codec.h:169
fix_sub_duration_heartbeat
static int fix_sub_duration_heartbeat(DecoderPriv *dp, int64_t signal_pts)
Definition: ffmpeg_dec.c:612
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
InputFile::start_time
int64_t start_time
Definition: ffmpeg.h:518
ignore_unknown_streams
int ignore_unknown_streams
Definition: ffmpeg_opt.c:86
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
OptionsContext::stop_time
int64_t stop_time
Definition: ffmpeg.h:179
StreamMap::file_index
int file_index
Definition: ffmpeg.h:124
show_hwaccels
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:153
program
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
Definition: undefined.txt:6
AV_STEREO3D_VIEW_LEFT
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
Definition: stereo3d.h:158
opt_abort_on
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:470
VSYNC_VFR
@ VSYNC_VFR
Definition: ffmpeg.h:60
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:109
printf
__device__ int printf(const char *,...)
opt.h
assert_file_overwrite
int assert_file_overwrite(const char *filename)
Definition: ffmpeg_opt.c:816
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:53
opt_video_filters
static int opt_video_filters(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1201
show_help_default
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffmpeg_opt.c:1253
debug_ts
int debug_ts
Definition: ffmpeg_opt.c:67
stats_period
int64_t stats_period
Definition: ffmpeg_opt.c:81
apply_cropping
static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
Definition: decode.c:757
is
The official guide to swscale for confused that is
Definition: swscale.txt:28
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:933
opt_old2new
static int opt_old2new(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1144
AVStream::discard
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition: avformat.h:818
stream_specifier_parse
int stream_specifier_parse(StreamSpecifier *ss, const char *spec, int allow_remainder, void *logctx)
Parse a stream specifier string into a form suitable for matching.
Definition: cmdutils.c:1011
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:263
int64_t
long long int64_t
Definition: coverity.c:34
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:115
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:208
avformat_get_class
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition: options.c:192
program_name
const char program_name[]
program name, defined by the program for show_version().
Definition: ffmpeg.c:89
no_file_overwrite
static int no_file_overwrite
Definition: ffmpeg_opt.c:85
opt_default_new
static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1065
OptionsContext::nb_attachments
int nb_attachments
Definition: ffmpeg.h:174
avcodec_find_encoder
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:983
auto_conversion_filters
int auto_conversion_filters
Definition: ffmpeg_opt.c:80
audio_channels
int audio_channels
Definition: rtp.c:40
opt_audio_codec
static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:507
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1382
OptionsContext::mux_max_delay
float mux_max_delay
Definition: ffmpeg.h:182
OPT_FLAG_OFFSET
#define OPT_FLAG_OFFSET
Definition: cmdutils.h:223
OPT_INPUT
#define OPT_INPUT
Definition: cmdutils.h:237
copy_unknown_streams
int copy_unknown_streams
Definition: ffmpeg_opt.c:87
parse_number
int parse_number(const char *context, const char *numstr, enum OptionType type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
Definition: cmdutils.c:84
AV_HWDEVICE_TYPE_NONE
@ AV_HWDEVICE_TYPE_NONE
Definition: hwcontext.h:28
StreamSpecifier
Definition: cmdutils.h:113
AVOption
AVOption.
Definition: opt.h:428
OptionGroupList::groups
OptionGroup * groups
Definition: cmdutils.h:360
OptionGroupList::nb_groups
int nb_groups
Definition: cmdutils.h:361
opt_timelimit
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
format_opts
AVDictionary * format_opts
Definition: cmdutils.c:58
filter_hw_device
HWDevice * filter_hw_device
Definition: ffmpeg_opt.c:52
ffmpeg.h
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
progress_avio
AVIOContext * progress_avio
Definition: ffmpeg.c:106
opt_filter_hw_device
static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:746
show_help_children
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
Definition: cmdutils.c:140
av_hwdevice_iterate_types
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
Definition: hwcontext.c:129
autorotate
static int autorotate
Definition: ffplay.c:350
ViewSpecifier
Definition: ffmpeg.h:116
UNKNOWN
@ UNKNOWN
Definition: ftp.c:39
video_disable
static int video_disable
Definition: ffplay.c:317
mathematics.h
AVDictionary
Definition: dict.c:32
HWDevice
Definition: ffmpeg.h:97
hw_device_init_from_string
int hw_device_init_from_string(const char *arg, HWDevice **dev)
Definition: ffmpeg_hw.c:92
VIEW_SPECIFIER_TYPE_ALL
@ VIEW_SPECIFIER_TYPE_ALL
Definition: ffmpeg.h:113
do_benchmark
int do_benchmark
Definition: ffmpeg_opt.c:60
AV_STEREO3D_VIEW_RIGHT
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
Definition: stereo3d.h:163
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:103
GlobalOptionsContext
Definition: ffmpeg_opt.c:92
OptionDef
Definition: cmdutils.h:195
subtitle_disable
static int subtitle_disable
Definition: ffplay.c:318
OPT_DATA
#define OPT_DATA
Definition: cmdutils.h:215
stream_specifier_uninit
void stream_specifier_uninit(StreamSpecifier *ss)
Definition: cmdutils.c:1002
SpecifierOpt::i
int i
Definition: cmdutils.h:175
OptionsContext::chapters_input_file
int chapters_input_file
Definition: ffmpeg.h:176
opt_filter_threads
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:463
do_hex_dump
int do_hex_dump
Definition: ffmpeg_opt.c:62
OptionGroupList
A list of option groups that all have the same group type (e.g.
Definition: cmdutils.h:357
bsf.h
do_pkt_dump
int do_pkt_dump
Definition: ffmpeg_opt.c:63
uninit_options
static void uninit_options(OptionsContext *o)
Definition: ffmpeg_opt.c:99
OptionsContext::depth
int depth
Definition: ffmpeg.h:245
presets
static const Preset presets[]
Definition: vf_pseudocolor.c:286
opt_timecode
static int opt_timecode(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1213
OptionsContext::g
OptionGroup * g
Definition: ffmpeg.h:133
StreamMap::disabled
int disabled
Definition: ffmpeg.h:123
GlobalOptionsContext::nb_filtergraphs
int nb_filtergraphs
Definition: ffmpeg_opt.c:96
opt_data_frames
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1059
VIEW_SPECIFIER_TYPE_POS
@ VIEW_SPECIFIER_TYPE_POS
Definition: ffmpeg.h:111
ifile_open
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
Definition: ffmpeg_demux.c:2010
OptionParseContext
Definition: cmdutils.h:364
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
sws_get_class
const AVClass * sws_get_class(void)
Get the AVClass for SwsContext.
Definition: options.c:134
OptionsContext
Definition: ffmpeg.h:132
OPT_TYPE_FLOAT
@ OPT_TYPE_FLOAT
Definition: cmdutils.h:86
ss
#define ss(width, name, subs,...)
Definition: cbs_vp9.c:202
loop
static int loop
Definition: ffplay.c:337
AVRational::num
int num
Numerator.
Definition: rational.h:59
opt_audio_filters
static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1207
InputFile
Definition: ffmpeg.h:504
OptionGroupDef
Definition: cmdutils.h:325
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:356
OptionsContext::recording_time
int64_t recording_time
Definition: ffmpeg.h:178
OPT_PERSTREAM
#define OPT_PERSTREAM
Definition: cmdutils.h:233
OptionsContext::nb_stream_maps
int nb_stream_maps
Definition: ffmpeg.h:172
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM
#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM
Definition: ffmpeg.h:541
fg_create
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch, const OutputFilterOptions *opts)
Create a new filtergraph in the global filtergraph list.
Definition: ffmpeg_filter.c:1088
OptionGroup::codec_opts
AVDictionary * codec_opts
Definition: cmdutils.h:347
SpecifierOptList::nb_opt
int nb_opt
Definition: cmdutils.h:185
StreamMap::vs
ViewSpecifier vs
Definition: ffmpeg.h:129
opt_attach
static int opt_attach(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:679
opt_recording_timestamp
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:760
StreamMap::linklabel
char * linklabel
Definition: ffmpeg.h:127
SpecifierOpt::specifier
char * specifier
Definition: cmdutils.h:169
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
stereo3d.h
SpecifierOptList::type
enum OptionType type
Definition: cmdutils.h:192
s
#define s(width, name)
Definition: cbs_vp9.c:198
split_commandline
int split_commandline(OptionParseContext *octx, int argc, char *argv[], const OptionDef *options, const OptionGroupDef *groups, int nb_groups)
Split the commandline into an intermediate form convenient for further processing.
Definition: cmdutils.c:790
AVFormatContext::iformat
const struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1326
g
const char * g
Definition: vf_curves.c:128
OptionsContext::limit_filesize
int64_t limit_filesize
Definition: ffmpeg.h:180
VIEW_SPECIFIER_TYPE_NONE
@ VIEW_SPECIFIER_TYPE_NONE
Definition: ffmpeg.h:105
av_strtok
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
Definition: avstring.c:179
OPT_TYPE_DOUBLE
@ OPT_TYPE_DOUBLE
Definition: cmdutils.h:87
opt_audio_qscale
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1227
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:494
filters
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
Definition: af_crystalizer.c:55
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:42
AVHWDeviceType
AVHWDeviceType
Definition: hwcontext.h:27
term_init
void term_init(void)
Definition: ffmpeg.c:205
AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE
write-only
Definition: avio.h:618
AVStreamGroup::index
unsigned int index
Group index in AVFormatContext.
Definition: avformat.h:1151
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
exit_on_error
int exit_on_error
Definition: ffmpeg_opt.c:68
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
print_graphs_format
char * print_graphs_format
Definition: ffmpeg_opt.c:79
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
term_exit
void term_exit(void)
Definition: ffmpeg.c:135
opt_match_per_stream
static unsigned opt_match_per_stream(void *logctx, enum OptionType type, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st)
Definition: ffmpeg_opt.c:178
print_graphs
int print_graphs
Definition: ffmpeg_opt.c:77
av_hwdevice_get_type_name
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
Definition: hwcontext.c:120
do_benchmark_all
int do_benchmark_all
Definition: ffmpeg_opt.c:61
OptionsContext::accurate_seek
int accurate_seek
Definition: ffmpeg.h:157
key
const char * key
Definition: hwcontext_opencl.c:189
opt_video_frames
static int opt_video_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1047
tmp
static uint8_t tmp[40]
Definition: aes_ctr.c:52
AV_OPT_FLAG_BSF_PARAM
#define AV_OPT_FLAG_BSF_PARAM
A generic parameter which can be set by the user for bit stream filtering.
Definition: opt.h:371
sch_sdp_filename
int sch_sdp_filename(Scheduler *sch, const char *sdp_filename)
Set the file path for the SDP.
Definition: ffmpeg_sched.c:657
arg
const char * arg
Definition: jacosubdec.c:65
if
if(ret)
Definition: filter_design.txt:179
OPT_SPEC
#define OPT_SPEC
Definition: cmdutils.h:229
prefix
char prefix[8]
Definition: uops.c:90
OptionsContext::start_time
int64_t start_time
Definition: ffmpeg.h:136
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:232
AVFormatContext
Format I/O context.
Definition: avformat.h:1314
fail
#define fail
Definition: test.h:478
OptionGroup::format_opts
AVDictionary * format_opts
Definition: cmdutils.h:348
opts
static AVDictionary * opts
Definition: movenc.c:51
opt_target
static int opt_target(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:881
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:770
open_file
static int open_file(AVFormatContext *avf, unsigned fileno)
Definition: concatdec.c:336
opt_profile
static int opt_profile(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1189
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
dec_create
int dec_create(const OptionsContext *o, const char *arg, Scheduler *sch)
Create a standalone decoder.
Definition: ffmpeg_dec.c:1685
avcodec_get_class
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition: options.c:184
metadata
Stream codec metadata
Definition: ogg-flac-chained-meta.txt:2
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avformat.h:786
NULL
#define NULL
Definition: coverity.c:32
OPT_HAS_ALT
#define OPT_HAS_ALT
Definition: cmdutils.h:242
OptionParseContext::global_opts
OptionGroup global_opts
Definition: cmdutils.h:365
avcodec_find_decoder_by_name
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
Definition: allcodecs.c:1016
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
av_bsf_get_class
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
Definition: bsf.c:99
StreamMap::group_index
int group_index
Definition: ffmpeg.h:126
OPT_EXPERT
#define OPT_EXPERT
Definition: cmdutils.h:211
swr_get_class
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
Definition: options.c:143
InputFile::start_time_effective
int64_t start_time_effective
Effective format start time based on enabled streams.
Definition: ffmpeg.h:515
AVCodec::type
enum AVMediaType type
Definition: codec.h:182
filter_buffered_frames
int filter_buffered_frames
Definition: ffmpeg_opt.c:75
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
parseutils.h
GlobalOptionsContext::sch
Scheduler * sch
Definition: ffmpeg_opt.c:93
options
Definition: swscale.c:50
ViewSpecifier::val
unsigned val
Definition: ffmpeg.h:118
double
double
Definition: af_crystalizer.c:132
av_parse_time
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
Definition: parseutils.c:592
AV_DICT_DONT_OVERWRITE
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
Definition: dict.h:81
stream_specifier_match
unsigned stream_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStream *st, void *logctx)
Definition: cmdutils.c:1226
STREAM_LIST_GROUP_IDX
@ STREAM_LIST_GROUP_IDX
Definition: cmdutils.h:110
OptionsContext::input_sync_ref
int input_sync_ref
Definition: ffmpeg.h:159
OptionGroup
Definition: cmdutils.h:340
correct_input_start_times
static void correct_input_start_times(void)
Definition: ffmpeg_opt.c:374
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:351
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
input_files
InputFile ** input_files
Definition: ffmpeg.c:108
Scheduler
Definition: ffmpeg_sched.c:278
stream_group_specifier_match
unsigned stream_group_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStreamGroup *stg, void *logctx)
Definition: cmdutils.c:1352
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:988
opt_streamid
static int opt_streamid(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:862
opt_preset
static int opt_preset(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1085
opt_vstats_file
static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1024
codec_opts
AVDictionary * codec_opts
Definition: cmdutils.c:58
VideoSyncMethod
VideoSyncMethod
Definition: ffmpeg.h:56
opt_bitrate
static int opt_bitrate(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1156
AV_OPT_FLAG_FILTERING_PARAM
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
Definition: opt.h:380
max_error_rate
float max_error_rate
Definition: ffmpeg_opt.c:72
frame_sizes
static const uint8_t frame_sizes[]
Definition: rtpdec_qcelp.c:24
f
f
Definition: af_crystalizer.c:122
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
OptionsContext::thread_queue_size
int thread_queue_size
Definition: ffmpeg.h:158
AVMediaType
AVMediaType
Definition: avutil.h:198
OPT_TYPE_INT
@ OPT_TYPE_INT
Definition: cmdutils.h:84
opt_init_hw_device
static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:731
SpecifierOptList
Definition: cmdutils.h:183
OPT_AUDIO
#define OPT_AUDIO
Definition: cmdutils.h:213
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
opt_map
static int opt_map(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:531
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:122
start_time
static int64_t start_time
Definition: ffplay.c:328
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1430
get_preset_file
FILE * get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name)
Get a file corresponding to a preset file.
Definition: cmdutils.c:924
StreamMap
Definition: ffmpeg.h:122
file_overwrite
static int file_overwrite
Definition: ffmpeg_opt.c:84
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:247
opt_subtitle_codec
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:519
OptionsContext::streamid
AVDictionary * streamid
Definition: ffmpeg.h:193
avio_check
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
Definition: avio.c:670
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:469
vstats_filename
char * vstats_filename
Definition: ffmpeg_opt.c:54
OPT_TYPE_INT64
@ OPT_TYPE_INT64
Definition: cmdutils.h:85
OptionType
OptionType
Definition: cmdutils.h:80
show_usage
void show_usage(void)
Definition: ffmpeg_opt.c:1370
opt_sdp_file
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:693
fg_finalise_bindings
int fg_finalise_bindings(void)
Definition: ffmpeg_filter.c:1481
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:166
OPT_FLAG_SPEC
#define OPT_FLAG_SPEC
Definition: cmdutils.h:228
OptionsContext::find_stream_info
int find_stream_info
Definition: ffmpeg.h:160
SpecifierOptList::opt
SpecifierOpt * opt
Definition: cmdutils.h:184
line
Definition: graph2dot.c:48
opt_data_codec
static int opt_data_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:525
init_options
static void init_options(OptionsContext *o)
Definition: ffmpeg_opt.c:135
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:233
OPT_TYPE_FUNC
@ OPT_TYPE_FUNC
Definition: cmdutils.h:81
OPT_DECODER
#define OPT_DECODER
Definition: cmdutils.h:248
OPT_TYPE_BOOL
@ OPT_TYPE_BOOL
Definition: cmdutils.h:82
OPT_HAS_CANON
#define OPT_HAS_CANON
Definition: cmdutils.h:245
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
start_at_zero
int start_at_zero
Definition: ffmpeg_opt.c:65
OptionDef::u1
union OptionDef::@2 u1
apply_sync_offsets
static int apply_sync_offsets(void)
Definition: ffmpeg_opt.c:411
StreamMap::stream_index
int stream_index
Definition: ffmpeg.h:125
OPT_TYPE_TIME
@ OPT_TYPE_TIME
Definition: cmdutils.h:88
OptionsContext::codec_names
SpecifierOptList codec_names
Definition: ffmpeg.h:141
OptionsContext::stream_maps
StreamMap * stream_maps
Definition: ffmpeg.h:171
OptionsContext::start_time_eof
int64_t start_time_eof
Definition: ffmpeg.h:137
VSYNC_CFR
@ VSYNC_CFR
Definition: ffmpeg.h:59
OptionsContext::shortest_buf_duration
float shortest_buf_duration
Definition: ffmpeg.h:183
opt_video_codec
static int opt_video_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:513
opt_qscale
static int opt_qscale(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1172
stdin_interaction
int stdin_interaction
Definition: ffmpeg_opt.c:71
value
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 value
Definition: writing_filters.txt:86
InputFile::ctx
AVFormatContext * ctx
Definition: ffmpeg.h:509
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:357
OPT_FUNC_ARG
#define OPT_FUNC_ARG
Definition: cmdutils.h:205
opt_vstats
static int opt_vstats(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1031
OPT_OUTPUT
#define OPT_OUTPUT
Definition: cmdutils.h:238
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:176
dts_error_threshold
float dts_error_threshold
Definition: ffmpeg_opt.c:57
cmdutils_isalnum
int cmdutils_isalnum(char c)
Definition: cmdutils.c:995
int_cb
const AVIOInterruptCB int_cb
Definition: ffmpeg.c:312
OPT_OFFSET
#define OPT_OFFSET
Definition: cmdutils.h:224
OptionParseContext::groups
OptionGroupList * groups
Definition: cmdutils.h:367
print_graphs_file
char * print_graphs_file
Definition: ffmpeg_opt.c:78
opt_audio_frames
static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1053
avcodec.h
SpecifierOpt::i64
int64_t i64
Definition: cmdutils.h:176
SpecifierOptList::opt_canon
const struct OptionDef * opt_canon
Definition: cmdutils.h:188
av_opt_eval_flags
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
SpecifierOpt
Definition: cmdutils.h:167
find_codec
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **pcodec)
Definition: ffmpeg_opt.c:783
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:747
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:204
read_yesno
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0.
Definition: cmdutils.c:913
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:81
VIEW_SPECIFIER_TYPE_IDX
@ VIEW_SPECIFIER_TYPE_IDX
Definition: ffmpeg.h:107
uninit_parse_context
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
Definition: cmdutils.c:765
OPT_PERFILE
#define OPT_PERFILE
Definition: cmdutils.h:219
opt_match_per_stream_group
static unsigned opt_match_per_stream_group(void *logctx, enum OptionType type, const SpecifierOptList *sol, AVFormatContext *fc, AVStreamGroup *stg)
Definition: ffmpeg_opt.c:242
SpecifierOpt::stream_spec
StreamSpecifier stream_spec
Definition: cmdutils.h:171
OPT_MATCH_PER_STREAM_GROUP
#define OPT_MATCH_PER_STREAM_GROUP(name, type, opt_type, m)
Definition: ffmpeg_opt.c:292
find_stream_info
static int find_stream_info
Definition: ffplay.c:351
avformat.h
CMDUTILS_COMMON_OPTIONS
#define CMDUTILS_COMMON_OPTIONS
Definition: opt_common.h:199
filter_nbthreads
char * filter_nbthreads
Definition: ffmpeg_opt.c:73
AVStreamGroup
Definition: avformat.h:1140
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:753
OPT_FLAG_PERSTREAM
#define OPT_FLAG_PERSTREAM
Definition: cmdutils.h:232
parse_option
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
Definition: cmdutils.c:380
OptionsContext::mux_preload
float mux_preload
Definition: ffmpeg.h:181
OptionDef::names_alt
const char *const * names_alt
Definition: cmdutils.h:264
opt_match_per_type_str
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
Definition: ffmpeg_opt.c:165
opt_common.h
AVInputFormat::flags
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_EXPERIMENTAL, AVFMT_SHOW_IDS,...
Definition: avformat.h:566
AVRational::den
int den
Denominator.
Definition: rational.h:60
SpecifierOpt::str
uint8_t * str
Definition: cmdutils.h:174
OPT_SUBTITLE
#define OPT_SUBTITLE
Definition: cmdutils.h:214
avfilter.h
av_get_token
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
Definition: avstring.c:143
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
parse_and_set_vsync
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx)
Definition: ffmpeg_opt.c:359
ffmpeg_parse_options
int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
GROW_ARRAY
#define GROW_ARRAY(array, nb_elems)
Definition: cmdutils.h:536
InputFile::ts_offset
int64_t ts_offset
Definition: ffmpeg.h:516
VSYNC_AUTO
@ VSYNC_AUTO
Definition: ffmpeg.h:57
parse_optgroup
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
Parse an options group and write results into optctx.
Definition: cmdutils.c:456
GlobalOptionsContext::filtergraphs
char ** filtergraphs
Definition: ffmpeg_opt.c:95
AVERROR_DECODER_NOT_FOUND
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
Definition: error.h:54
opt_default
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions.
Definition: cmdutils.c:599
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:355
desc
const char * desc
Definition: libsvtav1.c:83
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
AVERROR_ENCODER_NOT_FOUND
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
Definition: error.h:56
avutil.h
ViewSpecifier::type
enum ViewSpecifierType type
Definition: ffmpeg.h:117
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
mem.h
copy_tb
int copy_tb
Definition: ffmpeg_opt.c:66
SpecifierOpt::u
union SpecifierOpt::@0 u
opt_stats_period
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:489
vstats_version
int vstats_version
Definition: ffmpeg_opt.c:76
avio_open2
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Definition: avio.c:497
av_strdup
#define av_strdup(s)
Definition: ops_asmgen.c:47
of_open
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
Definition: ffmpeg_mux_init.c:3271
OptionDef::name
const char * name
Definition: cmdutils.h:196
ffmpeg_sched.h
OPT_VIDEO
#define OPT_VIDEO
Definition: cmdutils.h:212
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
OptionsContext::attachments
const char ** attachments
Definition: ffmpeg.h:173
SpecifierOpt::dbl
double dbl
Definition: cmdutils.h:179
OPT_TYPE_STRING
@ OPT_TYPE_STRING
Definition: cmdutils.h:83
audio_disable
static int audio_disable
Definition: ffplay.c:316
VIEW_SPECIFIER_TYPE_ID
@ VIEW_SPECIFIER_TYPE_ID
Definition: ffmpeg.h:109
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:86
av_dict_copy
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition: dict.c:247
copy_ts
int copy_ts
Definition: ffmpeg_opt.c:64
cmdutils.h
OFFSET
#define OFFSET(x)
InputFile::input_ts_offset
int64_t input_ts_offset
Definition: ffmpeg.h:510
avio_find_protocol_name
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
Definition: avio.c:663
codec_string
Definition: codecstring.c:36
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:254
frame_drop_threshold
float frame_drop_threshold
Definition: ffmpeg_opt.c:59
recast_media
int recast_media
Definition: ffmpeg_opt.c:88
view_specifier_parse
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
Definition: ffmpeg_opt.c:306
av_strlcpy
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:85
print_stats
int print_stats
Definition: ffmpeg_opt.c:70
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
graphprint.h
AVERROR_EXIT
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:58
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:796
avstring.h
avcodec_descriptor_get_by_name
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
Definition: codec_desc.c:3893
InputFile::nb_streams
int nb_streams
Definition: ffmpeg.h:524
OPT_MATCH_PER_STREAM
#define OPT_MATCH_PER_STREAM(name, type, opt_type, m)
Definition: ffmpeg_opt.c:228
hw_device_get_by_name
HWDevice * hw_device_get_by_name(const char *name)
Definition: ffmpeg_hw.c:42
avfilter_get_class
const AVClass * avfilter_get_class(void)
Definition: avfilter.c:1659
dump_attachment
static int dump_attachment(InputStream *ist, const char *filename)
Definition: ffmpeg_demux.c:1938
VSYNC_PASSTHROUGH
@ VSYNC_PASSTHROUGH
Definition: ffmpeg.h:58
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:298
snprintf
#define snprintf
Definition: snprintf.h:34
ABORT_ON_FLAG_EMPTY_OUTPUT
#define ABORT_ON_FLAG_EMPTY_OUTPUT
Definition: ffmpeg.h:540
SpecifierOpt::f
float f
Definition: cmdutils.h:178
opt_filter_complex
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1233
avcodec_find_encoder_by_name
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
Definition: allcodecs.c:1011
dts_delta_threshold
float dts_delta_threshold
Definition: ffmpeg_opt.c:56
abort_on_flags
int abort_on_flags
Definition: ffmpeg_opt.c:69
filter_complex_nbthreads
int filter_complex_nbthreads
Definition: ffmpeg_opt.c:74
OptionDef::flags
int flags
Definition: cmdutils.h:198