45 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
47 #define SPECIFIER_OPT_FMT_str "%s"
48 #define SPECIFIER_OPT_FMT_i "%i"
49 #define SPECIFIER_OPT_FMT_i64 "%"PRId64
50 #define SPECIFIER_OPT_FMT_ui64 "%"PRIu64
51 #define SPECIFIER_OPT_FMT_f "%f"
52 #define SPECIFIER_OPT_FMT_dbl "%lf"
99 #define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
101 char namestr[128] = "";\
102 const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
103 for (i = 0; opt_name_##name[i]; i++)\
104 av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[i], opt_name_##name[i+1] ? (opt_name_##name[i+2] ? ", " : " or ") : "");\
105 av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
106 namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
109 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
111 int i, ret, matches = 0;\
113 for (i = 0; i < o->nb_ ## name; i++) {\
114 char *spec = o->name[i].specifier;\
115 if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
116 outvar = o->name[i].u.type;\
123 WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
126 #define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
129 for (i = 0; i < o->nb_ ## name; i++) {\
130 char *spec = o->name[i].specifier;\
131 if (!strcmp(spec, mediatype))\
132 outvar = o->name[i].u.type;\
137 #if CONFIG_VIDEOTOOLBOX
202 int i, *count = (
int*)(so + 1);
203 for (
i = 0;
i < *count;
i++) {
225 memset(o, 0,
sizeof(*o));
242 printf(
"Hardware acceleration methods:\n");
257 char *p = strchr(e->
key,
':');
282 const AVClass *pclass = &
class;
291 if (user_stats_period <= 0) {
305 "If you are looking for an option to preserve the quality (which is not "
306 "what -%s was for), use -qscale 0 or an equivalent quality factor option.\n",
347 static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
351 int i, negative = 0, file_idx, disabled = 0;
352 int sync_file_idx = -1, sync_stream_idx = 0;
366 if (sync = strchr(
map,
',')) {
368 sync_file_idx = strtol(sync + 1, &sync, 0);
383 "match any streams.\n",
arg);
396 const char *
c =
map + 1;
405 if (allow_unused = strchr(
map,
'?'))
407 file_idx = strtol(
map, &p, 0);
421 *p ==
':' ? p + 1 : p) > 0)
427 *p ==
':' ? p + 1 : p) <= 0)
439 if (sync_file_idx >= 0) {
452 }
else if (disabled) {
454 "To ignore this, add a trailing '?' to the map.\n",
arg);
458 "To ignore this, add a trailing '?' to the map.\n",
arg);
501 n = sscanf(
arg,
"%d.%d.%d:%d.%d",
505 if (n != 3 && n != 5) {
507 "[file.stream.channel|-1][:syncfile:syncstream]\n");
533 if (allow_unused = strchr(mapchan,
'?'))
542 "To ignore this, add a trailing '?' to the map_channel.\n",
560 static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
562 const char *prefix =
"vaapi:";
576 if (!strcmp(
arg,
"list")) {
578 printf(
"Supported hardware device types:\n");
618 if (*(++
arg) && *
arg !=
':') {
622 *stream_spec = *
arg ==
':' ?
arg + 1 :
"";
642 char type_in, type_out;
643 const char *istream_spec =
NULL, *ostream_spec =
NULL;
644 int idx_in = 0, idx_out = 0;
650 if (type_out ==
'g' || !*outspec)
652 if (type_out ==
's' || !*outspec)
654 if (type_out ==
'c' || !*outspec)
659 if (type_in ==
'g' || type_out ==
'g')
661 if (type_in ==
's' || type_out ==
's')
663 if (type_in ==
'c' || type_out ==
'c')
670 #define METADATA_CHECK_INDEX(index, nb_elems, desc)\
671 if ((index) < 0 || (index) >= (nb_elems)) {\
672 av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
677 #define SET_DICT(type, meta, context, index)\
680 meta = &context->metadata;\
683 METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
684 meta = &context->chapters[index]->metadata;\
687 METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
688 meta = &context->programs[index]->metadata;\
692 default: av_assert0(0);\
695 SET_DICT(type_in, meta_in, ic, idx_in);
696 SET_DICT(type_out, meta_out, oc, idx_out);
699 if (type_in ==
's') {
713 if (type_out ==
's') {
732 struct tm time = *gmtime((time_t*)&recording_timestamp);
733 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
738 "tag instead.\n", opt);
745 const char *
codec_string = encoder ?
"encoder" :
"decoder";
773 char *codec_name =
NULL;
795 const char *hwaccel =
NULL;
796 char *hwaccel_output_format =
NULL;
797 char *codec_tag =
NULL;
799 char *discard_str =
NULL;
825 uint32_t
tag = strtol(codec_tag, &next, 0);
828 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
893 hwaccel_output_format, ic, st);
895 if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel,
"cuvid")) {
897 "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
898 "with old commandlines. This behaviour is DEPRECATED and will be removed "
899 "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
901 }
else if (hwaccel_output_format) {
905 "format: %s", hwaccel_output_format);
913 if (!strcmp(hwaccel,
"nvdec") || !strcmp(hwaccel,
"cuvid"))
916 if (!strcmp(hwaccel,
"none"))
918 else if (!strcmp(hwaccel,
"auto"))
954 if (hwaccel_device) {
970 char *canvas_size =
NULL;
1002 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
1007 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
1009 fprintf(stderr,
"File '%s' already exists. Overwrite? [y/N] ", filename);
1012 signal(SIGINT, SIG_DFL);
1026 if (proto_name && !strcmp(proto_name,
"file")) {
1031 if (!strcmp(filename, file->
ctx->
url)) {
1043 for (
const char *p =
f; p && *p; ) {
1046 if ((
s = strchr(stem,
'.')))
1048 if ((
s = strpbrk(stem,
"123456789")))
1070 const char *start =
f;
1077 if (!((
unsigned)((*
f | 32) -
'a') < 26 ||
1078 (
unsigned)(*
f -
'0') < 10 || *
f ==
'_' || *
f ==
'-')) {
1081 else if (allow_subdir && *
f ==
'/')
1102 filename = e->
value;
1139 char * data_codec_name =
NULL;
1140 int scan_all_pmts_set = 0;
1164 if (!strcmp(filename,
"-"))
1168 strcmp(filename,
"/dev/stdin");
1216 if (data_codec_name)
1231 scan_all_pmts_set = 1;
1241 if (scan_all_pmts_set)
1258 for (
i = 0;
i < orig_nb_streams;
i++)
1297 int64_t seek_timestamp = timestamp;
1300 int dts_heuristic = 0;
1308 if (dts_heuristic) {
1373 "input file #%d (%s) is not a decoding option.\n", e->
key,
1380 "input file #%d (%s) has not been used for any stream. The most "
1381 "likely reason is either wrong type (e.g. a video option with "
1382 "no video streams) or that it is a private option of some decoder "
1383 "which was not actually used for any stream.\n", e->
key,
1426 char filename[1000];
1427 const char *
base[3] = { getenv(
"AVCONV_DATADIR"),
1436 snprintf(filename,
sizeof(filename),
"%s%s/%s-%s.avpreset",
base[
i],
1437 i != 1 ?
"" :
"/.avconv", codec_name, preset_name);
1441 snprintf(filename,
sizeof(filename),
"%s%s/%s.avpreset",
base[
i],
1442 i != 1 ?
"" :
"/.avconv", preset_name);
1452 char *codec_name =
NULL;
1462 "output stream #%d:%d. Default encoder for format %s (codec %s) is "
1463 "probably disabled. Please choose an encoder manually.\n",
1468 }
else if (!strcmp(codec_name,
"copy"))
1469 ost->stream_copy = 1;
1474 ost->encoding_needed = !
ost->stream_copy;
1477 ost->stream_copy = 1;
1478 ost->encoding_needed = 0;
1489 const char *bsfs =
NULL, *time_base =
NULL;
1490 char *next, *codec_tag =
NULL;
1521 if (!
ost->enc_ctx) {
1525 ost->enc_ctx->codec_type =
type;
1528 if (!
ost->ref_par) {
1545 if (!buf[0] || buf[0] ==
'#') {
1549 if (!(
arg = strchr(buf,
'='))) {
1556 }
while (!
s->eof_reached);
1561 "Preset %s specified for stream %d:%d, but could not be opened.\n",
1577 q.
num <= 0 || q.
den <= 0) {
1592 ost->enc_timebase = q;
1595 ost->max_frames = INT64_MAX;
1605 ost->copy_prior_start = -1;
1609 if (bsfs && *bsfs) {
1619 uint32_t
tag = strtol(codec_tag, &next, 0);
1622 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
1626 ost->enc_ctx->codec_tag =
tag;
1638 ost->max_muxing_queue_size = 128;
1640 ost->max_muxing_queue_size =
FFMIN(
ost->max_muxing_queue_size, INT_MAX /
sizeof(
ost->pkt));
1641 ost->max_muxing_queue_size *=
sizeof(
ost->pkt);
1643 ost->muxing_queue_data_size = 0;
1645 ost->muxing_queue_data_threshold = 50*1024*1024;
1659 ost->source_index = source_index;
1660 if (source_index >= 0) {
1668 if (!
ost->muxing_queue)
1677 const char *p =
str;
1709 while ((ret =
avio_read(pb, buf,
sizeof(buf))) > 0)
1725 if (
ost->filters_script &&
ost->filters) {
1731 if (
ost->filters_script)
1733 else if (
ost->filters)
1743 if (
ost->filters_script ||
ost->filters) {
1745 "%s '%s' was defined for %s output stream %d:%d but codec copy was selected.\n"
1746 "Filtering and streamcopy cannot be used together.\n",
1747 ost->filters ?
"Filtergraph" :
"Filtergraph script",
1748 ost->filters ?
ost->filters :
ost->filters_script,
1759 char *frame_rate =
NULL, *max_frame_rate =
NULL, *frame_aspect_ratio =
NULL;
1763 video_enc =
ost->enc_ctx;
1777 if (frame_rate && max_frame_rate) {
1782 if ((frame_rate || max_frame_rate) &&
1787 if (frame_aspect_ratio) {
1790 q.
num <= 0 || q.
den <= 0) {
1794 ost->frame_aspect_ratio = q;
1800 if (!
ost->stream_copy) {
1801 const char *p =
NULL;
1803 char *frame_pix_fmt =
NULL;
1804 char *intra_matrix =
NULL, *inter_matrix =
NULL;
1805 char *chroma_intra_matrix =
NULL;
1817 if (frame_pix_fmt && *frame_pix_fmt ==
'+') {
1818 ost->keep_pix_fmt = 1;
1819 if (!*++frame_pix_fmt)
1820 frame_pix_fmt =
NULL;
1839 if (chroma_intra_matrix) {
1858 for (
i = 0; p;
i++) {
1860 int e = sscanf(p,
"%d,%d,%d", &start, &end, &q);
1904 if (
ost->logfile_prefix &&
1909 char logfilename[1024];
1912 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
1913 ost->logfile_prefix ?
ost->logfile_prefix :
1916 if (!strcmp(
ost->enc->name,
"libx264")) {
1920 char *logbuffer =
read_file(logfilename);
1933 "Cannot write log file '%s' for pass-1 encoding: %s\n",
1934 logfilename, strerror(errno));
1943 if (
ost->forced_keyframes)
1948 ost->top_field_first = -1;
1957 if (!
ost->last_frame)
1963 if (
ost->stream_copy)
1979 audio_enc =
ost->enc_ctx;
1985 if (!
ost->stream_copy) {
1986 char *sample_fmt =
NULL;
1987 const char *apad =
NULL;
2014 if ((
map->ofile_idx == -1 ||
ost->file_index ==
map->ofile_idx) &&
2015 (
map->ostream_idx == -1 ||
ost->st->
index ==
map->ostream_idx)) {
2018 if (
map->channel_idx == -1) {
2020 }
else if (
ost->source_index < 0) {
2030 ost->audio_channels_mapped + 1,
2031 sizeof(*
ost->audio_channels_map)
2035 ost->audio_channels_map[
ost->audio_channels_mapped++] =
map->channel_idx;
2041 if (
ost->stream_copy)
2052 if (!
ost->stream_copy) {
2065 if (!
ost->stream_copy) {
2076 ost->stream_copy = 1;
2089 subtitle_enc =
ost->enc_ctx;
2095 if (!
ost->stream_copy) {
2117 p = strchr(idx_str,
':');
2120 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
2143 for (
i = 0;
i <
is->nb_chapters;
i++) {
2148 int64_t rt = (
ofile->recording_time == INT64_MAX) ? INT64_MAX :
2152 if (in_ch->
end < ts_off)
2154 if (rt != INT64_MAX && in_ch->
start > rt + ts_off)
2161 out_ch->id = in_ch->
id;
2163 out_ch->start =
FFMAX(0, in_ch->
start - ts_off);
2164 out_ch->end =
FFMIN(rt, in_ch->
end - ts_off);
2179 switch (ofilter->
type) {
2188 ost->source_index = -1;
2189 ost->filter = ofilter;
2194 if (
ost->stream_copy) {
2196 "which is fed from a complex filtergraph. Filtering and streamcopy "
2197 "cannot be used together.\n",
ost->file_index,
ost->
index);
2201 if (
ost->avfilter && (
ost->filters ||
ost->filters_script)) {
2202 const char *opt =
ost->filters ?
"-vf/-af/-filter" :
"-filter_script";
2204 "%s '%s' was specified through the %s option "
2205 "for output stream %d:%d, which is fed from a complex filtergraph.\n"
2206 "%s and -filter_complex cannot be used together for the same stream.\n",
2207 ost->filters ?
"Filtergraph" :
"Filtergraph script",
2208 ost->filters ?
ost->filters :
ost->filters_script,
2237 int format_flags = 0;
2267 if (!strcmp(filename,
"-"))
2301 switch (ofilter->
type) {
2316 int best_score = 0, idx = -1;
2329 score > best_score) {
2342 int best_score = 0, idx = -1;
2351 score > best_score) {
2370 int input_props = 0, output_props = 0;
2375 if (input_descriptor)
2377 if (output_descriptor)
2380 input_props & output_props ||
2382 input_descriptor && output_descriptor &&
2383 (!input_descriptor->
props ||
2384 !output_descriptor->
props)) {
2408 if (
map->linklabel) {
2417 if (
out && !strcmp(
out->name,
map->linklabel)) {
2426 "in any defined filter graph, or was already used elsewhere.\n",
map->linklabel);
2436 map->file_index,
map->stream_index);
2462 "Cannot map stream #%d:%d - unsupported type.\n",
2463 map->file_index,
map->stream_index);
2466 "If you want unsupported types ignored instead "
2467 "of failing, please use the -ignore_unknown option\n"
2468 "If you want them copied, please use -copy_unknown\n");
2474 +
map->sync_stream_index];
2506 ost->stream_copy = 0;
2516 #if FF_API_LAVF_AVCTX
2521 if ((
ost->stream_copy ||
ost->attachment_filename)
2558 "output file #%d (%s) is not an encoding option.\n", e->
key,
2565 if (!strcmp(e->
key,
"gop_timecode"))
2569 "output file #%d (%s) has not been used for any stream. The most "
2570 "likely reason is either wrong type (e.g. a video option with "
2571 "no video streams) or that it is a private option of some encoder "
2572 "which was not actually used for any stream.\n", e->
key,
2581 if (
ost->encoding_needed &&
ost->source_index >= 0) {
2590 "Error initializing a simple filtergraph between streams "
2602 switch (
ost->enc_ctx->codec_type) {
2604 f->frame_rate =
ost->frame_rate;
2605 f->width =
ost->enc_ctx->width;
2606 f->height =
ost->enc_ctx->height;
2608 f->format =
ost->enc_ctx->pix_fmt;
2609 }
else if (
ost->enc->pix_fmts) {
2616 memcpy(
f->formats,
ost->enc->pix_fmts, (count + 1) *
sizeof(*
f->formats));
2621 f->format =
ost->enc_ctx->sample_fmt;
2622 }
else if (
ost->enc->sample_fmts) {
2629 memcpy(
f->formats,
ost->enc->sample_fmts, (count + 1) *
sizeof(*
f->formats));
2631 if (
ost->enc_ctx->sample_rate) {
2632 f->sample_rate =
ost->enc_ctx->sample_rate;
2633 }
else if (
ost->enc->supported_samplerates) {
2635 while (
ost->enc->supported_samplerates[count])
2638 if (!
f->sample_rates)
2640 memcpy(
f->sample_rates,
ost->enc->supported_samplerates,
2641 (count + 1) *
sizeof(*
f->sample_rates));
2643 if (
ost->enc_ctx->channels) {
2645 }
else if (
ost->enc->channel_layouts) {
2647 while (
ost->enc->channel_layouts[count])
2650 if (!
f->channel_layouts)
2652 memcpy(
f->channel_layouts,
ost->enc->channel_layouts,
2653 (count + 1) *
sizeof(*
f->channel_layouts));
2670 "No input streams but output needs an input stream\n");
2699 av_log(
NULL,
AV_LOG_FATAL,
"Invalid input file index %d while processing metadata maps\n", in_file_index);
2703 in_file_index >= 0 ?
2758 const char *to_dealloc = p2;
2773 if (!strcmp(
key,
"program_num"))
2774 progid = strtol(p2,
NULL, 0);
2786 const char *to_dealloc = p2;
2795 "No '=' character in program string %s.\n",
2803 if (!strcmp(
key,
"title")) {
2805 }
else if (!strcmp(
key,
"program_num")) {
2806 }
else if (!strcmp(
key,
"st")) {
2807 int st_num = strtol(p2,
NULL, 0);
2822 const char *stream_spec;
2823 int index = 0, j, ret = 0;
2842 ost->rotate_overridden = 1;
2843 ost->rotate_override_value = theta;
2886 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
2888 if (!strncmp(
arg,
"pal-", 4)) {
2891 }
else if (!strncmp(
arg,
"ntsc-", 5)) {
2894 }
else if (!strncmp(
arg,
"film-", 5)) {
2911 }
else if ((fr == 29970) || (fr == 23976)) {
2931 if (!strcmp(
arg,
"vcd")) {
2958 }
else if (!strcmp(
arg,
"svcd")) {
2980 }
else if (!strcmp(
arg,
"dvd")) {
3002 }
else if (!strncmp(
arg,
"dv", 2)) {
3008 norm ==
PAL ?
"yuv420p" :
"yuv411p",
options);
3035 time_t today2 = time(
NULL);
3036 struct tm *today = localtime(&today2);
3043 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
3090 char filename[1000],
line[1000], tmp_line[1000];
3091 const char *codec_name =
NULL;
3092 int depth = o->
depth;
3104 if(!strncmp(
arg,
"libx264-lossless", strlen(
"libx264-lossless"))){
3113 char *
key = tmp_line, *
value, *endptr;
3115 if (strcspn(
line,
"#\n\r") == 0)
3158 if(!strcmp(opt,
"ab")){
3161 }
else if(!strcmp(opt,
"b")){
3175 if(!strcmp(opt,
"qscale")){
3190 if(!strcmp(opt,
"profile")){
3240 char layout_str[32];
3259 stream_str = strchr(opt,
':');
3260 ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
3315 int show_advanced = 0, show_avoptions = 0;
3318 if (!strcmp(opt,
"long"))
3320 else if (!strcmp(opt,
"full"))
3321 show_advanced = show_avoptions = 1;
3328 printf(
"Getting help:\n"
3329 " -h -- print basic options\n"
3330 " -h long -- print more options\n"
3331 " -h full -- print all options (including all format and codec specific options, very long)\n"
3332 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
3333 " See man %s for detailed description of the options.\n"
3340 "instead of just one file):",
3368 if (show_avoptions) {
3375 #if CONFIG_SWRESAMPLE
3397 [GROUP_INFILE] = {
"input url",
"i",
OPT_INPUT },
3415 "%s.\n", inout,
g->arg);
3440 memset(&octx, 0,
sizeof(octx));
3492 static int opt_progress(
void *optctx,
const char *opt,
const char *
arg)
3497 if (!strcmp(
arg,
"-"))
3509 #define OFFSET(x) offsetof(OptionsContext, x)
3515 "force format",
"fmt" },
3517 "overwrite output files" },
3519 "never overwrite output files" },
3521 "Ignore unknown stream types" },
3523 "Copy unknown stream types" },
3526 "codec name",
"codec" },
3529 "codec name",
"codec" },
3532 "preset name",
"preset" },
3535 "set input stream mapping",
3536 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
3538 "map an audio channel from one stream to another",
"file.stream.channel[:syncfile.syncstream]" },
3541 "set metadata information of outfile from infile",
3542 "outfile[,metadata]:infile[,metadata]" },
3545 "set chapters mapping",
"input_file_index" },
3548 "record or transcode \"duration\" seconds of audio/video",
3551 "record or transcode stop time",
"time_stop" },
3553 "set the limit file size in bytes",
"limit_size" },
3556 "set the start time offset",
"time_off" },
3559 "set the start time offset relative to EOF",
"time_off" },
3562 "enable/disable seeking by timestamp with -ss" },
3565 "enable/disable accurate seeking with -ss" },
3568 "set the input ts offset",
"time_off" },
3571 "set the input ts scale",
"scale" },
3573 "set the recording timestamp ('now' to set the current time)",
"time" },
3575 "add metadata",
"string=string" },
3577 "add program with specified streams",
"title=string:st=number..." },
3580 "set the number of data frames to output",
"number" },
3582 "add timings for benchmarking" },
3584 "add timings for each task" },
3586 "write program-readable progress information",
"url" },
3588 "enable or disable interaction on standard input" },
3590 "set max runtime in seconds in CPU user time",
"limit" },
3592 "dump each input packet" },
3594 "when dumping packets, also dump the payload" },
3597 "read input at native frame rate",
"" },
3599 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
3600 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
3602 "video sync method",
"" },
3604 "frame drop threshold",
"" },
3606 "audio sync method",
"" },
3608 "audio drift threshold",
"threshold" },
3610 "copy timestamps" },
3612 "shift input timestamps to start at 0 when using copyts" },
3614 "copy input stream time base when stream copying",
"mode" },
3617 "finish encoding within shortest input" },
3625 "timestamp discontinuity delta threshold",
"threshold" },
3627 "timestamp error delta threshold",
"threshold" },
3629 "exit on error",
"error" },
3631 "abort on the specified condition flags",
"flags" },
3634 "copy initial non-keyframes" },
3636 "copy or discard frames before start time" },
3638 "set the number of frames to output",
"number" },
3641 "force codec tag/fourcc",
"fourcc/tag" },
3644 "use fixed quality scale (VBR)",
"q" },
3647 "use fixed quality scale (VBR)",
"q" },
3649 "set profile",
"profile" },
3651 "set stream filtergraph",
"filter_graph" },
3653 "number of non-complex filter threads" },
3655 "read stream filtergraph description from a file",
"filename" },
3657 "reinit filtergraph on input parameter changes",
"" },
3659 "create a complex filtergraph",
"graph_description" },
3661 "number of threads for -filter_complex" },
3663 "create a complex filtergraph",
"graph_description" },
3665 "read complex filtergraph description from a file",
"filename" },
3667 "enable automatic conversion filters globally" },
3669 "print progress report during encoding", },
3671 "set the period at which ffmpeg updates stats and -progress output",
"time" },
3674 "add an attachment to the output file",
"filename" },
3677 "extract an attachment into a file",
"filename" },
3679 OPT_OFFSET, { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
3681 "print timestamp debugging info" },
3683 "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.",
"maximum error rate" },
3689 "disposition",
"" },
3691 { .off =
OFFSET(thread_queue_size) },
3692 "set the maximum number of queued packets from the demuxer" },
3694 "read and decode the streams to fill missing information with heuristics" },
3698 "set the number of video frames to output",
"number" },
3701 "set frame rate (Hz value, fraction or abbreviation)",
"rate" },
3704 "set max frame rate (Hz value, fraction or abbreviation)",
"rate" },
3707 "set frame size (WxH or abbreviation)",
"size" },
3710 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
3713 "set pixel format",
"format" },
3715 "set the number of bits per raw sample",
"number" },
3717 "deprecated use -g 1" },
3722 "rate control override for specific intervals",
"override" },
3725 "force video codec ('copy' to copy stream)",
"codec" },
3731 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
3733 "select the pass number (1 to 3)",
"n" },
3736 "select two pass log file name prefix",
"prefix" },
3738 "this option is deprecated, use the yadif filter instead" },
3740 "calculate PSNR of compressed frames" },
3742 "dump video coding statistics to file" },
3744 "dump video coding statistics to file",
"file" },
3746 "Version of the vstats format to use."},
3748 "set video filters",
"filter_graph" },
3751 "specify intra matrix coeffs",
"matrix" },
3754 "specify inter matrix coeffs",
"matrix" },
3757 "specify intra matrix coeffs",
"matrix" },
3760 "top=1/bottom=0/auto=-1 field first",
"" },
3763 "force video tag/fourcc",
"fourcc/tag" },
3765 "show QP histogram" },
3768 "force the selected framerate, disable the best supported framerate selection" },
3771 "set the value of an outfile streamid",
"streamIndex:value" },
3774 "force key frames at specified timestamps",
"timestamps" },
3776 "audio bitrate (please use -b:a)",
"bitrate" },
3778 "video bitrate (please use -b:v)",
"bitrate" },
3781 "use HW accelerated decoding",
"hwaccel name" },
3784 "select a device for HW acceleration",
"devicename" },
3787 "select output format used with HW accelerated decoding",
"format" },
3788 #if CONFIG_VIDEOTOOLBOX
3792 "show available HW acceleration methods" },
3795 "automatically insert correct rotate filters" },
3798 "automatically insert a scale filter at the end of the filter graph" },
3802 "set the number of audio frames to output",
"number" },
3804 "set audio quality (codec-specific)",
"quality", },
3807 "set audio sampling rate (in Hz)",
"rate" },
3810 "set number of audio channels",
"channels" },
3815 "force audio codec ('copy' to copy stream)",
"codec" },
3818 "force audio tag/fourcc",
"fourcc/tag" },
3820 "change audio volume (256=normal)" ,
"volume" },
3823 "set sample format",
"format" },
3826 "set channel layout",
"layout" },
3828 "set audio filters",
"filter_graph" },
3830 "set the maximum number of channels to try to guess the channel layout" },
3834 "disable subtitle" },
3836 "force subtitle codec ('copy' to copy stream)",
"codec" },
3838 ,
"force subtitle tag/fourcc",
"fourcc/tag" },
3840 "fix subtitles duration" },
3842 "set canvas size (WxH or abbreviation)",
"size" },
3846 "deprecated, use -channel",
"channel" },
3848 "deprecated, use -standard",
"standard" },
3853 "set the maximum demux-decode delay",
"seconds" },
3855 "set the initial demux-decode delay",
"seconds" },
3857 "specify a file in which to print sdp information",
"file" },
3860 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
3862 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
3863 "two special values are defined - "
3864 "0 = use frame rate (video) or sample rate (audio),"
3865 "-1 = match source time base",
"ratio" },
3868 "A comma-separated list of bitstream filters",
"bitstream_filters" },
3870 "deprecated",
"audio bitstream_filters" },
3872 "deprecated",
"video bitstream_filters" },
3875 "set the audio options to the indicated preset",
"preset" },
3877 "set the video options to the indicated preset",
"preset" },
3879 "set the subtitle options to the indicated preset",
"preset" },
3881 "set options from indicated preset file",
"filename" },
3884 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
3886 "set the threshold after which max_muxing_queue_size is taken into account",
"bytes" },
3890 "force data codec ('copy' to copy stream)",
"codec" },
3896 "set VAAPI hardware device (DRM path or X11 display name)",
"device" },
3901 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
3905 "initialise hardware device",
"args" },
3907 "set hardware device used when filtering",
"device" },
static enum AVSampleFormat sample_fmts[]
static double val(void *priv, double ch)
static const char *const format[]
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
Main libavfilter public API header.
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
void avio_w8(AVIOContext *s, int b)
#define AVIO_FLAG_READ
read-only
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AVIO_FLAG_WRITE
write-only
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
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.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int avio_r8(AVIOContext *s)
char * av_asprintf(const char *fmt,...)
Convenience header that includes libavutil's core.
static const AVBitStreamFilter *const bitstream_filters[]
#define flags(name, subs,...)
#define is(width, name, range_min, range_max, subs,...)
#define u(width, name, range_min, range_max)
audio channel layout utility functions
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
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.
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.
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
void report_and_exit(int ret)
Reports an error corresponding to the provided AVERROR code and calls exit_program() with the corresp...
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0.
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.
void * grow_array(void *array, int elem_size, int *size, int new_size)
Realloc array to hold new_size elements of elem_size.
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec)
Filter out options for given codec.
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
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.
AVDictionary * format_opts
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
Parse a string specifying a time and return its corresponding value as a number of microseconds.
AVDictionary * codec_opts
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
Parse a string and return its corresponding value as a double.
const char program_name[]
program name, defined by the program for show_version().
#define GROW_ARRAY(array, nb_elems)
#define CMDUTILS_COMMON_OPTIONS
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
#define MKTAG(a, b, c, d)
static int open_file(AVFormatContext *avf, unsigned fileno)
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
AVIOContext * progress_avio
int guess_input_channel_layout(InputStream *ist)
const AVIOInterruptCB int_cb
FilterGraph ** filtergraphs
void remove_avoptions(AVDictionary **a, AVDictionary *b)
InputStream ** input_streams
OutputStream ** output_streams
OutputFile ** output_files
void assert_avoptions(AVDictionary *m)
char * videotoolbox_pixfmt
int videotoolbox_init(AVCodecContext *s)
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
int ffmpeg_parse_options(int argc, char **argv)
#define ABORT_ON_FLAG_EMPTY_OUTPUT
int qsv_init(AVCodecContext *s)
int hw_device_init_from_string(const char *arg, HWDevice **dev)
void check_filter_outputs(void)
#define VSYNC_PASSTHROUGH
HWDevice * hw_device_get_by_name(const char *name)
#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM
int init_complex_filtergraph(FilterGraph *fg)
const OptionDef options[]
static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
#define SET_DICT(type, meta, context, index)
static int opt_video_channel(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_frame_aspect_ratios[]
static int opt_video_filters(void *optctx, const char *opt, const char *arg)
static OutputStream * new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_max_frames[]
static const char *const opt_name_audio_channels[]
static int opt_data_codec(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_fix_sub_duration[]
static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
static const char *const opt_name_canvas_sizes[]
static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
static int opt_qscale(void *optctx, const char *opt, const char *arg)
static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
static int opt_vsync(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_top_field_first[]
static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
static char * get_ost_filters(OptionsContext *o, AVFormatContext *oc, OutputStream *ost)
static const char *const opt_name_autorotate[]
static const char *const opt_name_inter_matrices[]
static int init_complex_filters(void)
static const char *const opt_name_sample_fmts[]
static const char *const opt_name_codec_tags[]
static const char *const opt_name_force_fps[]
int frame_bits_per_raw_sample
static void parse_matrix_coeffs(uint16_t *dest, const char *str)
static int find_stream_info
static int opt_map(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_passlogfiles[]
static int opt_sameq(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_max_muxing_queue_size[]
static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
static int opt_bitrate(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_muxing_queue_data_threshold[]
static const char *const opt_name_apad[]
static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_hwaccels[]
static const char *const opt_name_copy_prior_start[]
float dts_error_threshold
static const char *const opt_name_presets[]
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)
#define DEFAULT_PASS_LOGFILENAME_PREFIX
static const char *const opt_name_frame_rates[]
static const char *const opt_name_max_frame_rates[]
static int ignore_unknown_streams
int filter_complex_nbthreads
static int opt_old2new(void *optctx, const char *opt, const char *arg)
static OutputStream * new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index)
static int copy_unknown_streams
static int no_file_overwrite
float frame_drop_threshold
static const char *const opt_name_hwaccel_devices[]
static uint8_t * read_file(const char *filename)
static AVCodec * find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
static OutputStream * new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStream * new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
static OutputStream * new_data_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
static int opt_video_standard(void *optctx, const char *opt, const char *arg)
static int is_windows_reserved_device_name(const char *f)
static const char *const opt_name_discard[]
static const char *const opt_name_rc_overrides[]
static const char *const opt_name_forced_key_frames[]
static int opt_video_codec(void *optctx, const char *opt, const char *arg)
static AVDictionary * strip_specifiers(AVDictionary *dict)
static const char *const opt_name_time_bases[]
int auto_conversion_filters
static int opt_timecode(void *optctx, const char *opt, const char *arg)
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
static const char *const opt_name_frame_sizes[]
static const char *const opt_name_audio_sample_rate[]
static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
static const char *const opt_name_filter_scripts[]
static const AVCodec * choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)
static const char *const opt_name_enc_time_bases[]
static const char *const opt_name_reinit_filters[]
HWDevice * filter_hw_device
static void dump_attachment(AVStream *st, const char *filename)
static const char *const opt_name_guess_layout_max[]
static int input_stream_potentially_available
static int opt_profile(void *optctx, const char *opt, const char *arg)
static int opt_preset(void *optctx, const char *opt, const char *arg)
static void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, const OutputStream *ost, enum AVMediaType type)
static OutputStream * new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
static int open_input_file(OptionsContext *o, const char *filename)
static const char *const opt_name_hwaccel_output_formats[]
static const char *const opt_name_chroma_intra_matrices[]
static const char *const opt_name_filters[]
static const char *const opt_name_copy_initial_nonkeyframes[]
static uint8_t * get_line(AVIOContext *s)
static int opt_target(void *optctx, const char *opt, const char *arg)
float dts_delta_threshold
static const char *const opt_name_intra_matrices[]
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
static const char *const opt_name_bitstream_filters[]
static int opt_streamid(void *optctx, const char *opt, const char *arg)
static void init_options(OptionsContext *o)
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
static void assert_file_overwrite(const char *filename)
static const char *const opt_name_qscale[]
static const char *const opt_name_codec_names[]
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
static int open_output_file(OptionsContext *o, const char *filename)
static int opt_vstats(void *optctx, const char *opt, const char *arg)
static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
Parse a metadata specifier passed as 'arg' parameter.
static const char *const opt_name_autoscale[]
static int file_overwrite
static void uninit_options(OptionsContext *o)
static int opt_video_frames(void *optctx, const char *opt, const char *arg)
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_ts_scale[]
static const char *const opt_name_disposition[]
float audio_drift_threshold
static int opt_attach(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_frame_pix_fmts[]
static OutputStream * new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
static const char *const opt_name_pass[]
static int safe_filename(const char *f, int allow_subdir)
static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
static int subtitle_disable
static const char * video_codec_name
static const char * audio_codec_name
static AVInputFormat * file_iformat
static const char * subtitle_codec_name
static int64_t start_time
a very simple circular buffer FIFO implementation
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() is fake – only a double pointer to AVClass instead of a required poin...
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
AVCodecID
Identify the syntax and semantics of the bitstream.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
#define AV_CODEC_PROP_BITMAP_SUB
Subtitle codec is bitmap based Decoded AVSubtitle data can be read from the AVSubtitleRect->pict fiel...
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
#define AV_CODEC_PROP_TEXT_SUB
Subtitle codec is text based.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AVDISCARD_ALL
discard all
@ AVDISCARD_NONE
discard nothing
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
AVProgram * av_new_program(AVFormatContext *s, int id)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
ff_const59 AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
Guess the codec ID based upon muxer and filename.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
const AVClass * avfilter_get_class(void)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define AV_DICT_APPEND
If the entry already exists, append to it.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set that converts the value to a string and stores it.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
#define AVERROR_PROTOCOL_NOT_FOUND
Protocol not found.
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
char * av_strdup(const char *s)
Duplicate a string.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array through a pointer to a pointer.
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
FILE * av_fopen_utf8(const char *path, const char *mode)
Open a file using a UTF-8 filename.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes,...
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().
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
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.
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...
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
const VDPAUPixFmtMap * map
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
#define AV_OPT_FLAG_BSF_PARAM
a generic parameter which can be set by the user for bit stream filtering
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
#define AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int av_parse_ratio(AVRational *q, const char *str, int max, int log_offset, void *log_ctx)
Parse str and store the parsed ratio in q.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
@ AV_PIX_FMT_VIDEOTOOLBOX
hardware decoding through Videotoolbox
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
static const struct PPFilter filters[]
static const uint8_t frame_sizes[]
#define FF_ARRAY_ELEMS(a)
int id
unique ID to identify the chapter
int64_t end
chapter start/end time in time_base units
AVRational time_base
time base in which the start/end timestamps are specified
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
uint16_t * chroma_intra_matrix
custom intra quantization matrix
int width
picture width / height.
enum AVSampleFormat sample_fmt
audio sample format
enum AVMediaType codec_type
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
int rc_override_count
ratecontrol override, see RcOverride
uint16_t * inter_matrix
custom inter quantization matrix Must be allocated with the av_malloc() family of functions,...
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int sample_rate
samples per second
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
uint16_t * intra_matrix
custom intra quantization matrix Must be allocated with the av_malloc() family of functions,...
int flags
AV_CODEC_FLAG_*.
int channels
number of audio channels
This struct describes the properties of a single codec described by an AVCodecID.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
enum AVMediaType codec_type
General type of the encoded data.
int video_delay
Video only.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
const char * name
Name of the codec implementation.
A linked-list of the inputs/outputs of the filter chain.
char * name
unique name for this input/output in the list
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVCodec * video_codec
Forced video codec.
enum AVCodecID audio_codec_id
Forced audio codec_id.
AVIOContext * pb
I/O context.
enum AVCodecID data_codec_id
Forced Data codec_id.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
AVDictionary * metadata
Metadata that applies to the whole file.
int flags
Flags modifying the (de)muxer behaviour.
ff_const59 struct AVInputFormat * iformat
The input container format.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
char * url
input or output URL.
AVCodec * data_codec
Forced data codec.
unsigned int nb_chapters
Number of chapters in AVChapter array.
ff_const59 struct AVOutputFormat * oformat
The output container format.
AVCodec * subtitle_codec
Forced subtitle codec.
enum AVCodecID video_codec_id
Forced video codec_id.
AVCodec * audio_codec
Forced audio codec.
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
This structure stores compressed data.
New fields can be added to the end with minor version bumps.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
attribute_deprecated AVCodecContext * codec
int event_flags
Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
int disposition
AV_DISPOSITION_* bit field.
A list of option groups that all have the same group type (e.g.
AVDictionary * codec_opts
AVDictionary * format_opts
AVDictionary * resample_opts
SpecifierOpt * metadata_map
SpecifierOpt * frame_pix_fmts
SpecifierOpt * dump_attachment
SpecifierOpt * audio_sample_rate
int nb_audio_channel_maps
SpecifierOpt * max_frames
int metadata_global_manual
SpecifierOpt * frame_sizes
int metadata_streams_manual
SpecifierOpt * audio_channels
SpecifierOpt * frame_rates
int metadata_chapters_manual
const char ** attachments
AudioChannelMap * audio_channel_maps
int64_t start_time
start time in microseconds == AV_TIME_BASE units
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
struct OutputStream * ost
char * specifier
stream/chapter/program/...
#define av_realloc_f(p, o, n)
static void error(const char *err)
static const Preset presets[]