FFmpeg
ffmpeg_opt.c
Go to the documentation of this file.
1 /*
2  * ffmpeg option parsing
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config.h"
22 
23 #include <stdint.h>
24 
25 #if HAVE_SYS_RESOURCE_H
26 #include <sys/time.h>
27 #include <sys/resource.h>
28 #endif
29 
30 #include "ffmpeg.h"
31 #include "cmdutils.h"
32 #include "opt_common.h"
33 #include "sync_queue.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/bprint.h"
47 #include "libavutil/display.h"
48 #include "libavutil/intreadwrite.h"
49 #include "libavutil/fifo.h"
50 #include "libavutil/mathematics.h"
51 #include "libavutil/opt.h"
52 #include "libavutil/parseutils.h"
53 #include "libavutil/pixdesc.h"
54 #include "libavutil/pixfmt.h"
55 
56 const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
57 const char *const opt_name_frame_rates[] = {"r", NULL};
58 const char *const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL};
59 #if FFMPEG_OPT_TOP
60 const char *const opt_name_top_field_first[] = {"top", NULL};
61 #endif
62 
64 
67 
70 float dts_error_threshold = 3600*30;
71 
74 int do_benchmark = 0;
76 int do_hex_dump = 0;
77 int do_pkt_dump = 0;
78 int copy_ts = 0;
79 int start_at_zero = 0;
80 int copy_tb = -1;
81 int debug_ts = 0;
82 int exit_on_error = 0;
84 int print_stats = -1;
86 float max_error_rate = 2.0/3;
91 int64_t stats_period = 500000;
92 
93 
94 static int file_overwrite = 0;
95 static int no_file_overwrite = 0;
96 #if FFMPEG_OPT_PSNR
97 int do_psnr = 0;
98 #endif
101 int recast_media = 0;
102 
104 {
105  const OptionDef *po = options;
106  int i;
107 
108  /* all OPT_SPEC and OPT_STRING can be freed in generic way */
109  while (po->name) {
110  void *dst = (uint8_t*)o + po->u.off;
111 
112  if (po->flags & OPT_SPEC) {
113  SpecifierOpt **so = dst;
114  int i, *count = (int*)(so + 1);
115  for (i = 0; i < *count; i++) {
116  av_freep(&(*so)[i].specifier);
117  if (po->flags & OPT_STRING)
118  av_freep(&(*so)[i].u.str);
119  }
120  av_freep(so);
121  *count = 0;
122  } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING)
123  av_freep(dst);
124  po++;
125  }
126 
127  for (i = 0; i < o->nb_stream_maps; i++)
129  av_freep(&o->stream_maps);
130 #if FFMPEG_OPT_MAP_CHANNEL
132 #endif
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 = -1;
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 
168 /* return a copy of the input with the stream specifiers removed from the keys */
170 {
171  const AVDictionaryEntry *e = NULL;
172  AVDictionary *ret = NULL;
173 
174  while ((e = av_dict_iterate(dict, e))) {
175  char *p = strchr(e->key, ':');
176 
177  if (p)
178  *p = 0;
179  av_dict_set(&ret, e->key, e->value, 0);
180  if (p)
181  *p = ':';
182  }
183  return ret;
184 }
185 
186 int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
187 {
188  if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
189  else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR;
190  else if (!av_strcasecmp(arg, "passthrough")) *vsync_var = VSYNC_PASSTHROUGH;
191  else if (!av_strcasecmp(arg, "drop")) *vsync_var = VSYNC_DROP;
192  else if (!is_global && !av_strcasecmp(arg, "auto")) *vsync_var = VSYNC_AUTO;
193  else if (!is_global) {
194  av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx);
195  return AVERROR(EINVAL);
196  }
197 
198  if (is_global && *vsync_var == VSYNC_AUTO) {
199  int ret;
200  double num;
201 
202  ret = parse_number("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR, &num);
203  if (ret < 0)
204  return ret;
205 
206  video_sync_method = num;
207  av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
208  " use a string argument as described in the manual.\n");
209  }
210  return 0;
211 }
212 
213 /* Correct input file start times based on enabled streams */
214 static void correct_input_start_times(void)
215 {
216  for (int i = 0; i < nb_input_files; i++) {
217  InputFile *ifile = input_files[i];
218  AVFormatContext *is = ifile->ctx;
219  int64_t new_start_time = INT64_MAX, diff, abs_start_seek;
220 
221  ifile->start_time_effective = is->start_time;
222 
223  if (is->start_time == AV_NOPTS_VALUE ||
224  !(is->iformat->flags & AVFMT_TS_DISCONT))
225  continue;
226 
227  for (int j = 0; j < is->nb_streams; j++) {
228  AVStream *st = is->streams[j];
229  if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE)
230  continue;
231  new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q));
232  }
233 
234  diff = new_start_time - is->start_time;
235  if (diff) {
236  av_log(NULL, AV_LOG_VERBOSE, "Correcting start time of Input #%d by %"PRId64" us.\n", i, diff);
237  ifile->start_time_effective = new_start_time;
238  if (copy_ts && start_at_zero)
239  ifile->ts_offset = -new_start_time;
240  else if (!copy_ts) {
241  abs_start_seek = is->start_time + (ifile->start_time != AV_NOPTS_VALUE) ? ifile->start_time : 0;
242  ifile->ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
243  } else if (copy_ts)
244  ifile->ts_offset = 0;
245 
246  ifile->ts_offset += ifile->input_ts_offset;
247  }
248  }
249 }
250 
251 static int apply_sync_offsets(void)
252 {
253  for (int i = 0; i < nb_input_files; i++) {
254  InputFile *ref, *self = input_files[i];
255  int64_t adjustment;
256  int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
257  int start_times_set = 1;
258 
259  if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
260  if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) {
261  av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref);
262  return AVERROR(EINVAL);
263  }
264 
265  if (copy_ts && !start_at_zero) {
266  av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n");
267  return AVERROR(EINVAL);
268  }
269 
270  ref = input_files[self->input_sync_ref];
271  if (ref->input_sync_ref != -1 && ref->input_sync_ref != self->input_sync_ref) {
272  av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced input %d. Sync not set.\n", i, self->input_sync_ref);
273  continue;
274  }
275 
276  if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && ref->ctx->start_time_realtime != AV_NOPTS_VALUE) {
277  self_start_time = self->ctx->start_time_realtime;
278  ref_start_time = ref->ctx->start_time_realtime;
279  } else if (self->start_time_effective != AV_NOPTS_VALUE && ref->start_time_effective != AV_NOPTS_VALUE) {
280  self_start_time = self->start_time_effective;
281  ref_start_time = ref->start_time_effective;
282  } else {
283  start_times_set = 0;
284  }
285 
286  if (start_times_set) {
287  self_seek_start = self->start_time == AV_NOPTS_VALUE ? 0 : self->start_time;
288  ref_seek_start = ref->start_time == AV_NOPTS_VALUE ? 0 : ref->start_time;
289 
290  adjustment = (self_start_time - ref_start_time) + !copy_ts*(self_seek_start - ref_seek_start) + ref->input_ts_offset;
291 
292  self->ts_offset += adjustment;
293 
294  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);
295  } else {
296  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);
297  }
298  }
299 
300  return 0;
301 }
302 
303 static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
304 {
307  return 0;
308 }
309 
310 static int opt_abort_on(void *optctx, const char *opt, const char *arg)
311 {
312  static const AVOption opts[] = {
313  { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
314  { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT }, .unit = "flags" },
315  { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" },
316  { NULL },
317  };
318  static const AVClass class = {
319  .class_name = "",
320  .item_name = av_default_item_name,
321  .option = opts,
322  .version = LIBAVUTIL_VERSION_INT,
323  };
324  const AVClass *pclass = &class;
325 
326  return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags);
327 }
328 
329 static int opt_stats_period(void *optctx, const char *opt, const char *arg)
330 {
331  int64_t user_stats_period;
332  int ret = av_parse_time(&user_stats_period, arg, 1);
333  if (ret < 0)
334  return ret;
335 
336  if (user_stats_period <= 0) {
337  av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg);
338  return AVERROR(EINVAL);
339  }
340 
341  stats_period = user_stats_period;
342  av_log(NULL, AV_LOG_INFO, "ffmpeg stats and -progress period set to %s.\n", arg);
343 
344  return 0;
345 }
346 
347 static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
348 {
349  OptionsContext *o = optctx;
350  return parse_option(o, "codec:a", arg, options);
351 }
352 
353 static int opt_video_codec(void *optctx, const char *opt, const char *arg)
354 {
355  OptionsContext *o = optctx;
356  return parse_option(o, "codec:v", arg, options);
357 }
358 
359 static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
360 {
361  OptionsContext *o = optctx;
362  return parse_option(o, "codec:s", arg, options);
363 }
364 
365 static int opt_data_codec(void *optctx, const char *opt, const char *arg)
366 {
367  OptionsContext *o = optctx;
368  return parse_option(o, "codec:d", arg, options);
369 }
370 
371 static int opt_map(void *optctx, const char *opt, const char *arg)
372 {
373  OptionsContext *o = optctx;
374  StreamMap *m = NULL;
375  int i, negative = 0, file_idx, disabled = 0;
376  int ret;
377  char *map, *p;
378  char *allow_unused;
379 
380  if (*arg == '-') {
381  negative = 1;
382  arg++;
383  }
384  map = av_strdup(arg);
385  if (!map)
386  return AVERROR(ENOMEM);
387 
388 #if FFMPEG_OPT_MAP_SYNC
389  {
390  /* parse sync stream first, just pick first matching stream */
391  char *sync = strchr(map, ',');
392 
393  if (sync) {
394  *sync = 0;
395  av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
396  }
397  }
398 #endif
399 
400 
401  if (map[0] == '[') {
402  /* this mapping refers to lavfi output */
403  const char *c = map + 1;
404 
406  if (ret < 0)
407  goto fail;
408 
409  m = &o->stream_maps[o->nb_stream_maps - 1];
410  m->linklabel = av_get_token(&c, "]");
411  if (!m->linklabel) {
412  av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", map);
413  ret = AVERROR(EINVAL);
414  goto fail;
415  }
416  } else {
417  if (allow_unused = strchr(map, '?'))
418  *allow_unused = 0;
419  file_idx = strtol(map, &p, 0);
420  if (file_idx >= nb_input_files || file_idx < 0) {
421  av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
422  ret = AVERROR(EINVAL);
423  goto fail;
424  }
425  if (negative)
426  /* disable some already defined maps */
427  for (i = 0; i < o->nb_stream_maps; i++) {
428  m = &o->stream_maps[i];
429  if (file_idx == m->file_index &&
432  *p == ':' ? p + 1 : p) > 0)
433  m->disabled = 1;
434  }
435  else
436  for (i = 0; i < input_files[file_idx]->nb_streams; i++) {
437  if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i],
438  *p == ':' ? p + 1 : p) <= 0)
439  continue;
440  if (input_files[file_idx]->streams[i]->user_set_discard == AVDISCARD_ALL) {
441  disabled = 1;
442  continue;
443  }
445  if (ret < 0)
446  goto fail;
447 
448  m = &o->stream_maps[o->nb_stream_maps - 1];
449 
450  m->file_index = file_idx;
451  m->stream_index = i;
452  }
453  }
454 
455  if (!m) {
456  if (allow_unused) {
457  av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; ignoring.\n", arg);
458  } else if (disabled) {
459  av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches disabled streams.\n"
460  "To ignore this, add a trailing '?' to the map.\n", arg);
461  ret = AVERROR(EINVAL);
462  goto fail;
463  } else {
464  av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
465  "To ignore this, add a trailing '?' to the map.\n", arg);
466  ret = AVERROR(EINVAL);
467  goto fail;
468  }
469  }
470  ret = 0;
471 fail:
472  av_freep(&map);
473  return ret;
474 }
475 
476 static int opt_attach(void *optctx, const char *opt, const char *arg)
477 {
478  OptionsContext *o = optctx;
480  if (ret < 0)
481  return ret;
482 
483  o->attachments[o->nb_attachments - 1] = arg;
484  return 0;
485 }
486 
487 #if FFMPEG_OPT_MAP_CHANNEL
488 static int opt_map_channel(void *optctx, const char *opt, const char *arg)
489 {
490  OptionsContext *o = optctx;
491  int n, ret;
492  AVStream *st;
493  AudioChannelMap *m;
494  char *allow_unused;
495  char *mapchan;
496 
498  "The -%s option is deprecated and will be removed. "
499  "It can be replaced by the 'pan' filter, or in some cases by "
500  "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt);
501 
502  mapchan = av_strdup(arg);
503  if (!mapchan)
504  return AVERROR(ENOMEM);
505 
507  if (ret < 0)
508  goto end;
509 
511 
512  /* muted channel syntax */
513  n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx);
514  if ((n == 1 || n == 3) && m->channel_idx == -1) {
515  m->file_idx = m->stream_idx = -1;
516  if (n == 1)
517  m->ofile_idx = m->ostream_idx = -1;
518  av_free(mapchan);
519  return 0;
520  }
521 
522  /* normal syntax */
523  n = sscanf(arg, "%d.%d.%d:%d.%d",
524  &m->file_idx, &m->stream_idx, &m->channel_idx,
525  &m->ofile_idx, &m->ostream_idx);
526 
527  if (n != 3 && n != 5) {
528  av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: "
529  "[file.stream.channel|-1][:syncfile:syncstream]\n");
530  goto fail;
531  }
532 
533  if (n != 5) // only file.stream.channel specified
534  m->ofile_idx = m->ostream_idx = -1;
535 
536  /* check input */
537  if (m->file_idx < 0 || m->file_idx >= nb_input_files) {
538  av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n",
539  m->file_idx);
540  goto fail;
541  }
542  if (m->stream_idx < 0 ||
544  av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n",
545  m->file_idx, m->stream_idx);
546  goto fail;
547  }
548  st = input_files[m->file_idx]->ctx->streams[m->stream_idx];
549  if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
550  av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n",
551  m->file_idx, m->stream_idx);
552  goto fail;
553  }
554  /* allow trailing ? to map_channel */
555  if (allow_unused = strchr(mapchan, '?'))
556  *allow_unused = 0;
557  if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels ||
559  if (allow_unused) {
560  av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n",
561  m->file_idx, m->stream_idx, m->channel_idx);
562  } else {
563  av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n"
564  "To ignore this, add a trailing '?' to the map_channel.\n",
565  m->file_idx, m->stream_idx, m->channel_idx);
566  goto fail;
567  }
568 
569  }
570  ret = 0;
571 end:
572  av_free(mapchan);
573  return ret;
574 fail:
575  ret = AVERROR(EINVAL);
576  goto end;
577 }
578 #endif
579 
580 static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
581 {
584  return 0;
585 }
586 
587 #if CONFIG_VAAPI
588 static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
589 {
590  const char *prefix = "vaapi:";
591  char *tmp;
592  int err;
593  tmp = av_asprintf("%s%s", prefix, arg);
594  if (!tmp)
595  return AVERROR(ENOMEM);
597  av_free(tmp);
598  return err;
599 }
600 #endif
601 
602 #if CONFIG_QSV
603 static int opt_qsv_device(void *optctx, const char *opt, const char *arg)
604 {
605  const char *prefix = "qsv=__qsv_device:hw_any,child_device=";
606  int err;
607  char *tmp = av_asprintf("%s%s", prefix, arg);
608 
609  if (!tmp)
610  return AVERROR(ENOMEM);
611 
613  av_free(tmp);
614 
615  return err;
616 }
617 #endif
618 
619 static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
620 {
621  if (!strcmp(arg, "list")) {
623  printf("Supported hardware device types:\n");
624  while ((type = av_hwdevice_iterate_types(type)) !=
627  printf("\n");
628  return AVERROR_EXIT;
629  } else {
631  }
632 }
633 
634 static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
635 {
636  if (filter_hw_device) {
637  av_log(NULL, AV_LOG_ERROR, "Only one filter device can be used.\n");
638  return AVERROR(EINVAL);
639  }
641  if (!filter_hw_device) {
642  av_log(NULL, AV_LOG_ERROR, "Invalid filter device %s.\n", arg);
643  return AVERROR(EINVAL);
644  }
645  return 0;
646 }
647 
648 static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
649 {
650  OptionsContext *o = optctx;
651  char buf[128];
652  int64_t recording_timestamp;
653  int ret;
654  struct tm time;
655 
656  ret = av_parse_time(&recording_timestamp, arg, 0);
657  if (ret < 0)
658  return ret;
659 
660  recording_timestamp /= 1e6;
661  time = *gmtime((time_t*)&recording_timestamp);
662  if (!strftime(buf, sizeof(buf), "creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
663  return -1;
664  parse_option(o, "metadata", buf, options);
665 
666  av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
667  "tag instead.\n", opt);
668  return 0;
669 }
670 
671 int find_codec(void *logctx, const char *name,
672  enum AVMediaType type, int encoder, const AVCodec **pcodec)
673 {
674  const AVCodecDescriptor *desc;
675  const char *codec_string = encoder ? "encoder" : "decoder";
676  const AVCodec *codec;
677 
678  codec = encoder ?
681 
682  if (!codec && (desc = avcodec_descriptor_get_by_name(name))) {
683  codec = encoder ? avcodec_find_encoder(desc->id) :
685  if (codec)
686  av_log(logctx, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n",
687  codec_string, codec->name, desc->name);
688  }
689 
690  if (!codec) {
691  av_log(logctx, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
692  return encoder ? AVERROR_ENCODER_NOT_FOUND :
694  }
695  if (codec->type != type && !recast_media) {
696  av_log(logctx, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
697  return AVERROR(EINVAL);
698  }
699 
700  *pcodec = codec;
701  return 0;;
702 }
703 
704 int assert_file_overwrite(const char *filename)
705 {
706  const char *proto_name = avio_find_protocol_name(filename);
707 
709  fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n");
710  return AVERROR(EINVAL);
711  }
712 
713  if (!file_overwrite) {
714  if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) {
716  fprintf(stderr,"File '%s' already exists. Overwrite? [y/N] ", filename);
717  fflush(stderr);
718  term_exit();
719  signal(SIGINT, SIG_DFL);
720  if (!read_yesno()) {
721  av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n");
722  return AVERROR_EXIT;
723  }
724  term_init();
725  }
726  else {
727  av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
728  return AVERROR_EXIT;
729  }
730  }
731  }
732 
733  if (proto_name && !strcmp(proto_name, "file")) {
734  for (int i = 0; i < nb_input_files; i++) {
735  InputFile *file = input_files[i];
736  if (file->ctx->iformat->flags & AVFMT_NOFILE)
737  continue;
738  if (!strcmp(filename, file->ctx->url)) {
739  av_log(NULL, AV_LOG_FATAL, "Output %s same as Input #%d - exiting\n", filename, i);
740  av_log(NULL, AV_LOG_WARNING, "FFmpeg cannot edit existing files in-place.\n");
741  return AVERROR(EINVAL);
742  }
743  }
744  }
745 
746  return 0;
747 }
748 
749 /* read file contents into a string */
750 char *file_read(const char *filename)
751 {
752  AVIOContext *pb = NULL;
753  int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
754  AVBPrint bprint;
755  char *str;
756 
757  if (ret < 0) {
758  av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
759  return NULL;
760  }
761 
763  ret = avio_read_to_bprint(pb, &bprint, SIZE_MAX);
764  avio_closep(&pb);
765  if (ret < 0) {
766  av_bprint_finalize(&bprint, NULL);
767  return NULL;
768  }
769  ret = av_bprint_finalize(&bprint, &str);
770  if (ret < 0)
771  return NULL;
772  return str;
773 }
774 
775 /* arg format is "output-stream-index:streamid-value". */
776 static int opt_streamid(void *optctx, const char *opt, const char *arg)
777 {
778  OptionsContext *o = optctx;
779  char *p;
780  char idx_str[16];
781 
782  av_strlcpy(idx_str, arg, sizeof(idx_str));
783  p = strchr(idx_str, ':');
784  if (!p) {
786  "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
787  arg, opt);
788  return AVERROR(EINVAL);
789  }
790  *p++ = '\0';
791 
792  return av_dict_set(&o->streamid, idx_str, p, 0);
793 }
794 
795 static int init_complex_filters(void)
796 {
797  int i, ret = 0;
798 
799  for (i = 0; i < nb_filtergraphs; i++) {
801  if (ret < 0)
802  return ret;
803  }
804  return 0;
805 }
806 
807 static int opt_target(void *optctx, const char *opt, const char *arg)
808 {
809  OptionsContext *o = optctx;
810  enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
811  static const char *const frame_rates[] = { "25", "30000/1001", "24000/1001" };
812 
813  if (!strncmp(arg, "pal-", 4)) {
814  norm = PAL;
815  arg += 4;
816  } else if (!strncmp(arg, "ntsc-", 5)) {
817  norm = NTSC;
818  arg += 5;
819  } else if (!strncmp(arg, "film-", 5)) {
820  norm = FILM;
821  arg += 5;
822  } else {
823  /* Try to determine PAL/NTSC by peeking in the input files */
824  if (nb_input_files) {
825  int i, j;
826  for (j = 0; j < nb_input_files; j++) {
827  for (i = 0; i < input_files[j]->nb_streams; i++) {
828  AVStream *st = input_files[j]->ctx->streams[i];
829  int64_t fr;
831  continue;
832  fr = st->time_base.den * 1000LL / st->time_base.num;
833  if (fr == 25000) {
834  norm = PAL;
835  break;
836  } else if ((fr == 29970) || (fr == 23976)) {
837  norm = NTSC;
838  break;
839  }
840  }
841  if (norm != UNKNOWN)
842  break;
843  }
844  }
845  if (norm != UNKNOWN)
846  av_log(NULL, AV_LOG_INFO, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
847  }
848 
849  if (norm == UNKNOWN) {
850  av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
851  av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
852  av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n");
853  return AVERROR(EINVAL);
854  }
855 
856  if (!strcmp(arg, "vcd")) {
857  opt_video_codec(o, "c:v", "mpeg1video");
858  opt_audio_codec(o, "c:a", "mp2");
859  parse_option(o, "f", "vcd", options);
860 
861  parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
862  parse_option(o, "r", frame_rates[norm], options);
863  opt_default(NULL, "g", norm == PAL ? "15" : "18");
864 
865  opt_default(NULL, "b:v", "1150000");
866  opt_default(NULL, "maxrate:v", "1150000");
867  opt_default(NULL, "minrate:v", "1150000");
868  opt_default(NULL, "bufsize:v", "327680"); // 40*1024*8;
869 
870  opt_default(NULL, "b:a", "224000");
871  parse_option(o, "ar", "44100", options);
872  parse_option(o, "ac", "2", options);
873 
874  opt_default(NULL, "packetsize", "2324");
875  opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;
876 
877  /* We have to offset the PTS, so that it is consistent with the SCR.
878  SCR starts at 36000, but the first two packs contain only padding
879  and the first pack from the other stream, respectively, may also have
880  been written before.
881  So the real data starts at SCR 36000+3*1200. */
882  o->mux_preload = (36000 + 3 * 1200) / 90000.0; // 0.44
883  } else if (!strcmp(arg, "svcd")) {
884 
885  opt_video_codec(o, "c:v", "mpeg2video");
886  opt_audio_codec(o, "c:a", "mp2");
887  parse_option(o, "f", "svcd", options);
888 
889  parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
890  parse_option(o, "r", frame_rates[norm], options);
891  parse_option(o, "pix_fmt", "yuv420p", options);
892  opt_default(NULL, "g", norm == PAL ? "15" : "18");
893 
894  opt_default(NULL, "b:v", "2040000");
895  opt_default(NULL, "maxrate:v", "2516000");
896  opt_default(NULL, "minrate:v", "0"); // 1145000;
897  opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
898  opt_default(NULL, "scan_offset", "1");
899 
900  opt_default(NULL, "b:a", "224000");
901  parse_option(o, "ar", "44100", options);
902 
903  opt_default(NULL, "packetsize", "2324");
904 
905  } else if (!strcmp(arg, "dvd")) {
906 
907  opt_video_codec(o, "c:v", "mpeg2video");
908  opt_audio_codec(o, "c:a", "ac3");
909  parse_option(o, "f", "dvd", options);
910 
911  parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
912  parse_option(o, "r", frame_rates[norm], options);
913  parse_option(o, "pix_fmt", "yuv420p", options);
914  opt_default(NULL, "g", norm == PAL ? "15" : "18");
915 
916  opt_default(NULL, "b:v", "6000000");
917  opt_default(NULL, "maxrate:v", "9000000");
918  opt_default(NULL, "minrate:v", "0"); // 1500000;
919  opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
920 
921  opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
922  opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
923 
924  opt_default(NULL, "b:a", "448000");
925  parse_option(o, "ar", "48000", options);
926 
927  } else if (!strncmp(arg, "dv", 2)) {
928 
929  parse_option(o, "f", "dv", options);
930 
931  parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
932  parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
933  norm == PAL ? "yuv420p" : "yuv411p", options);
934  parse_option(o, "r", frame_rates[norm], options);
935 
936  parse_option(o, "ar", "48000", options);
937  parse_option(o, "ac", "2", options);
938 
939  } else {
940  av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg);
941  return AVERROR(EINVAL);
942  }
943 
946 
947  return 0;
948 }
949 
950 static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
951 {
954  return 0;
955 }
956 
957 static int opt_vstats(void *optctx, const char *opt, const char *arg)
958 {
959  char filename[40];
960  time_t today2 = time(NULL);
961  struct tm *today = localtime(&today2);
962 
963  if (!today) { // maybe tomorrow
964  av_log(NULL, AV_LOG_FATAL, "Unable to get current time: %s\n", strerror(errno));
965  return AVERROR(errno);
966  }
967 
968  snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
969  today->tm_sec);
970  return opt_vstats_file(NULL, opt, filename);
971 }
972 
973 static int opt_video_frames(void *optctx, const char *opt, const char *arg)
974 {
975  OptionsContext *o = optctx;
976  return parse_option(o, "frames:v", arg, options);
977 }
978 
979 static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
980 {
981  OptionsContext *o = optctx;
982  return parse_option(o, "frames:a", arg, options);
983 }
984 
985 static int opt_data_frames(void *optctx, const char *opt, const char *arg)
986 {
987  OptionsContext *o = optctx;
988  return parse_option(o, "frames:d", arg, options);
989 }
990 
991 static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
992 {
993  int ret;
994  AVDictionary *cbak = codec_opts;
995  AVDictionary *fbak = format_opts;
996  codec_opts = NULL;
997  format_opts = NULL;
998 
999  ret = opt_default(NULL, opt, arg);
1000 
1001  av_dict_copy(&o->g->codec_opts , codec_opts, 0);
1005  codec_opts = cbak;
1006  format_opts = fbak;
1007 
1008  return ret;
1009 }
1010 
1011 static int opt_preset(void *optctx, const char *opt, const char *arg)
1012 {
1013  OptionsContext *o = optctx;
1014  FILE *f=NULL;
1015  char filename[1000], line[1000], tmp_line[1000];
1016  const char *codec_name = NULL;
1017  int ret = 0;
1018 
1019  tmp_line[0] = *opt;
1020  tmp_line[1] = 0;
1021  MATCH_PER_TYPE_OPT(codec_names, str, codec_name, NULL, tmp_line);
1022 
1023  if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
1024  if(!strncmp(arg, "libx264-lossless", strlen("libx264-lossless"))){
1025  av_log(NULL, AV_LOG_FATAL, "Please use -preset <speed> -qp 0\n");
1026  }else
1027  av_log(NULL, AV_LOG_FATAL, "File for preset '%s' not found\n", arg);
1028  return AVERROR(ENOENT);
1029  }
1030 
1031  while (fgets(line, sizeof(line), f)) {
1032  char *key = tmp_line, *value, *endptr;
1033 
1034  if (strcspn(line, "#\n\r") == 0)
1035  continue;
1036  av_strlcpy(tmp_line, line, sizeof(tmp_line));
1037  if (!av_strtok(key, "=", &value) ||
1038  !av_strtok(value, "\r\n", &endptr)) {
1039  av_log(NULL, AV_LOG_FATAL, "%s: Invalid syntax: '%s'\n", filename, line);
1040  ret = AVERROR(EINVAL);
1041  goto fail;
1042  }
1043  av_log(NULL, AV_LOG_DEBUG, "ffpreset[%s]: set '%s' = '%s'\n", filename, key, value);
1044 
1045  if (!strcmp(key, "acodec")) opt_audio_codec (o, key, value);
1046  else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value);
1047  else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value);
1048  else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value);
1049  else if (opt_default_new(o, key, value) < 0) {
1050  av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
1051  filename, line, key, value);
1052  ret = AVERROR(EINVAL);
1053  goto fail;
1054  }
1055  }
1056 
1057 fail:
1058  fclose(f);
1059 
1060  return ret;
1061 }
1062 
1063 static int opt_old2new(void *optctx, const char *opt, const char *arg)
1064 {
1065  OptionsContext *o = optctx;
1066  int ret;
1067  char *s = av_asprintf("%s:%c", opt + 1, *opt);
1068  if (!s)
1069  return AVERROR(ENOMEM);
1070  ret = parse_option(o, s, arg, options);
1071  av_free(s);
1072  return ret;
1073 }
1074 
1075 static int opt_bitrate(void *optctx, const char *opt, const char *arg)
1076 {
1077  OptionsContext *o = optctx;
1078 
1079  if(!strcmp(opt, "ab")){
1080  av_dict_set(&o->g->codec_opts, "b:a", arg, 0);
1081  return 0;
1082  } else if(!strcmp(opt, "b")){
1083  av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n");
1084  av_dict_set(&o->g->codec_opts, "b:v", arg, 0);
1085  return 0;
1086  }
1087  av_dict_set(&o->g->codec_opts, opt, arg, 0);
1088  return 0;
1089 }
1090 
1091 static int opt_qscale(void *optctx, const char *opt, const char *arg)
1092 {
1093  OptionsContext *o = optctx;
1094  char *s;
1095  int ret;
1096  if(!strcmp(opt, "qscale")){
1097  av_log(NULL, AV_LOG_WARNING, "Please use -q:a or -q:v, -qscale is ambiguous\n");
1098  return parse_option(o, "q:v", arg, options);
1099  }
1100  s = av_asprintf("q%s", opt + 6);
1101  if (!s)
1102  return AVERROR(ENOMEM);
1103  ret = parse_option(o, s, arg, options);
1104  av_free(s);
1105  return ret;
1106 }
1107 
1108 static int opt_profile(void *optctx, const char *opt, const char *arg)
1109 {
1110  OptionsContext *o = optctx;
1111  if(!strcmp(opt, "profile")){
1112  av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n");
1113  av_dict_set(&o->g->codec_opts, "profile:v", arg, 0);
1114  return 0;
1115  }
1116  av_dict_set(&o->g->codec_opts, opt, arg, 0);
1117  return 0;
1118 }
1119 
1120 static int opt_video_filters(void *optctx, const char *opt, const char *arg)
1121 {
1122  OptionsContext *o = optctx;
1123  return parse_option(o, "filter:v", arg, options);
1124 }
1125 
1126 static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
1127 {
1128  OptionsContext *o = optctx;
1129  return parse_option(o, "filter:a", arg, options);
1130 }
1131 
1132 static int opt_vsync(void *optctx, const char *opt, const char *arg)
1133 {
1134  av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n");
1135  return parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
1136 }
1137 
1138 static int opt_timecode(void *optctx, const char *opt, const char *arg)
1139 {
1140  OptionsContext *o = optctx;
1141  int ret;
1142  char *tcr = av_asprintf("timecode=%s", arg);
1143  if (!tcr)
1144  return AVERROR(ENOMEM);
1145  ret = parse_option(o, "metadata:g", tcr, options);
1146  if (ret >= 0)
1147  ret = av_dict_set(&o->g->codec_opts, "gop_timecode", arg, 0);
1148  av_free(tcr);
1149  return ret;
1150 }
1151 
1152 static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
1153 {
1154  OptionsContext *o = optctx;
1155  return parse_option(o, "q:a", arg, options);
1156 }
1157 
1158 static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
1159 {
1160  char *graph_desc = av_strdup(arg);
1161  if (!graph_desc)
1162  return AVERROR(ENOMEM);
1163 
1164  return fg_create(NULL, graph_desc);
1165 }
1166 
1167 static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
1168 {
1169  char *graph_desc = file_read(arg);
1170  if (!graph_desc)
1171  return AVERROR(EINVAL);
1172 
1173  return fg_create(NULL, graph_desc);
1174 }
1175 
1176 void show_help_default(const char *opt, const char *arg)
1177 {
1178  /* per-file options have at least one of those set */
1179  const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE;
1180  int show_advanced = 0, show_avoptions = 0;
1181 
1182  if (opt && *opt) {
1183  if (!strcmp(opt, "long"))
1184  show_advanced = 1;
1185  else if (!strcmp(opt, "full"))
1186  show_advanced = show_avoptions = 1;
1187  else
1188  av_log(NULL, AV_LOG_ERROR, "Unknown help option '%s'.\n", opt);
1189  }
1190 
1191  show_usage();
1192 
1193  printf("Getting help:\n"
1194  " -h -- print basic options\n"
1195  " -h long -- print more options\n"
1196  " -h full -- print all options (including all format and codec specific options, very long)\n"
1197  " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1198  " See man %s for detailed description of the options.\n"
1199  "\n", program_name);
1200 
1201  show_help_options(options, "Print help / information / capabilities:",
1202  OPT_EXIT, 0, 0);
1203 
1204  show_help_options(options, "Global options (affect whole program "
1205  "instead of just one file):",
1206  0, per_file | OPT_EXIT | OPT_EXPERT, 0);
1207  if (show_advanced)
1208  show_help_options(options, "Advanced global options:", OPT_EXPERT,
1209  per_file | OPT_EXIT, 0);
1210 
1211  show_help_options(options, "Per-file main options:", 0,
1213  OPT_EXIT, per_file);
1214  if (show_advanced)
1215  show_help_options(options, "Advanced per-file options:",
1216  OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file);
1217 
1218  show_help_options(options, "Video options:",
1220  if (show_advanced)
1221  show_help_options(options, "Advanced Video options:",
1223 
1224  show_help_options(options, "Audio options:",
1226  if (show_advanced)
1227  show_help_options(options, "Advanced Audio options:",
1229  show_help_options(options, "Subtitle options:",
1230  OPT_SUBTITLE, 0, 0);
1231  printf("\n");
1232 
1233  if (show_avoptions) {
1237 #if CONFIG_SWSCALE
1239 #endif
1240 #if CONFIG_SWRESAMPLE
1242 #endif
1245  }
1246 }
1247 
1248 void show_usage(void)
1249 {
1250  av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n");
1251  av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
1252  av_log(NULL, AV_LOG_INFO, "\n");
1253 }
1254 
1255 enum OptGroup {
1256  GROUP_OUTFILE,
1257  GROUP_INFILE,
1258 };
1259 
1260 static const OptionGroupDef groups[] = {
1261  [GROUP_OUTFILE] = { "output url", NULL, OPT_OUTPUT },
1262  [GROUP_INFILE] = { "input url", "i", OPT_INPUT },
1263 };
1264 
1265 static int open_files(OptionGroupList *l, const char *inout,
1266  int (*open_file)(const OptionsContext*, const char*))
1267 {
1268  int i, ret;
1269 
1270  for (i = 0; i < l->nb_groups; i++) {
1271  OptionGroup *g = &l->groups[i];
1272  OptionsContext o;
1273 
1274  init_options(&o);
1275  o.g = g;
1276 
1277  ret = parse_optgroup(&o, g);
1278  if (ret < 0) {
1279  av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
1280  "%s.\n", inout, g->arg);
1281  uninit_options(&o);
1282  return ret;
1283  }
1284 
1285  av_log(NULL, AV_LOG_DEBUG, "Opening an %s file: %s.\n", inout, g->arg);
1286  ret = open_file(&o, g->arg);
1287  uninit_options(&o);
1288  if (ret < 0) {
1289  av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n",
1290  inout, g->arg);
1291  return ret;
1292  }
1293  av_log(NULL, AV_LOG_DEBUG, "Successfully opened the file.\n");
1294  }
1295 
1296  return 0;
1297 }
1298 
1299 int ffmpeg_parse_options(int argc, char **argv)
1300 {
1301  OptionParseContext octx;
1302  const char *errmsg = NULL;
1303  int ret;
1304 
1305  memset(&octx, 0, sizeof(octx));
1306 
1307  /* split the commandline into an internal representation */
1308  ret = split_commandline(&octx, argc, argv, options, groups,
1309  FF_ARRAY_ELEMS(groups));
1310  if (ret < 0) {
1311  errmsg = "splitting the argument list";
1312  goto fail;
1313  }
1314 
1315  /* apply global options */
1316  ret = parse_optgroup(NULL, &octx.global_opts);
1317  if (ret < 0) {
1318  errmsg = "parsing global options";
1319  goto fail;
1320  }
1321 
1322  /* configure terminal and setup signal handlers */
1323  term_init();
1324 
1325  /* open input files */
1326  ret = open_files(&octx.groups[GROUP_INFILE], "input", ifile_open);
1327  if (ret < 0) {
1328  errmsg = "opening input files";
1329  goto fail;
1330  }
1331 
1332  /* create the complex filtergraphs */
1334  if (ret < 0) {
1335  errmsg = "initializing complex filters";
1336  goto fail;
1337  }
1338 
1339  /* open output files */
1340  ret = open_files(&octx.groups[GROUP_OUTFILE], "output", of_open);
1341  if (ret < 0) {
1342  errmsg = "opening output files";
1343  goto fail;
1344  }
1345 
1347 
1348  ret = apply_sync_offsets();
1349  if (ret < 0)
1350  goto fail;
1351 
1353  if (ret < 0)
1354  goto fail;
1355 
1356 fail:
1357  uninit_parse_context(&octx);
1358  if (ret < 0 && ret != AVERROR_EXIT) {
1359  av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
1360  errmsg ? errmsg : "", av_err2str(ret));
1361  }
1362  return ret;
1363 }
1364 
1365 static int opt_progress(void *optctx, const char *opt, const char *arg)
1366 {
1367  AVIOContext *avio = NULL;
1368  int ret;
1369 
1370  if (!strcmp(arg, "-"))
1371  arg = "pipe:";
1372  ret = avio_open2(&avio, arg, AVIO_FLAG_WRITE, &int_cb, NULL);
1373  if (ret < 0) {
1374  av_log(NULL, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n",
1375  arg, av_err2str(ret));
1376  return ret;
1377  }
1378  progress_avio = avio;
1379  return 0;
1380 }
1381 
1382 int opt_timelimit(void *optctx, const char *opt, const char *arg)
1383 {
1384 #if HAVE_SETRLIMIT
1385  int ret;
1386  double lim;
1387  struct rlimit rl;
1388 
1389  ret = parse_number(opt, arg, OPT_INT64, 0, INT_MAX, &lim);
1390  if (ret < 0)
1391  return ret;
1392 
1393  rl = (struct rlimit){ lim, lim + 1 };
1394  if (setrlimit(RLIMIT_CPU, &rl))
1395  perror("setrlimit");
1396 #else
1397  av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
1398 #endif
1399  return 0;
1400 }
1401 
1402 #if FFMPEG_OPT_QPHIST
1403 static int opt_qphist(void *optctx, const char *opt, const char *arg)
1404 {
1405  av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
1406  return 0;
1407 }
1408 #endif
1409 
1410 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1411 static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
1412 {
1413  av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
1414  return 0;
1415 }
1416 #endif
1417 
1418 #define OFFSET(x) offsetof(OptionsContext, x)
1419 const OptionDef options[] = {
1420  /* main options */
1422  { "f", HAS_ARG | OPT_STRING | OPT_OFFSET |
1423  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(format) },
1424  "force format", "fmt" },
1425  { "y", OPT_BOOL, { &file_overwrite },
1426  "overwrite output files" },
1427  { "n", OPT_BOOL, { &no_file_overwrite },
1428  "never overwrite output files" },
1429  { "ignore_unknown", OPT_BOOL, { &ignore_unknown_streams },
1430  "Ignore unknown stream types" },
1431  { "copy_unknown", OPT_BOOL | OPT_EXPERT, { &copy_unknown_streams },
1432  "Copy unknown stream types" },
1433  { "recast_media", OPT_BOOL | OPT_EXPERT, { &recast_media },
1434  "allow recasting stream type in order to force a decoder of different media type" },
1435  { "c", HAS_ARG | OPT_STRING | OPT_SPEC |
1436  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
1437  "codec name", "codec" },
1438  { "codec", HAS_ARG | OPT_STRING | OPT_SPEC |
1439  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) },
1440  "codec name", "codec" },
1441  { "pre", HAS_ARG | OPT_STRING | OPT_SPEC |
1442  OPT_OUTPUT, { .off = OFFSET(presets) },
1443  "preset name", "preset" },
1444  { "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
1445  OPT_OUTPUT, { .func_arg = opt_map },
1446  "set input stream mapping",
1447  "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1448 #if FFMPEG_OPT_MAP_CHANNEL
1449  { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel },
1450  "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
1451 #endif
1452  { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC |
1453  OPT_OUTPUT, { .off = OFFSET(metadata_map) },
1454  "set metadata information of outfile from infile",
1455  "outfile[,metadata]:infile[,metadata]" },
1456  { "map_chapters", HAS_ARG | OPT_INT | OPT_EXPERT | OPT_OFFSET |
1457  OPT_OUTPUT, { .off = OFFSET(chapters_input_file) },
1458  "set chapters mapping", "input_file_index" },
1459  { "t", HAS_ARG | OPT_TIME | OPT_OFFSET |
1460  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(recording_time) },
1461  "record or transcode \"duration\" seconds of audio/video",
1462  "duration" },
1463  { "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(stop_time) },
1464  "record or transcode stop time", "time_stop" },
1465  { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) },
1466  "set the limit file size in bytes", "limit_size" },
1467  { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET |
1468  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
1469  "set the start time offset", "time_off" },
1470  { "sseof", HAS_ARG | OPT_TIME | OPT_OFFSET |
1471  OPT_INPUT, { .off = OFFSET(start_time_eof) },
1472  "set the start time offset relative to EOF", "time_off" },
1473  { "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET |
1474  OPT_INPUT, { .off = OFFSET(seek_timestamp) },
1475  "enable/disable seeking by timestamp with -ss" },
1476  { "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
1477  OPT_INPUT, { .off = OFFSET(accurate_seek) },
1478  "enable/disable accurate seeking with -ss" },
1479  { "isync", HAS_ARG | OPT_INT | OPT_OFFSET |
1480  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) },
1481  "Indicate the input index for sync reference", "sync ref" },
1482  { "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET |
1483  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) },
1484  "set the input ts offset", "time_off" },
1485  { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
1486  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
1487  "set the input ts scale", "scale" },
1488  { "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
1489  "set the recording timestamp ('now' to set the current time)", "time" },
1490  { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
1491  "add metadata", "string=string" },
1492  { "program", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) },
1493  "add program with specified streams", "title=string:st=number..." },
1494  { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
1495  OPT_OUTPUT, { .func_arg = opt_data_frames },
1496  "set the number of data frames to output", "number" },
1497  { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark },
1498  "add timings for benchmarking" },
1499  { "benchmark_all", OPT_BOOL | OPT_EXPERT, { &do_benchmark_all },
1500  "add timings for each task" },
1501  { "progress", HAS_ARG | OPT_EXPERT, { .func_arg = opt_progress },
1502  "write program-readable progress information", "url" },
1503  { "stdin", OPT_BOOL | OPT_EXPERT, { &stdin_interaction },
1504  "enable or disable interaction on standard input" },
1505  { "timelimit", HAS_ARG | OPT_EXPERT, { .func_arg = opt_timelimit },
1506  "set max runtime in seconds in CPU user time", "limit" },
1507  { "dump", OPT_BOOL | OPT_EXPERT, { &do_pkt_dump },
1508  "dump each input packet" },
1509  { "hex", OPT_BOOL | OPT_EXPERT, { &do_hex_dump },
1510  "when dumping packets, also dump the payload" },
1511  { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
1512  OPT_INPUT, { .off = OFFSET(rate_emu) },
1513  "read input at native frame rate; equivalent to -readrate 1", "" },
1514  { "readrate", HAS_ARG | OPT_FLOAT | OPT_OFFSET |
1515  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) },
1516  "read input at specified rate", "speed" },
1517  { "readrate_initial_burst", HAS_ARG | OPT_DOUBLE | OPT_OFFSET |
1518  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate_initial_burst) },
1519  "The initial amount of input to burst read before imposing any readrate", "seconds" },
1520  { "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target },
1521  "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1522  "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
1523  { "vsync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vsync },
1524  "set video sync method globally; deprecated, use -fps_mode", "" },
1525  { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
1526  "frame drop threshold", "" },
1527 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1528  { "adrift_threshold", HAS_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold },
1529  "deprecated, does nothing", "threshold" },
1530 #endif
1531  { "copyts", OPT_BOOL | OPT_EXPERT, { &copy_ts },
1532  "copy timestamps" },
1533  { "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero },
1534  "shift input timestamps to start at 0 when using copyts" },
1535  { "copytb", HAS_ARG | OPT_INT | OPT_EXPERT, { &copy_tb },
1536  "copy input stream time base when stream copying", "mode" },
1537  { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
1538  OPT_OUTPUT, { .off = OFFSET(shortest) },
1539  "finish encoding within shortest input" },
1540  { "shortest_buf_duration", HAS_ARG | OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest_buf_duration) },
1541  "maximum buffering duration (in seconds) for the -shortest option" },
1542  { "bitexact", OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
1543  OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(bitexact) },
1544  "bitexact mode" },
1545  { "apad", OPT_STRING | HAS_ARG | OPT_SPEC |
1546  OPT_OUTPUT, { .off = OFFSET(apad) },
1547  "audio pad", "" },
1548  { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold },
1549  "timestamp discontinuity delta threshold", "threshold" },
1550  { "dts_error_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold },
1551  "timestamp error delta threshold", "threshold" },
1552  { "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error },
1553  "exit on error", "error" },
1554  { "abort_on", HAS_ARG | OPT_EXPERT, { .func_arg = opt_abort_on },
1555  "abort on the specified condition flags", "flags" },
1556  { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC |
1557  OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) },
1558  "copy initial non-keyframes" },
1559  { "copypriorss", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) },
1560  "copy or discard frames before start time" },
1561  { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) },
1562  "set the number of frames to output", "number" },
1563  { "tag", OPT_STRING | HAS_ARG | OPT_SPEC |
1564  OPT_EXPERT | OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(codec_tags) },
1565  "force codec tag/fourcc", "fourcc/tag" },
1566  { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
1567  OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
1568  "use fixed quality scale (VBR)", "q" },
1569  { "qscale", HAS_ARG | OPT_EXPERT | OPT_PERFILE |
1570  OPT_OUTPUT, { .func_arg = opt_qscale },
1571  "use fixed quality scale (VBR)", "q" },
1572  { "profile", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_profile },
1573  "set profile", "profile" },
1574  { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
1575  "set stream filtergraph", "filter_graph" },
1576  { "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads },
1577  "number of non-complex filter threads" },
1578  { "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
1579  "read stream filtergraph description from a file", "filename" },
1580  { "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) },
1581  "reinit filtergraph on input parameter changes", "" },
1582  { "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
1583  "create a complex filtergraph", "graph_description" },
1584  { "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads },
1585  "number of threads for -filter_complex" },
1586  { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
1587  "create a complex filtergraph", "graph_description" },
1588  { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script },
1589  "read complex filtergraph description from a file", "filename" },
1590  { "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters },
1591  "enable automatic conversion filters globally" },
1592  { "stats", OPT_BOOL, { &print_stats },
1593  "print progress report during encoding", },
1594  { "stats_period", HAS_ARG | OPT_EXPERT, { .func_arg = opt_stats_period },
1595  "set the period at which ffmpeg updates stats and -progress output", "time" },
1596  { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
1597  OPT_OUTPUT, { .func_arg = opt_attach },
1598  "add an attachment to the output file", "filename" },
1599  { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |
1600  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) },
1601  "extract an attachment into a file", "filename" },
1602  { "stream_loop", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_INPUT |
1603  OPT_OFFSET, { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" },
1604  { "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts },
1605  "print timestamp debugging info" },
1606  { "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate },
1607  "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" },
1608  { "discard", OPT_STRING | HAS_ARG | OPT_SPEC |
1609  OPT_INPUT, { .off = OFFSET(discard) },
1610  "discard", "" },
1611  { "disposition", OPT_STRING | HAS_ARG | OPT_SPEC |
1612  OPT_OUTPUT, { .off = OFFSET(disposition) },
1613  "disposition", "" },
1614  { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
1615  { .off = OFFSET(thread_queue_size) },
1616  "set the maximum number of queued packets from the demuxer" },
1617  { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(find_stream_info) },
1618  "read and decode the streams to fill missing information with heuristics" },
1619  { "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT,
1620  { .off = OFFSET(bits_per_raw_sample) },
1621  "set the number of bits per raw sample", "number" },
1622 
1623  { "stats_enc_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre) },
1624  "write encoding stats before encoding" },
1625  { "stats_enc_post", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post) },
1626  "write encoding stats after encoding" },
1627  { "stats_mux_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats) },
1628  "write packets stats before muxing" },
1629  { "stats_enc_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt) },
1630  "format of the stats written with -stats_enc_pre" },
1631  { "stats_enc_post_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post_fmt) },
1632  "format of the stats written with -stats_enc_post" },
1633  { "stats_mux_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats_fmt) },
1634  "format of the stats written with -stats_mux_pre" },
1635 
1636  /* video options */
1637  { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
1638  "set the number of video frames to output", "number" },
1639  { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
1640  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) },
1641  "set frame rate (Hz value, fraction or abbreviation)", "rate" },
1642  { "fpsmax", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
1643  OPT_OUTPUT, { .off = OFFSET(max_frame_rates) },
1644  "set max frame rate (Hz value, fraction or abbreviation)", "rate" },
1646  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) },
1647  "set frame size (WxH or abbreviation)", "size" },
1648  { "aspect", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC |
1649  OPT_OUTPUT, { .off = OFFSET(frame_aspect_ratios) },
1650  "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
1651  { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
1652  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) },
1653  "set pixel format", "format" },
1654  { "display_rotation", OPT_VIDEO | HAS_ARG | OPT_DOUBLE | OPT_SPEC |
1655  OPT_INPUT, { .off = OFFSET(display_rotations) },
1656  "set pure counter-clockwise rotation in degrees for stream(s)",
1657  "angle" },
1658  { "display_hflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_hflips) },
1659  "set display horizontal flip for stream(s) "
1660  "(overrides any display rotation if it is not set)"},
1661  { "display_vflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_vflips) },
1662  "set display vertical flip for stream(s) "
1663  "(overrides any display rotation if it is not set)"},
1665  "disable video" },
1666  { "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
1667  OPT_OUTPUT, { .off = OFFSET(rc_overrides) },
1668  "rate control override for specific intervals", "override" },
1669  { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT |
1670  OPT_OUTPUT, { .func_arg = opt_video_codec },
1671  "force video codec ('copy' to copy stream)", "codec" },
1672  { "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode },
1673  "set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
1674  { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) },
1675  "select the pass number (1 to 3)", "n" },
1676  { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC |
1677  OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
1678  "select two pass log file name prefix", "prefix" },
1679 #if FFMPEG_OPT_PSNR
1680  { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
1681  "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
1682 #endif
1683  { "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats },
1684  "dump video coding statistics to file" },
1685  { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },
1686  "dump video coding statistics to file", "file" },
1687  { "vstats_version", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &vstats_version },
1688  "Version of the vstats format to use."},
1689  { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters },
1690  "set video filters", "filter_graph" },
1691  { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
1692  OPT_OUTPUT, { .off = OFFSET(intra_matrices) },
1693  "specify intra matrix coeffs", "matrix" },
1694  { "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
1695  OPT_OUTPUT, { .off = OFFSET(inter_matrices) },
1696  "specify inter matrix coeffs", "matrix" },
1697  { "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
1698  OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
1699  "specify intra matrix coeffs", "matrix" },
1700 #if FFMPEG_OPT_TOP
1701  { "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC |
1702  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
1703  "deprecated, use the setfield video filter", "" },
1704 #endif
1705  { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
1706  OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new },
1707  "force video tag/fourcc", "fourcc/tag" },
1708 #if FFMPEG_OPT_QPHIST
1709  { "qphist", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_qphist },
1710  "deprecated, does nothing" },
1711 #endif
1712  { "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT |
1713  OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
1714  "set framerate mode for matching video streams; overrides vsync" },
1715  { "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC |
1716  OPT_OUTPUT, { .off = OFFSET(force_fps) },
1717  "force the selected framerate, disable the best supported framerate selection" },
1718  { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
1719  OPT_OUTPUT, { .func_arg = opt_streamid },
1720  "set the value of an outfile streamid", "streamIndex:value" },
1721  { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
1722  OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(forced_key_frames) },
1723  "force key frames at specified timestamps", "timestamps" },
1724  { "b", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate },
1725  "video bitrate (please use -b:v)", "bitrate" },
1726  { "hwaccel", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
1727  OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccels) },
1728  "use HW accelerated decoding", "hwaccel name" },
1729  { "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
1730  OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) },
1731  "select a device for HW acceleration", "devicename" },
1732  { "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT |
1733  OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) },
1734  "select output format used with HW accelerated decoding", "format" },
1735  { "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels },
1736  "show available HW acceleration methods" },
1737  { "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC |
1738  OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
1739  "automatically insert correct rotate filters" },
1740  { "autoscale", HAS_ARG | OPT_BOOL | OPT_SPEC |
1741  OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(autoscale) },
1742  "automatically insert a scale filter at the end of the filter graph" },
1743  { "fix_sub_duration_heartbeat", OPT_VIDEO | OPT_BOOL | OPT_EXPERT |
1745  "set this video output stream to be a heartbeat stream for "
1746  "fix_sub_duration, according to which subtitles should be split at "
1747  "random access points" },
1748 
1749  /* audio options */
1750  { "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_frames },
1751  "set the number of audio frames to output", "number" },
1752  { "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_qscale },
1753  "set audio quality (codec-specific)", "quality", },
1754  { "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
1755  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_sample_rate) },
1756  "set audio sampling rate (in Hz)", "rate" },
1757  { "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
1758  OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) },
1759  "set number of audio channels", "channels" },
1761  "disable audio" },
1762  { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE |
1763  OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_audio_codec },
1764  "force audio codec ('copy' to copy stream)", "codec" },
1765  { "ab", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate },
1766  "audio bitrate (please use -b:a)", "bitrate" },
1767  { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
1768  OPT_OUTPUT, { .func_arg = opt_old2new },
1769  "force audio tag/fourcc", "fourcc/tag" },
1770  { "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
1772  "set sample format", "format" },
1773  { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
1774  OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
1775  "set channel layout", "layout" },
1776  { "ch_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
1777  OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
1778  "set channel layout", "layout" },
1779  { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
1780  "set audio filters", "filter_graph" },
1781  { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
1782  "set the maximum number of channels to try to guess the channel layout" },
1783 
1784  /* subtitle options */
1786  "disable subtitle" },
1787  { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_subtitle_codec },
1788  "force subtitle codec ('copy' to copy stream)", "codec" },
1789  { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }
1790  , "force subtitle tag/fourcc", "fourcc/tag" },
1791  { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT, { .off = OFFSET(fix_sub_duration) },
1792  "fix subtitles duration" },
1793  { "canvas_size", OPT_SUBTITLE | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) },
1794  "set canvas size (WxH or abbreviation)", "size" },
1795 
1796  /* muxer options */
1797  { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) },
1798  "set the maximum demux-decode delay", "seconds" },
1799  { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) },
1800  "set the initial demux-decode delay", "seconds" },
1801  { "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file },
1802  "specify a file in which to print sdp information", "file" },
1803 
1804  { "time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) },
1805  "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" },
1806  { "enc_time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) },
1807  "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
1808  "two special values are defined - "
1809  "0 = use frame rate (video) or sample rate (audio),"
1810  "-1 = match source time base", "ratio" },
1811 
1812  { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
1813  "A comma-separated list of bitstream filters", "bitstream_filters" },
1814  { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },
1815  "deprecated", "audio bitstream_filters" },
1816  { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },
1817  "deprecated", "video bitstream_filters" },
1818 
1819  { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
1820  "set the audio options to the indicated preset", "preset" },
1821  { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
1822  "set the video options to the indicated preset", "preset" },
1823  { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
1824  "set the subtitle options to the indicated preset", "preset" },
1825  { "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset },
1826  "set options from indicated preset file", "filename" },
1827 
1828  { "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
1829  "maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
1830  { "muxing_queue_data_threshold", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(muxing_queue_data_threshold) },
1831  "set the threshold after which max_muxing_queue_size is taken into account", "bytes" },
1832 
1833  /* data codec support */
1834  { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
1835  "force data codec ('copy' to copy stream)", "codec" },
1836  { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) },
1837  "disable data" },
1838 
1839 #if CONFIG_VAAPI
1840  { "vaapi_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vaapi_device },
1841  "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)", "device" },
1842 #endif
1843 
1844 #if CONFIG_QSV
1845  { "qsv_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_qsv_device },
1846  "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"},
1847 #endif
1848 
1849  { "init_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_init_hw_device },
1850  "initialise hardware device", "args" },
1851  { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device },
1852  "set hardware device used when filtering", "device" },
1853 
1854  { NULL, },
1855 };
OPT_FLOAT
#define OPT_FLOAT
Definition: cmdutils.h:116
OPT_EXIT
#define OPT_EXIT
Definition: cmdutils.h:119
AVCodec
AVCodec.
Definition: codec.h:187
of_open
int of_open(const OptionsContext *o, const char *filename)
Definition: ffmpeg_mux_init.c:2624
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
InputFile::start_time
int64_t start_time
Definition: ffmpeg.h:417
ignore_unknown_streams
int ignore_unknown_streams
Definition: ffmpeg_opt.c:99
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:173
StreamMap::file_index
int file_index
Definition: ffmpeg.h:92
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
opt_abort_on
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:310
VSYNC_VFR
@ VSYNC_VFR
Definition: ffmpeg.h:67
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:124
opt.h
AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:284
assert_file_overwrite
int assert_file_overwrite(const char *filename)
Definition: ffmpeg_opt.c:704
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AudioChannelMap::ofile_idx
int ofile_idx
Definition: ffmpeg.h:100
OptionDef::off
size_t off
Definition: cmdutils.h:131
opt_video_filters
static int opt_video_filters(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1120
show_help_default
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffmpeg_opt.c:1176
debug_ts
int debug_ts
Definition: ffmpeg_opt.c:81
stats_period
int64_t stats_period
Definition: ffmpeg_opt.c:91
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
is
The official guide to swscale for confused that is
Definition: swscale.txt:28
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:250
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:947
opt_old2new
static int opt_old2new(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1063
AVStream::discard
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition: avformat.h:912
MATCH_PER_TYPE_OPT
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)
Definition: ffmpeg.h:928
sdp_filename
char * sdp_filename
Definition: ffmpeg_opt.c:66
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:264
InputStream::user_set_discard
int user_set_discard
Definition: ffmpeg.h:332
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:205
program_name
const char program_name[]
program name, defined by the program for show_version().
Definition: ffmpeg.c:104
no_file_overwrite
static int no_file_overwrite
Definition: ffmpeg_opt.c:95
opt_default_new
static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:991
OptionsContext::nb_attachments
int nb_attachments
Definition: ffmpeg.h:168
avcodec_find_encoder
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:970
opt_name_top_field_first
const char *const opt_name_top_field_first[]
Definition: ffmpeg_opt.c:60
auto_conversion_filters
int auto_conversion_filters
Definition: ffmpeg_opt.c:90
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:347
ffmpeg_parse_options
int ffmpeg_parse_options(int argc, char **argv)
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
pixdesc.h
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1183
OptionsContext::mux_max_delay
float mux_max_delay
Definition: ffmpeg.h:176
OPT_INPUT
#define OPT_INPUT
Definition: cmdutils.h:126
copy_unknown_streams
int copy_unknown_streams
Definition: ffmpeg_opt.c:100
sync_queue.h
AV_HWDEVICE_TYPE_NONE
@ AV_HWDEVICE_TYPE_NONE
Definition: hwcontext.h:28
AVOption
AVOption.
Definition: opt.h:251
HAS_ARG
#define HAS_ARG
Definition: cmdutils.h:109
OptionGroupList::groups
OptionGroup * groups
Definition: cmdutils.h:230
AudioChannelMap::stream_idx
int stream_idx
Definition: ffmpeg.h:99
OptionGroupList::nb_groups
int nb_groups
Definition: cmdutils.h:231
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:60
filter_hw_device
HWDevice * filter_hw_device
Definition: ffmpeg_opt.c:63
ffmpeg.h
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
progress_avio
AVIOContext * progress_avio
Definition: ffmpeg.c:121
opt_filter_hw_device
static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:634
fg_create
int fg_create(FilterGraph **pfg, char *graph_desc)
Create a new filtergraph in the global filtergraph list.
Definition: ffmpeg_filter.c:866
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:138
av_hwdevice_iterate_types
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
Definition: hwcontext.c:102
autorotate
static int autorotate
Definition: ffplay.c:350
UNKNOWN
@ UNKNOWN
Definition: ftp.c:38
video_disable
static int video_disable
Definition: ffplay.c:317
mathematics.h
AVDictionary
Definition: dict.c:34
HWDevice
Definition: ffmpeg.h:83
hw_device_init_from_string
int hw_device_init_from_string(const char *arg, HWDevice **dev)
Definition: ffmpeg_hw.c:94
do_benchmark
int do_benchmark
Definition: ffmpeg_opt.c:74
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:317
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:297
OptionDef
Definition: cmdutils.h:106
subtitle_disable
static int subtitle_disable
Definition: ffplay.c:318
OPT_DATA
#define OPT_DATA
Definition: cmdutils.h:120
OptionsContext::chapters_input_file
int chapters_input_file
Definition: ffmpeg.h:170
fifo.h
opt_filter_threads
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:303
avio_open2
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Definition: aviobuf.c:1265
do_hex_dump
int do_hex_dump
Definition: ffmpeg_opt.c:76
OptionGroupList
A list of option groups that all have the same group type (e.g.
Definition: cmdutils.h:227
bsf.h
do_pkt_dump
int do_pkt_dump
Definition: ffmpeg_opt.c:77
uninit_options
static void uninit_options(OptionsContext *o)
Definition: ffmpeg_opt.c:103
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:1138
OptionsContext::g
OptionGroup * g
Definition: ffmpeg.h:111
fail
#define fail()
Definition: checkasm.h:138
StreamMap::disabled
int disabled
Definition: ffmpeg.h:91
AudioChannelMap::ostream_idx
int ostream_idx
Definition: ffmpeg.h:100
opt_data_frames
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:985
OptionParseContext
Definition: cmdutils.h:234
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
AudioChannelMap::file_idx
int file_idx
Definition: ffmpeg.h:99
sws_get_class
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
Definition: options.c:97
OptionsContext
Definition: ffmpeg.h:110
OPT_STRING
#define OPT_STRING
Definition: cmdutils.h:112
loop
static int loop
Definition: ffplay.c:337
AVRational::num
int num
Numerator.
Definition: rational.h:59
opt_audio_filters
static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1126
OptionsContext::nb_audio_channel_maps
int nb_audio_channel_maps
Definition: ffmpeg.h:165
InputFile
Definition: ffmpeg.h:399
opt_filter_complex_script
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1167
OptionGroupDef
Definition: cmdutils.h:195
OptionsContext::recording_time
int64_t recording_time
Definition: ffmpeg.h:172
OptionsContext::nb_stream_maps
int nb_stream_maps
Definition: ffmpeg.h:162
check_stream_specifier
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
Definition: cmdutils.c:917
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AudioChannelMap
Definition: ffmpeg.h:98
init_complex_filters
static int init_complex_filters(void)
Definition: ffmpeg_opt.c:795
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:445
OptionGroup::codec_opts
AVDictionary * codec_opts
Definition: cmdutils.h:217
opt_attach
static int opt_attach(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:476
opt_recording_timestamp
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:648
StreamMap::linklabel
char * linklabel
Definition: ffmpeg.h:94
OPT_INT
#define OPT_INT
Definition: cmdutils.h:115
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
intreadwrite.h
opt_name_frame_rates
const char *const opt_name_frame_rates[]
Definition: ffmpeg_opt.c:57
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:707
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:281
avio_read_to_bprint
int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
Definition: aviobuf.c:1371
format
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AVFormatContext::iformat
const struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1127
g
const char * g
Definition: vf_curves.c:127
AVDictionaryEntry::key
char * key
Definition: dict.h:90
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
OptionsContext::limit_filesize
int64_t limit_filesize
Definition: ffmpeg.h:174
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_audio_qscale
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1152
filters
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
Definition: af_crystalizer.c:54
AVHWDeviceType
AVHWDeviceType
Definition: hwcontext.h:27
term_init
void term_init(void)
Definition: ffmpeg.c:241
AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE
write-only
Definition: avio.h:637
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
exit_on_error
int exit_on_error
Definition: ffmpeg_opt.c:82
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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:171
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:93
opt_name_codec_names
const char *const opt_name_codec_names[]
Definition: ffmpeg_opt.c:56
do_benchmark_all
int do_benchmark_all
Definition: ffmpeg_opt.c:75
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:295
OptionsContext::accurate_seek
int accurate_seek
Definition: ffmpeg.h:142
key
const char * key
Definition: hwcontext_opencl.c:174
opt_video_frames
static int opt_video_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:973
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:283
arg
const char * arg
Definition: jacosubdec.c:67
if
if(ret)
Definition: filter_design.txt:179
OPT_SPEC
#define OPT_SPEC
Definition: cmdutils.h:123
OptionsContext::start_time
int64_t start_time
Definition: ffmpeg.h:114
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
AVFormatContext
Format I/O context.
Definition: avformat.h:1115
do_psnr
int do_psnr
Definition: ffmpeg_opt.c:97
OptionGroup::format_opts
AVDictionary * format_opts
Definition: cmdutils.h:218
opts
AVDictionary * opts
Definition: movenc.c:50
opt_target
static int opt_target(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:807
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:864
open_file
static int open_file(AVFormatContext *avf, unsigned fileno)
Definition: concatdec.c:334
opt_profile
static int opt_profile(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1108
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
strip_specifiers
AVDictionary * strip_specifiers(const AVDictionary *dict)
Definition: ffmpeg_opt.c:169
avcodec_get_class
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition: options.c:187
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:880
NULL
#define NULL
Definition: coverity.c:32
OptionParseContext::global_opts
OptionGroup global_opts
Definition: cmdutils.h:235
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:1003
av_bsf_get_class
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
Definition: bsf.c:99
OPT_EXPERT
#define OPT_EXPERT
Definition: cmdutils.h:111
swr_get_class
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
Definition: options.c:164
InputFile::start_time_effective
int64_t start_time_effective
Effective format start time based on enabled streams.
Definition: ffmpeg.h:415
AVCodec::type
enum AVMediaType type
Definition: codec.h:200
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
parseutils.h
OPT_INT64
#define OPT_INT64
Definition: cmdutils.h:118
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:186
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:589
AV_DICT_DONT_OVERWRITE
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
Definition: dict.h:81
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:206
OptionsContext::input_sync_ref
int input_sync_ref
Definition: ffmpeg.h:144
OptionGroup
Definition: cmdutils.h:210
correct_input_start_times
static void correct_input_start_times(void)
Definition: ffmpeg_opt.c:214
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:123
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:975
opt_streamid
static int opt_streamid(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:776
opt_preset
static int opt_preset(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1011
opt_vstats_file
static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:950
codec_opts
AVDictionary * codec_opts
Definition: cmdutils.c:60
options
const OptionDef options[]
VideoSyncMethod
VideoSyncMethod
Definition: ffmpeg.h:63
opt_bitrate
static int opt_bitrate(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1075
max_error_rate
float max_error_rate
Definition: ffmpeg_opt.c:86
frame_sizes
static const uint8_t frame_sizes[]
Definition: rtpdec_qcelp.c:24
f
f
Definition: af_crystalizer.c:121
AVIOContext
Bytestream IO Context.
Definition: avio.h:166
OptionsContext::thread_queue_size
int thread_queue_size
Definition: ffmpeg.h:143
AVMediaType
AVMediaType
Definition: avutil.h:199
opt_init_hw_device
static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:619
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
OPT_AUDIO
#define OPT_AUDIO
Definition: cmdutils.h:114
opt_map
static int opt_map(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:371
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:121
start_time
static int64_t start_time
Definition: ffplay.c:328
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1198
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:845
StreamMap
Definition: ffmpeg.h:90
check_filter_outputs
int check_filter_outputs(void)
Definition: ffmpeg_filter.c:1349
file_overwrite
static int file_overwrite
Definition: ffmpeg_opt.c:94
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
opt_subtitle_codec
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:359
OptionsContext::streamid
AVDictionary * streamid
Definition: ffmpeg.h:187
PAL
#define PAL
Definition: bktr.c:66
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:475
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:469
vstats_filename
char * vstats_filename
Definition: ffmpeg_opt.c:65
printf
printf("static const uint8_t my_array[100] = {\n")
show_usage
void show_usage(void)
Definition: ffmpeg_opt.c:1248
opt_sdp_file
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:580
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:164
fix_sub_duration_heartbeat
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
Definition: ffmpeg_dec.c:454
OptionsContext::find_stream_info
int find_stream_info
Definition: ffmpeg.h:145
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:365
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:225
NTSC
#define NTSC
Definition: bktr.c:68
video_sync_method
enum VideoSyncMethod video_sync_method
Definition: ffmpeg_opt.c:72
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
start_at_zero
int start_at_zero
Definition: ffmpeg_opt.c:79
avio_closep
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
Definition: aviobuf.c:1304
bprint.h
init_complex_filtergraph
int init_complex_filtergraph(FilterGraph *fg)
Definition: ffmpeg_filter.c:1063
apply_sync_offsets
static int apply_sync_offsets(void)
Definition: ffmpeg_opt.c:251
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
StreamMap::stream_index
int stream_index
Definition: ffmpeg.h:93
OPT_TIME
#define OPT_TIME
Definition: cmdutils.h:124
OptionsContext::stream_maps
StreamMap * stream_maps
Definition: ffmpeg.h:161
OptionsContext::start_time_eof
int64_t start_time_eof
Definition: ffmpeg.h:115
VSYNC_CFR
@ VSYNC_CFR
Definition: ffmpeg.h:66
OptionsContext::shortest_buf_duration
float shortest_buf_duration
Definition: ffmpeg.h:177
opt_video_codec
static int opt_video_codec(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:353
opt_qscale
static int opt_qscale(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1091
display.h
stdin_interaction
int stdin_interaction
Definition: ffmpeg_opt.c:85
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
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:282
InputFile::ctx
AVFormatContext * ctx
Definition: ffmpeg.h:407
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
opt_vstats
static int opt_vstats(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:957
file_read
char * file_read(const char *filename)
Definition: ffmpeg_opt.c:750
OPT_OUTPUT
#define OPT_OUTPUT
Definition: cmdutils.h:127
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
dts_error_threshold
float dts_error_threshold
Definition: ffmpeg_opt.c:70
filtergraphs
FilterGraph ** filtergraphs
Definition: ffmpeg.c:129
int_cb
const AVIOInterruptCB int_cb
Definition: ffmpeg.c:346
OPT_OFFSET
#define OPT_OFFSET
Definition: cmdutils.h:122
OptionParseContext::groups
OptionGroupList * groups
Definition: cmdutils.h:237
opt_audio_frames
static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:979
parse_optgroup
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
Definition: cmdutils.c:382
AudioChannelMap::channel_idx
int channel_idx
Definition: ffmpeg.h:99
OptionDef::u
union OptionDef::@1 u
avcodec.h
opt_map_channel
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:488
av_opt_eval_flags
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
SpecifierOpt
Definition: cmdutils.h:94
find_codec
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **pcodec)
Definition: ffmpeg_opt.c:671
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:841
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:174
pixfmt.h
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:834
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:71
VSYNC_DROP
@ VSYNC_DROP
Definition: ffmpeg.h:69
uninit_parse_context
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
Definition: cmdutils.c:682
OptionsContext::audio_channel_maps
AudioChannelMap * audio_channel_maps
Definition: ffmpeg.h:164
OPT_PERFILE
#define OPT_PERFILE
Definition: cmdutils.h:121
InputFile::streams
InputStream ** streams
Definition: ffmpeg.h:423
find_stream_info
static int find_stream_info
Definition: ffplay.c:351
avformat.h
CMDUTILS_COMMON_OPTIONS
#define CMDUTILS_COMMON_OPTIONS
Definition: opt_common.h:199
filter_nbthreads
char * filter_nbthreads
Definition: ffmpeg_opt.c:87
ifile_open
int ifile_open(const OptionsContext *o, const char *filename)
Definition: ffmpeg_demux.c:1350
parse_option
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
Definition: cmdutils.c:307
OptionsContext::mux_preload
float mux_preload
Definition: ffmpeg.h:175
channel_layout.h
audio_drift_threshold
float audio_drift_threshold
Definition: ffmpeg_opt.c:68
opt_common.h
AVInputFormat::flags
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_NOTIMESTAMPS,...
Definition: avformat.h:568
AVRational::den
int den
Denominator.
Definition: rational.h:60
OPT_SUBTITLE
#define OPT_SUBTITLE
Definition: cmdutils.h:117
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:112
avio_open
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Definition: aviobuf.c:1239
GROW_ARRAY
#define GROW_ARRAY(array, nb_elems)
Definition: cmdutils.h:401
InputFile::ts_offset
int64_t ts_offset
Definition: ffmpeg.h:416
VSYNC_AUTO
@ VSYNC_AUTO
Definition: ffmpeg.h:64
opt_vsync
static int opt_vsync(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1132
AVERROR_DECODER_NOT_FOUND
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
Definition: error.h:54
AVIO_FLAG_READ
#define AVIO_FLAG_READ
read-only
Definition: avio.h:636
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:516
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:270
desc
const char * desc
Definition: libsvtav1.c:83
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVERROR_ENCODER_NOT_FOUND
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
Definition: error.h:56
avutil.h
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:482
copy_tb
int copy_tb
Definition: ffmpeg_opt.c:80
opt_stats_period
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:329
vstats_version
int vstats_version
Definition: ffmpeg_opt.c:89
OptionDef::name
const char * name
Definition: cmdutils.h:107
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
OPT_VIDEO
#define OPT_VIDEO
Definition: cmdutils.h:113
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVDictionaryEntry
Definition: dict.h:89
OptionsContext::attachments
const char ** attachments
Definition: ffmpeg.h:167
audio_disable
static int audio_disable
Definition: ffplay.c:316
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
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:88
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:239
copy_ts
int copy_ts
Definition: ffmpeg_opt.c:78
cmdutils.h
OFFSET
#define OFFSET(x)
InputFile::input_ts_offset
int64_t input_ts_offset
Definition: ffmpeg.h:410
OPT_BOOL
#define OPT_BOOL
Definition: cmdutils.h:110
nb_filtergraphs
int nb_filtergraphs
Definition: ffmpeg.c:130
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:468
codec_string
Definition: dashenc.c:208
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:224
frame_drop_threshold
float frame_drop_threshold
Definition: ffmpeg_opt.c:73
recast_media
int recast_media
Definition: ffmpeg_opt.c:101
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
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:84
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_EXIT
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:58
AVDictionaryEntry::value
char * value
Definition: dict.h:91
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:890
avstring.h
show_help_options
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
Definition: cmdutils.c:109
avcodec_descriptor_get_by_name
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
Definition: codec_desc.c:3737
InputFile::nb_streams
int nb_streams
Definition: ffmpeg.h:424
hw_device_get_by_name
HWDevice * hw_device_get_by_name(const char *name)
Definition: ffmpeg_hw.c:44
avfilter_get_class
const AVClass * avfilter_get_class(void)
Definition: avfilter.c:1542
dump_attachment
static int dump_attachment(InputStream *ist, const char *filename)
Definition: ffmpeg_demux.c:1283
VSYNC_PASSTHROUGH
@ VSYNC_PASSTHROUGH
Definition: ffmpeg.h:65
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
snprintf
#define snprintf
Definition: snprintf.h:34
ABORT_ON_FLAG_EMPTY_OUTPUT
#define ABORT_ON_FLAG_EMPTY_OUTPUT
Definition: ffmpeg.h:444
opt_filter_complex
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
Definition: ffmpeg_opt.c:1158
av_dict_iterate
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition: dict.c:44
parse_number
int parse_number(const char *context, const char *numstr, int type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
Definition: cmdutils.c:86
opt_name_codec_tags
const char *const opt_name_codec_tags[]
Definition: ffmpeg_opt.c:58
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:998
dts_delta_threshold
float dts_delta_threshold
Definition: ffmpeg_opt.c:69
abort_on_flags
int abort_on_flags
Definition: ffmpeg_opt.c:83
filter_complex_nbthreads
int filter_complex_nbthreads
Definition: ffmpeg_opt.c:88
OptionDef::flags
int flags
Definition: cmdutils.h:108
OPT_DOUBLE
#define OPT_DOUBLE
Definition: cmdutils.h:125