44 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
46 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
49 for (i = 0; i < o->nb_ ## name; i++) {\
50 char *spec = o->name[i].specifier;\
51 if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\
52 outvar = o->name[i].u.type;\
58 #define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\
61 for (i = 0; i < o->nb_ ## name; i++) {\
62 char *spec = o->name[i].specifier;\
63 if (!strcmp(spec, mediatype))\
64 outvar = o->name[i].u.type;\
85 #if CONFIG_VIDEOTOOLBOX
161 int i, *
count = (
int*)(so + 1);
162 for (i = 0; i < *
count; i++) {
184 memset(o, 0,
sizeof(*o));
200 printf(
"Hardware acceleration methods:\n");
201 for (i = 0; hwaccels[i].
name; i++) {
202 printf(
"%s\n", hwaccels[i].
name);
215 char *p = strchr(e->
key,
':');
239 const AVClass *pclass = &
class;
247 "If you are looking for an option to preserve the quality (which is not "
248 "what -%s was for), use -qscale 0 or an equivalent quality factor option.\n",
289 static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
293 int i, negative = 0, file_idx;
294 int sync_file_idx = -1, sync_stream_idx = 0;
308 if (sync = strchr(map,
',')) {
310 sync_file_idx = strtol(sync + 1, &sync, 0);
325 "match any streams.\n", arg);
333 const char *
c = map + 1;
342 if (allow_unused = strchr(map,
'?'))
344 file_idx = strtol(map, &p, 0);
356 *p ==
':' ? p + 1 : p) > 0)
362 *p ==
':' ? p + 1 : p) <= 0)
370 if (sync_file_idx >= 0) {
385 "To ignore this, add a trailing '?' to the map.\n", arg);
428 n = sscanf(arg,
"%d.%d.%d:%d.%d",
432 if (n != 3 && n != 5) {
434 "[file.stream.channel|-1][:syncfile:syncstream]\n");
460 if (allow_unused = strchr(mapchan,
'?'))
468 "To ignore this, add a trailing '?' to the map_channel.\n",
486 static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
489 const char *prefix =
"vaapi:";
508 if (!strcmp(arg,
"list")) {
510 printf(
"Supported hardware device types:\n");
523 if (filter_hw_device) {
528 if (!filter_hw_device) {
550 if (*(++arg) && *arg !=
':') {
554 *stream_spec = *arg ==
':' ? arg + 1 :
"";
559 *index = strtol(++arg,
NULL, 0);
574 char type_in, type_out;
575 const char *istream_spec =
NULL, *ostream_spec =
NULL;
576 int idx_in = 0, idx_out = 0;
582 if (type_out ==
'g' || !*outspec)
584 if (type_out ==
's' || !*outspec)
586 if (type_out ==
'c' || !*outspec)
591 if (type_in ==
'g' || type_out ==
'g')
593 if (type_in ==
's' || type_out ==
's')
595 if (type_in ==
'c' || type_out ==
'c')
602 #define METADATA_CHECK_INDEX(index, nb_elems, desc)\
603 if ((index) < 0 || (index) >= (nb_elems)) {\
604 av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
609 #define SET_DICT(type, meta, context, index)\
612 meta = &context->metadata;\
615 METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
616 meta = &context->chapters[index]->metadata;\
619 METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
620 meta = &context->programs[index]->metadata;\
624 default: av_assert0(0);\
627 SET_DICT(type_in, meta_in, ic, idx_in);
628 SET_DICT(type_out, meta_out, oc, idx_out);
631 if (type_in ==
's') {
645 if (type_out ==
's') {
664 struct tm time = *gmtime((time_t*)&recording_timestamp);
665 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
670 "tag instead.\n", opt);
677 const char *
codec_string = encoder ?
"encoder" :
"decoder";
689 codec_string, codec->
name, desc->
name);
696 if (codec->
type != type) {
705 char *codec_name =
NULL;
726 char *framerate =
NULL, *hwaccel =
NULL, *hwaccel_device =
NULL;
727 char *hwaccel_output_format =
NULL;
728 char *codec_tag =
NULL;
730 char *discard_str =
NULL;
756 uint32_t
tag = strtol(codec_tag, &next, 0);
823 if (!strcmp(hwaccel,
"none"))
825 else if (!strcmp(hwaccel,
"auto"))
829 for (i = 0; hwaccels[i].
name; i++) {
830 if (!strcmp(hwaccels[i].
name, hwaccel)) {
840 for (i = 0; hwaccels[i].
name; i++)
849 if (hwaccel_device) {
856 hwaccel_output_format, ic, st);
857 if (hwaccel_output_format) {
861 "format: %s", hwaccel_output_format);
877 char *canvas_size =
NULL;
907 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
913 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
915 fprintf(stderr,
"File '%s' already exists. Overwrite ? [y/N] ", filename);
918 signal(SIGINT, SIG_DFL);
977 char * data_codec_name =
NULL;
978 int scan_all_pmts_set = 0;
987 if (!strcmp(filename,
"-"))
991 strcmp(filename,
"/dev/stdin");
999 ic->
flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
1007 if (file_iformat && file_iformat->
priv_class &&
1016 if (file_iformat && file_iformat->
priv_class &&
1043 if (video_codec_name)
1045 if (audio_codec_name)
1047 if (subtitle_codec_name)
1049 if (data_codec_name)
1057 scan_all_pmts_set = 1;
1067 if (scan_all_pmts_set)
1084 for (i = 0; i < orig_nb_streams; i++)
1110 int64_t seek_timestamp = timestamp;
1113 int dts_heuristic = 0;
1119 if (dts_heuristic) {
1175 if (!option || foption)
1181 "input file #%d (%s) is not a decoding option.\n", e->
key,
1188 "input file #%d (%s) has not been used for any stream. The most "
1189 "likely reason is either wrong type (e.g. a video option with "
1190 "no video streams) or that it is a private option of some decoder "
1191 "which was not actually used for any stream.\n", e->
key,
1223 while ((c =
avio_r8(s)) && c !=
'\n')
1234 char filename[1000];
1235 const char *base[3] = { getenv(
"AVCONV_DATADIR"),
1244 snprintf(filename,
sizeof(filename),
"%s%s/%s-%s.avpreset", base[i],
1245 i != 1 ?
"" :
"/.avconv", codec_name, preset_name);
1249 snprintf(filename,
sizeof(filename),
"%s%s/%s.avpreset", base[i],
1250 i != 1 ?
"" :
"/.avconv", preset_name);
1260 char *codec_name =
NULL;
1270 "output stream #%d:%d. Default encoder for format %s (codec %s) is "
1271 "probably disabled. Please choose an encoder manually.\n",
1276 }
else if (!strcmp(codec_name,
"copy"))
1297 const char *bsfs =
NULL, *time_base =
NULL;
1298 char *next, *codec_tag =
NULL;
1350 if (!buf[0] || buf[0] ==
'#') {
1354 if (!(arg = strchr(buf,
'='))) {
1366 "Preset %s specified for stream %d:%d, but could not be opened.\n",
1378 q.
num <= 0 || q.
den <= 0) {
1410 while (bsfs && *bsfs) {
1412 char *bsf, *bsf_options_str, *bsf_name;
1417 bsf_name =
av_strtok(bsf,
"=", &bsf_options_str);
1443 const char * shorthand[2] = {
NULL};
1446 shorthand[0] = opt->
name;
1462 uint32_t
tag = strtol(codec_tag, &next, 0);
1494 if (source_index >= 0) {
1511 const char *p = str;
1543 while ((ret =
avio_read(pb, buf,
sizeof(buf))) > 0)
1579 "%s '%s' was defined for %s output stream %d:%d but codec copy was selected.\n"
1580 "Filtering and streamcopy cannot be used together.\n",
1581 ost->
filters ?
"Filtergraph" :
"Filtergraph script",
1593 char *frame_rate =
NULL, *frame_aspect_ratio =
NULL;
1608 if (frame_aspect_ratio) {
1611 q.
num <= 0 || q.
den <= 0) {
1622 const char *p =
NULL;
1624 char *frame_pix_fmt =
NULL;
1625 char *intra_matrix =
NULL, *inter_matrix =
NULL;
1626 char *chroma_intra_matrix =
NULL;
1638 if (frame_pix_fmt && *frame_pix_fmt ==
'+') {
1640 if (!*++frame_pix_fmt)
1641 frame_pix_fmt =
NULL;
1660 if (chroma_intra_matrix) {
1679 for (i = 0; p; i++) {
1681 int e = sscanf(p,
"%d,%d,%d", &start, &end, &q);
1730 char logfilename[1024];
1733 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
1737 if (!strcmp(ost->
enc->name,
"libx264")) {
1741 char *logbuffer =
read_file(logfilename);
1754 "Cannot write log file '%s' for pass-1 encoding: %s\n",
1755 logfilename, strerror(errno));
1803 char *sample_fmt =
NULL;
1929 p = strchr(idx_str,
':');
1932 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
1964 if (in_ch->
end < ts_off)
1966 if (rt != INT64_MAX && in_ch->
start > rt + ts_off)
1973 out_ch->id = in_ch->
id;
1975 out_ch->start =
FFMAX(0, in_ch->
start - ts_off);
1976 out_ch->end =
FFMIN(rt, in_ch->
end - ts_off);
1991 ic->
flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
2001 const char *enc_config;
2042 switch (ofilter->
type) {
2059 "which is fed from a complex filtergraph. Filtering and streamcopy "
2065 const char *opt = ost->
filters ?
"-vf/-af/-filter" :
"-filter_script";
2067 "%s '%s' was specified through the %s option "
2068 "for output stream %d:%d, which is fed from a complex filtergraph.\n"
2069 "%s and -filter_complex cannot be used together for the same stream.\n",
2070 ost->
filters ?
"Filtergraph" :
"Filtergraph script",
2101 int format_flags = 0;
2131 if (!strcmp(filename,
"-"))
2162 switch (ofilter->
type) {
2172 if (!strcmp(file_oformat->
name,
"ffm") &&
2217 int area = 0, idx = -1;
2239 int best_score = 0, idx = -1;
2245 score > best_score) {
2264 int input_props = 0, output_props = 0;
2267 if (input_descriptor)
2269 if (output_descriptor)
2271 if (subtitle_codec_name ||
2272 input_props & output_props ||
2274 input_descriptor && output_descriptor &&
2275 (!input_descriptor->
props ||
2276 !output_descriptor->
props)) {
2316 "in any defined filter graph, or was already used elsewhere.\n", map->
linklabel);
2347 "Cannot map stream #%d:%d - unsupported type.\n",
2351 "If you want unsupported types ignored instead "
2352 "of failing, please use the -ignore_unknown option\n"
2353 "If you want them copied, please use -copy_unknown\n");
2399 #if FF_API_LAVF_AVCTX
2435 if (!option || foption)
2441 "output file #%d (%s) is not an encoding option.\n", e->
key,
2448 if (!strcmp(e->
key,
"gop_timecode"))
2452 "output file #%d (%s) has not been used for any stream. The most "
2453 "likely reason is either wrong type (e.g. a video option with "
2454 "no video streams) or that it is a private option of some encoder "
2455 "which was not actually used for any stream.\n", e->
key,
2473 "Error initializing a simple filtergraph between streams "
2492 }
else if (ost->
enc->pix_fmts) {
2505 }
else if (ost->
enc->sample_fmts) {
2516 }
else if (ost->
enc->supported_samplerates) {
2518 while (ost->
enc->supported_samplerates[count])
2528 }
else if (ost->
enc->channel_layouts) {
2530 while (ost->
enc->channel_layouts[count])
2553 "No input streams but output needs an input stream\n");
2582 av_log(
NULL,
AV_LOG_FATAL,
"Invalid input file index %d while processing metadata maps\n", in_file_index);
2586 in_file_index >= 0 ?
2625 if (!output_streams[i]->stream_copy) {
2638 const char *to_dealloc = p2;
2653 if (!strcmp(key,
"program_num"))
2654 progid = strtol(p2,
NULL, 0);
2664 const char *to_dealloc = p2;
2673 "No '=' character in program string %s.\n",
2681 if (!strcmp(key,
"title")) {
2683 }
else if (!strcmp(key,
"program_num")) {
2684 }
else if (!strcmp(key,
"st")) {
2685 int st_num = strtol(p2,
NULL, 0);
2700 const char *stream_spec;
2701 int index = 0, j, ret = 0;
2760 static int opt_target(
void *optctx,
const char *opt,
const char *arg)
2764 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
2766 if (!strncmp(arg,
"pal-", 4)) {
2769 }
else if (!strncmp(arg,
"ntsc-", 5)) {
2772 }
else if (!strncmp(arg,
"film-", 5)) {
2788 }
else if ((fr == 29970) || (fr == 23976)) {
2808 if (!strcmp(arg,
"vcd")) {
2835 }
else if (!strcmp(arg,
"svcd")) {
2857 }
else if (!strcmp(arg,
"dvd")) {
2879 }
else if (!strncmp(arg,
"dv", 2)) {
2884 parse_option(o,
"pix_fmt", !strncmp(arg,
"dv50", 4) ?
"yuv422p" :
2885 norm ==
PAL ?
"yuv420p" :
"yuv411p",
options);
2909 static int opt_vstats(
void *optctx,
const char *opt,
const char *arg)
2912 time_t today2 = time(
NULL);
2913 struct tm *today = localtime(&today2);
2920 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
2963 static int opt_preset(
void *optctx,
const char *opt,
const char *arg)
2967 char filename[1000],
line[1000], tmp_line[1000];
2968 const char *codec_name =
NULL;
2974 if (!(f =
get_preset_file(filename,
sizeof(filename), arg, *opt ==
'f', codec_name))) {
2975 if(!strncmp(arg,
"libx264-lossless", strlen(
"libx264-lossless"))){
2982 while (fgets(line,
sizeof(line), f)) {
2983 char *key = tmp_line, *
value, *endptr;
2985 if (strcspn(line,
"#\n\r") == 0)
2987 av_strlcpy(tmp_line, line,
sizeof(tmp_line));
3001 filename, line, key, value);
3011 static int opt_old2new(
void *optctx,
const char *opt,
const char *arg)
3020 static int opt_bitrate(
void *optctx,
const char *opt,
const char *arg)
3024 if(!strcmp(opt,
"ab")){
3027 }
else if(!strcmp(opt,
"b")){
3036 static int opt_qscale(
void *optctx,
const char *opt,
const char *arg)
3041 if(!strcmp(opt,
"qscale")){
3051 static int opt_profile(
void *optctx,
const char *opt,
const char *arg)
3054 if(!strcmp(opt,
"profile")){
3075 static int opt_vsync(
void *optctx,
const char *opt,
const char *arg)
3101 char layout_str[32];
3104 int ret, channels, ac_str_size;
3112 snprintf(layout_str,
sizeof(layout_str),
"%"PRIu64, layout);
3119 snprintf(layout_str,
sizeof(layout_str),
"%d", channels);
3120 stream_str = strchr(opt,
':');
3121 ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
3176 int show_advanced = 0, show_avoptions = 0;
3179 if (!strcmp(opt,
"long"))
3181 else if (!strcmp(opt,
"full"))
3182 show_advanced = show_avoptions = 1;
3189 printf(
"Getting help:\n"
3190 " -h -- print basic options\n"
3191 " -h long -- print more options\n"
3192 " -h full -- print all options (including all format and codec specific options, very long)\n"
3193 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter\n"
3194 " See man %s for detailed description of the options.\n"
3201 "instead of just one file:",
3229 if (show_avoptions) {
3273 "%s.\n", inout, g->
arg);
3297 memset(&octx, 0,
sizeof(octx));
3354 if (!strcmp(arg,
"-"))
3366 #define OFFSET(x) offsetof(OptionsContext, x)
3372 "force format",
"fmt" },
3374 "overwrite output files" },
3376 "never overwrite output files" },
3378 "Ignore unknown stream types" },
3380 "Copy unknown stream types" },
3383 "codec name",
"codec" },
3386 "codec name",
"codec" },
3389 "preset name",
"preset" },
3392 "set input stream mapping",
3393 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
3395 "map an audio channel from one stream to another",
"file.stream.channel[:syncfile.syncstream]" },
3398 "set metadata information of outfile from infile",
3399 "outfile[,metadata]:infile[,metadata]" },
3402 "set chapters mapping",
"input_file_index" },
3405 "record or transcode \"duration\" seconds of audio/video",
3408 "record or transcode stop time",
"time_stop" },
3410 "set the limit file size in bytes",
"limit_size" },
3413 "set the start time offset",
"time_off" },
3416 "set the start time offset relative to EOF",
"time_off" },
3419 "enable/disable seeking by timestamp with -ss" },
3422 "enable/disable accurate seeking with -ss" },
3425 "set the input ts offset",
"time_off" },
3428 "set the input ts scale",
"scale" },
3430 "set the recording timestamp ('now' to set the current time)",
"time" },
3432 "add metadata",
"string=string" },
3434 "add program with specified streams",
"title=string:st=number..." },
3437 "set the number of data frames to output",
"number" },
3439 "add timings for benchmarking" },
3441 "add timings for each task" },
3443 "write program-readable progress information",
"url" },
3445 "enable or disable interaction on standard input" },
3447 "set max runtime in seconds",
"limit" },
3449 "dump each input packet" },
3451 "when dumping packets, also dump the payload" },
3454 "read input at native frame rate",
"" },
3456 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
3457 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
3459 "video sync method",
"" },
3461 "frame drop threshold",
"" },
3463 "audio sync method",
"" },
3465 "audio drift threshold",
"threshold" },
3467 "copy timestamps" },
3469 "shift input timestamps to start at 0 when using copyts" },
3471 "copy input stream time base when stream copying",
"mode" },
3474 "finish encoding within shortest input" },
3479 "timestamp discontinuity delta threshold",
"threshold" },
3481 "timestamp error delta threshold",
"threshold" },
3483 "exit on error",
"error" },
3485 "abort on the specified condition flags",
"flags" },
3488 "copy initial non-keyframes" },
3490 "copy or discard frames before start time" },
3492 "set the number of frames to output",
"number" },
3495 "force codec tag/fourcc",
"fourcc/tag" },
3498 "use fixed quality scale (VBR)",
"q" },
3501 "use fixed quality scale (VBR)",
"q" },
3503 "set profile",
"profile" },
3505 "set stream filtergraph",
"filter_graph" },
3507 "number of non-complex filter threads" },
3509 "read stream filtergraph description from a file",
"filename" },
3511 "reinit filtergraph on input parameter changes",
"" },
3513 "create a complex filtergraph",
"graph_description" },
3515 "number of threads for -filter_complex" },
3517 "create a complex filtergraph",
"graph_description" },
3519 "read complex filtergraph description from a file",
"filename" },
3521 "print progress report during encoding", },
3524 "add an attachment to the output file",
"filename" },
3527 "extract an attachment into a file",
"filename" },
3529 OPT_OFFSET, { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
3531 "print timestamp debugging info" },
3533 "maximum error rate",
"ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success." },
3539 "disposition",
"" },
3541 { .off =
OFFSET(thread_queue_size) },
3542 "set the maximum number of queued packets from the demuxer" },
3544 "read and decode the streams to fill missing information with heuristics" },
3548 "set the number of video frames to output",
"number" },
3551 "set frame rate (Hz value, fraction or abbreviation)",
"rate" },
3554 "set frame size (WxH or abbreviation)",
"size" },
3557 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
3560 "set pixel format",
"format" },
3562 "set the number of bits per raw sample",
"number" },
3564 "deprecated use -g 1" },
3569 "rate control override for specific intervals",
"override" },
3572 "force video codec ('copy' to copy stream)",
"codec" },
3578 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
3580 "select the pass number (1 to 3)",
"n" },
3583 "select two pass log file name prefix",
"prefix" },
3585 "this option is deprecated, use the yadif filter instead" },
3587 "calculate PSNR of compressed frames" },
3589 "dump video coding statistics to file" },
3591 "dump video coding statistics to file",
"file" },
3593 "Version of the vstats format to use."},
3595 "set video filters",
"filter_graph" },
3598 "specify intra matrix coeffs",
"matrix" },
3601 "specify inter matrix coeffs",
"matrix" },
3604 "specify intra matrix coeffs",
"matrix" },
3607 "top=1/bottom=0/auto=-1 field first",
"" },
3610 "force video tag/fourcc",
"fourcc/tag" },
3612 "show QP histogram" },
3615 "force the selected framerate, disable the best supported framerate selection" },
3618 "set the value of an outfile streamid",
"streamIndex:value" },
3621 "force key frames at specified timestamps",
"timestamps" },
3623 "audio bitrate (please use -b:a)",
"bitrate" },
3625 "video bitrate (please use -b:v)",
"bitrate" },
3628 "use HW accelerated decoding",
"hwaccel name" },
3631 "select a device for HW acceleration",
"devicename" },
3634 "select output format used with HW accelerated decoding",
"format" },
3635 #if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
3639 "show available HW acceleration methods" },
3642 "automatically insert correct rotate filters" },
3644 "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream" },
3648 "set the number of audio frames to output",
"number" },
3650 "set audio quality (codec-specific)",
"quality", },
3653 "set audio sampling rate (in Hz)",
"rate" },
3656 "set number of audio channels",
"channels" },
3661 "force audio codec ('copy' to copy stream)",
"codec" },
3664 "force audio tag/fourcc",
"fourcc/tag" },
3666 "change audio volume (256=normal)" ,
"volume" },
3669 "set sample format",
"format" },
3672 "set channel layout",
"layout" },
3674 "set audio filters",
"filter_graph" },
3676 "set the maximum number of channels to try to guess the channel layout" },
3680 "disable subtitle" },
3682 "force subtitle codec ('copy' to copy stream)",
"codec" },
3684 ,
"force subtitle tag/fourcc",
"fourcc/tag" },
3686 "fix subtitles duration" },
3688 "set canvas size (WxH or abbreviation)",
"size" },
3692 "deprecated, use -channel",
"channel" },
3694 "deprecated, use -standard",
"standard" },
3699 "set the maximum demux-decode delay",
"seconds" },
3701 "set the initial demux-decode delay",
"seconds" },
3703 "override the options from ffserver",
"" },
3705 "specify a file in which to print sdp information",
"file" },
3708 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
3710 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
3711 "two special values are defined - "
3712 "0 = use frame rate (video) or sample rate (audio),"
3713 "-1 = match source time base",
"ratio" },
3716 "A comma-separated list of bitstream filters",
"bitstream_filters" },
3718 "deprecated",
"audio bitstream_filters" },
3720 "deprecated",
"video bitstream_filters" },
3723 "set the audio options to the indicated preset",
"preset" },
3725 "set the video options to the indicated preset",
"preset" },
3727 "set the subtitle options to the indicated preset",
"preset" },
3729 "set options from indicated preset file",
"filename" },
3732 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
3736 "force data codec ('copy' to copy stream)",
"codec" },
3742 "set VAAPI hardware device (DRM path or X11 display name)",
"device" },
3747 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
3751 "initialise hardware device",
"args" },
3753 "set hardware device used when filtering",
"device" },
unsigned int nb_chapters
Number of chapters in AVChapter array.
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
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.
int guess_input_channel_layout(InputStream *ist)
const char const char void * val
AVDictionary * resample_opts
static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions. ...
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
int64_t avio_size(AVIOContext *s)
Get the filesize.
enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *avctx, AVCodec *codec, enum AVPixelFormat target)
#define av_realloc_f(p, o, n)
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
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.
static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
char * filters
filtergraph associated to the -filter option
static AVInputFormat * file_iformat
int coded_width
Bitstream width / height, may be different from width/height e.g.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
Main libavfilter public API header.
static void assert_file_overwrite(const char *filename)
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
hardware decoding through Videotoolbox
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.
void choose_sample_fmt(AVStream *st, AVCodec *codec)
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
FILE * av_fopen_utf8(const char *path, const char *mode)
Open a file using a UTF-8 filename.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
#define AV_OPT_FLAG_AUDIO_PARAM
int index
stream index in AVFormatContext
int max_muxing_queue_size
#define AVIO_FLAG_READ
read-only
static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
static OutputStream * new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define AVIO_FLAG_WRITE
write-only
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
#define AV_CODEC_PROP_TEXT_SUB
Subtitle codec is text based.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Convenience header that includes libavutil's core.
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int cuvid_init(AVCodecContext *s)
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
static int file_overwrite
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static OutputStream * new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index)
static int find_stream_info
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static const char * audio_codec_name
static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
void * priv_data
Opaque filter-specific private data.
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
#define CMDUTILS_COMMON_OPTIONS
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
This struct describes the properties of an encoded stream.
int64_t start_time
start time in microseconds == AV_TIME_BASE units
static int opt_preset(void *optctx, const char *opt, const char *arg)
SpecifierOpt * frame_pix_fmts
static int opt_data_codec(void *optctx, const char *opt, const char *arg)
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url...
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter.
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Parse the key-value pairs list in opts.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val)
static const uint8_t frame_sizes[]
static int ignore_unknown_streams
static int64_t start_time
int copy_initial_nonkeyframes
enum AVSampleFormat sample_fmt
audio sample format
Opaque data information usually continuous.
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...
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
static int open_input_file(OptionsContext *o, const char *filename)
static const OptionGroupDef groups[]
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
static av_cold int end(AVCodecContext *avctx)
uint16_t * chroma_intra_matrix
custom intra quantization matrix
int id
unique ID to identify the chapter
static int opt_vsync(void *optctx, const char *opt, const char *arg)
int id
Format-specific stream ID.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, uint8_t clip)
AVStream ** streams
A list of all streams in the file.
static int opt_vstats(void *optctx, const char *opt, const char *arg)
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
void av_codec_set_lowres(AVCodecContext *avctx, int val)
#define AVERROR_PROTOCOL_NOT_FOUND
Protocol not found.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int flags
Flags modifying the (de)muxer behaviour.
AVProgram * av_new_program(AVFormatContext *s, int id)
AVDictionary * resample_opts
#define AV_LOG_VERBOSE
Detailed information.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
int init_complex_filtergraph(FilterGraph *fg)
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.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
const OptionDef options[]
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
enum AVCodecID video_codec_id
Forced video codec_id.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int opt_video_codec(void *optctx, const char *opt, const char *arg)
static int opt_qscale(void *optctx, const char *opt, const char *arg)
struct AVOutputFormat * oformat
The output container format.
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
AVDictionary * format_opts
static OutputStream * new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
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, streams, container, programs, metadata, side data, codec and time base.
int filter_complex_nbthreads
AVCodecID
Identify the syntax and semantics of the bitstream.
static int opt_profile(void *optctx, const char *opt, const char *arg)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionary * metadata
Metadata that applies to the whole file.
void check_filter_outputs(void)
FilterGraph ** filtergraphs
const AVIOInterruptCB int_cb
static int open_files(OptionGroupList *l, const char *inout, int(*open_file)(OptionsContext *, const char *))
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
static int opt_video_channel(void *optctx, const char *opt, const char *arg)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int video_delay
Video only.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AudioChannelMap * audio_channel_maps
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVMediaType codec_type
General type of the encoded data.
int flags
AV_CODEC_FLAG_*.
static int opt_bitrate(void *optctx, const char *opt, const char *arg)
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
Parse a metadata specifier passed as 'arg' parameter.
simple assert() macros that are a bit more flexible than ISO C assert().
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
const char * name
Name of the codec implementation.
static int opt_old2new(void *optctx, const char *opt, const char *arg)
void remove_avoptions(AVDictionary **a, AVDictionary *b)
static int opt_sameq(void *optctx, const char *opt, const char *arg)
HW acceleration through VDA, data[3] contains a CVPixelBufferRef.
static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)