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