Go to the documentation of this file.
25 #if HAVE_SYS_RESOURCE_H
27 #include <sys/resource.h>
107 dst = (uint8_t*)o + po->u.off;
136 memset(o, 0,
sizeof(*o));
156 printf(
"Hardware acceleration methods:\n");
171 if (spec[0] == mediatype && !spec[1])
181 int matches = 0, match_idx = -1;
198 char namestr[128] =
"";
200 const char *optval = optval_buf;
205 for (
int i = 0; names_alt[
i];
i++)
206 av_strlcatf(namestr,
sizeof(namestr),
"/-%s", names_alt[
i]);
219 "stream %d, only the last option '-%s%s%s %s' will be used.\n",
224 return match_idx + 1;
227 #define OPT_MATCH_PER_STREAM(name, type, opt_type, m) \
228 void opt_match_per_stream_ ## name(void *logctx, const SpecifierOptList *sol, \
229 AVFormatContext *fc, AVStream *st, type *out) \
231 unsigned ret = opt_match_per_stream(logctx, opt_type, sol, fc, st); \
233 *out = sol->opt[ret - 1].u.m; \
243 const char *spec = *pspec;
248 if (!strncmp(spec,
"view:", 5)) {
251 if (!strncmp(spec,
"all", 3)) {
256 vs->
val = strtoul(spec, &endptr, 0);
257 if (endptr == spec) {
263 }
else if (!strncmp(spec,
"vidx:", 5)) {
266 vs->
val = strtoul(spec, &endptr, 0);
267 if (endptr == spec) {
272 }
else if (!strncmp(spec,
"vpos:", 5)) {
299 #if FFMPEG_OPT_VSYNC_DROP
306 else if (!is_global) {
322 " use a string argument as described in the manual.\n");
335 int64_t new_start_time = INT64_MAX,
diff, abs_start_seek;
343 for (
int j = 0; j <
is->nb_streams; j++) {
350 diff = new_start_time -
is->start_time;
358 ifile->
ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
372 int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
373 int start_times_set = 1;
375 if (self->input_sync_ref == -1 || self->input_sync_ref ==
i)
continue;
376 if (self->input_sync_ref >=
nb_input_files || self->input_sync_ref < -1) {
377 av_log(
NULL,
AV_LOG_FATAL,
"-isync for input %d references non-existent input %d.\n",
i, self->input_sync_ref);
387 if (
ref->input_sync_ref != -1 &&
ref->input_sync_ref != self->input_sync_ref) {
388 av_log(
NULL,
AV_LOG_ERROR,
"-isync for input %d references a resynced input %d. Sync not set.\n",
i, self->input_sync_ref);
393 self_start_time =
self->ctx->start_time_realtime;
394 ref_start_time =
ref->ctx->start_time_realtime;
396 self_start_time =
self->start_time_effective;
397 ref_start_time =
ref->start_time_effective;
402 if (start_times_set) {
403 self_seek_start =
self->start_time ==
AV_NOPTS_VALUE ? 0 :
self->start_time;
406 adjustment = (self_start_time - ref_start_time) + !
copy_ts*(self_seek_start - ref_seek_start) +
ref->input_ts_offset;
408 self->ts_offset += adjustment;
410 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);
412 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);
440 const AVClass *pclass = &
class;
452 if (user_stats_period <= 0) {
487 static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
492 int i, negative = 0, file_idx, disabled = 0;
493 int ret, allow_unused = 0;
495 memset(&
ss, 0,
sizeof(
ss));
504 const char *
c =
arg + 1;
521 file_idx = strtol(
arg, &endptr, 0);
535 arg =
ss.remainder ?
ss.remainder :
"";
542 if (!strcmp(
arg,
"?"))
546 "Trailing garbage after stream specifier: %s\n",
arg);
589 }
else if (disabled) {
591 "To ignore this, add a trailing '?' to the map.\n",
arg);
596 "To ignore this, add a trailing '?' to the map.\n",
arg);
628 static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
630 const char *prefix =
"vaapi:";
643 static int opt_qsv_device(
void *optctx,
const char *opt,
const char *
arg)
645 const char *prefix =
"qsv=__qsv_device:hw_any,child_device=";
661 if (!strcmp(
arg,
"list")) {
663 printf(
"Supported hardware device types:\n");
700 recording_timestamp /= 1e6;
701 time = *gmtime((time_t*)&recording_timestamp);
702 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
707 "tag instead.\n", opt);
715 const char *
codec_string = encoder ?
"encoder" :
"decoder";
749 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
754 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
756 fprintf(stderr,
"File '%s' already exists. Overwrite? [y/N] ", filename);
759 signal(SIGINT, SIG_DFL);
773 if (proto_name && !strcmp(proto_name,
"file")) {
778 if (!strcmp(filename, file->
ctx->
url)) {
797 p = strchr(idx_str,
':');
800 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
813 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
815 if (!strncmp(
arg,
"pal-", 4)) {
818 }
else if (!strncmp(
arg,
"ntsc-", 5)) {
821 }
else if (!strncmp(
arg,
"film-", 5)) {
838 }
else if ((fr == 29970) || (fr == 23976)) {
858 if (!strcmp(
arg,
"vcd")) {
885 }
else if (!strcmp(
arg,
"svcd")) {
907 }
else if (!strcmp(
arg,
"dvd")) {
929 }
else if (!strncmp(
arg,
"dv", 2)) {
935 norm ==
PAL ?
"yuv420p" :
"yuv411p",
options);
962 time_t today2 = time(
NULL);
963 struct tm *today = localtime(&today2);
970 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
1017 char filename[1000],
line[1000], tmp_line[1000];
1018 const char *codec_name =
NULL;
1024 if(!strncmp(
arg,
"libx264-lossless", strlen(
"libx264-lossless"))){
1032 char *
key = tmp_line, *
value, *endptr;
1034 if (strcspn(
line,
"#\n\r") == 0)
1079 if(!strcmp(opt,
"ab")){
1082 }
else if(!strcmp(opt,
"b")){
1096 if(!strcmp(opt,
"qscale")){
1111 if(!strcmp(opt,
"profile")){
1132 #if FFMPEG_OPT_VSYNC
1180 #if FFMPEG_OPT_FILTER_SCRIPT
1207 int show_advanced = 0, show_avoptions = 0;
1210 if (!strcmp(opt,
"long"))
1212 else if (!strcmp(opt,
"full"))
1213 show_advanced = show_avoptions = 1;
1221 " -h -- print basic options\n"
1222 " -h long -- print more options\n"
1223 " -h full -- print all options (including all format and codec specific options, very long)\n"
1224 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1225 " See man %s for detailed description of the options.\n"
1227 "Per-stream options can be followed by :<stream_spec> to apply that option to specific streams only. "
1228 "<stream_spec> can be a stream index, or v/a/s for video/audio/subtitle (see manual for full syntax).\n"
1238 "instead of just one file):",
1307 if (show_avoptions) {
1314 #if CONFIG_SWRESAMPLE
1337 [GROUP_INFILE] = {
"input url",
"i",
OPT_INPUT },
1338 [GROUP_DECODER] = {
"loopback decoder",
"dec",
OPT_DECODER },
1357 "%s.\n", inout,
g->arg);
1380 const char *errmsg =
NULL;
1383 memset(&octx, 0,
sizeof(octx));
1389 errmsg =
"splitting the argument list";
1396 errmsg =
"parsing global options";
1414 errmsg =
"opening input files";
1421 errmsg =
"opening output files";
1428 errmsg =
"creating loopback decoders";
1435 errmsg =
"binding filtergraph inputs/outputs";
1458 static int opt_progress(
void *optctx,
const char *opt,
const char *
arg)
1463 if (!strcmp(
arg,
"-"))
1486 rl = (
struct rlimit){ lim, lim + 1 };
1487 if (setrlimit(RLIMIT_CPU, &rl))
1488 perror(
"setrlimit");
1495 #if FFMPEG_OPT_QPHIST
1496 static int opt_qphist(
void *optctx,
const char *opt,
const char *
arg)
1503 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1504 static int opt_adrift_threshold(
void *optctx,
const char *opt,
const char *
arg)
1511 static const char *
const alt_bsf[] = {
"absf",
"vbsf",
NULL };
1512 static const char *
const alt_channel_layout[] = {
"ch_layout",
NULL};
1513 static const char *
const alt_codec[] = {
"c",
"acodec",
"vcodec",
"scodec",
"dcodec",
NULL };
1514 static const char *
const alt_filter[] = {
"af",
"vf",
NULL };
1515 static const char *
const alt_frames[] = {
"aframes",
"vframes",
"dframes",
NULL };
1516 static const char *
const alt_pre[] = {
"apre",
"vpre",
"spre",
NULL};
1517 static const char *
const alt_qscale[] = {
"q",
NULL};
1518 static const char *
const alt_tag[] = {
"atag",
"vtag",
"stag",
NULL };
1520 #define OFFSET(x) offsetof(OptionsContext, x)
1526 "force container format (auto-detected otherwise)",
"fmt" },
1529 "overwrite output files" },
1532 "never overwrite output files" },
1535 "Ignore unknown stream types" },
1538 "Copy unknown stream types" },
1541 "allow recasting stream type in order to force a decoder of different media type" },
1543 { .off =
OFFSET(codec_names) },
1544 "select encoder/decoder ('copy' to copy stream without reencoding)",
"codec",
1545 .u1.name_canon =
"codec", },
1547 { .off =
OFFSET(codec_names) },
1548 "alias for -c (select encoder/decoder)",
"codec",
1549 .u1.names_alt = alt_codec, },
1552 "preset name",
"preset",
1553 .u1.names_alt = alt_pre, },
1556 "set input stream mapping",
1557 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1559 { .off =
OFFSET(metadata_map) },
1560 "set metadata information of outfile from infile",
1561 "outfile[,metadata]:infile[,metadata]" },
1563 { .off =
OFFSET(chapters_input_file) },
1564 "set chapters mapping",
"input_file_index" },
1566 { .off =
OFFSET(recording_time) },
1567 "stop transcoding after specified duration",
1570 { .off =
OFFSET(stop_time) },
1571 "stop transcoding after specified time is reached",
1574 { .off =
OFFSET(limit_filesize) },
1575 "set the limit file size in bytes",
"limit_size" },
1578 "start transcoding at specified time",
"time_off" },
1580 { .off =
OFFSET(start_time_eof) },
1581 "set the start time offset relative to EOF",
"time_off" },
1583 { .off =
OFFSET(seek_timestamp) },
1584 "enable/disable seeking by timestamp with -ss" },
1586 { .off =
OFFSET(accurate_seek) },
1587 "enable/disable accurate seeking with -ss" },
1589 { .off =
OFFSET(input_sync_ref) },
1590 "Indicate the input index for sync reference",
"sync ref" },
1592 { .off =
OFFSET(input_ts_offset) },
1593 "set the input ts offset",
"time_off" },
1595 { .off =
OFFSET(ts_scale) },
1596 "set the input ts scale",
"scale" },
1599 "set the recording timestamp ('now' to set the current time)",
"time" },
1601 { .off =
OFFSET(metadata) },
1602 "add metadata",
"key=value" },
1605 "add program with specified streams",
"title=string:st=number..." },
1607 { .off =
OFFSET(stream_groups) },
1608 "add stream group with specified streams and group type-specific arguments",
"id=number:st=number..." },
1611 "set the number of data frames to output",
"number",
1612 .u1.name_canon =
"frames" },
1615 "add timings for benchmarking" },
1618 "add timings for each task" },
1620 { .func_arg = opt_progress },
1621 "write program-readable progress information",
"url" },
1624 "enable or disable interaction on standard input" },
1627 "set max runtime in seconds in CPU user time",
"limit" },
1630 "dump each input packet" },
1633 "when dumping packets, also dump the payload" },
1635 { .off =
OFFSET(rate_emu) },
1636 "read input at native frame rate; equivalent to -readrate 1",
"" },
1638 { .off =
OFFSET(readrate) },
1639 "read input at specified rate",
"speed" },
1641 { .off =
OFFSET(readrate_initial_burst) },
1642 "The initial amount of input to burst read before imposing any readrate",
"seconds" },
1645 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1646 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
1649 "frame drop threshold",
"" },
1652 "copy timestamps" },
1655 "shift input timestamps to start at 0 when using copyts" },
1658 "copy input stream time base when stream copying",
"mode" },
1660 { .off =
OFFSET(shortest) },
1661 "finish encoding within shortest input" },
1663 { .off =
OFFSET(shortest_buf_duration) },
1664 "maximum buffering duration (in seconds) for the -shortest option" },
1666 { .off =
OFFSET(bitexact) },
1670 "timestamp discontinuity delta threshold",
"threshold" },
1673 "timestamp error delta threshold",
"threshold" },
1676 "exit on error",
"error" },
1679 "abort on the specified condition flags",
"flags" },
1681 { .off =
OFFSET(copy_initial_nonkeyframes) },
1682 "copy initial non-keyframes" },
1684 { .off =
OFFSET(copy_prior_start) },
1685 "copy or discard frames before start time" },
1687 { .off =
OFFSET(max_frames) },
1688 "set the number of frames to output",
"number",
1689 .u1.names_alt = alt_frames, },
1691 { .off =
OFFSET(codec_tags) },
1692 "force codec tag/fourcc",
"fourcc/tag",
1693 .u1.names_alt = alt_tag, },
1695 { .off =
OFFSET(qscale) },
1696 "use fixed quality scale (VBR)",
"q",
1697 .u1.name_canon =
"qscale", },
1700 "use fixed quality scale (VBR)",
"q",
1701 .u1.names_alt = alt_qscale, },
1704 "set profile",
"profile" },
1707 "apply specified filters to audio/video",
"filter_graph",
1708 .u1.names_alt = alt_filter, },
1711 "number of non-complex filter threads" },
1712 #if FFMPEG_OPT_FILTER_SCRIPT
1714 { .off =
OFFSET(filter_scripts) },
1715 "deprecated, use -/filter",
"filename" },
1718 { .off =
OFFSET(reinit_filters) },
1719 "reinit filtergraph on input parameter changes",
"" },
1722 "create a complex filtergraph",
"graph_description" },
1725 "number of threads for -filter_complex" },
1728 "create a complex filtergraph",
"graph_description" },
1729 #if FFMPEG_OPT_FILTER_SCRIPT
1732 "deprecated, use -/filter_complex instead",
"filename" },
1736 "enable automatic conversion filters globally" },
1739 "print progress report during encoding", },
1742 "set the period at which ffmpeg updates stats and -progress output",
"time" },
1745 "add an attachment to the output file",
"filename" },
1748 "extract an attachment into a file",
"filename" },
1750 { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
1753 "print timestamp debugging info" },
1756 "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.",
"maximum error rate" },
1758 { .off =
OFFSET(discard) },
1761 { .off =
OFFSET(disposition) },
1762 "disposition",
"" },
1764 { .off =
OFFSET(thread_queue_size) },
1765 "set the maximum number of queued packets from the demuxer" },
1768 "read and decode the streams to fill missing information with heuristics" },
1770 { .off =
OFFSET(bits_per_raw_sample) },
1771 "set the number of bits per raw sample",
"number" },
1774 { .off =
OFFSET(enc_stats_pre) },
1775 "write encoding stats before encoding" },
1777 { .off =
OFFSET(enc_stats_post) },
1778 "write encoding stats after encoding" },
1780 { .off =
OFFSET(mux_stats) },
1781 "write packets stats before muxing" },
1783 { .off =
OFFSET(enc_stats_pre_fmt) },
1784 "format of the stats written with -stats_enc_pre" },
1786 { .off =
OFFSET(enc_stats_post_fmt) },
1787 "format of the stats written with -stats_enc_post" },
1789 { .off =
OFFSET(mux_stats_fmt) },
1790 "format of the stats written with -stats_mux_pre" },
1795 "set the number of video frames to output",
"number",
1796 .u1.name_canon =
"frames", },
1798 { .off =
OFFSET(frame_rates) },
1799 "override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)",
"rate" },
1801 { .off =
OFFSET(max_frame_rates) },
1802 "set max frame rate (Hz value, fraction or abbreviation)",
"rate" },
1805 "set frame size (WxH or abbreviation)",
"size" },
1807 { .off =
OFFSET(frame_aspect_ratios) },
1808 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
1810 { .off =
OFFSET(frame_pix_fmts) },
1811 "set pixel format",
"format" },
1813 { .off =
OFFSET(display_rotations) },
1814 "set pure counter-clockwise rotation in degrees for stream(s)",
1817 { .off =
OFFSET(display_hflips) },
1818 "set display horizontal flip for stream(s) "
1819 "(overrides any display rotation if it is not set)"},
1821 { .off =
OFFSET(display_vflips) },
1822 "set display vertical flip for stream(s) "
1823 "(overrides any display rotation if it is not set)"},
1828 { .off =
OFFSET(rc_overrides) },
1829 "rate control override for specific intervals",
"override" },
1832 "alias for -c:v (select encoder/decoder for video streams)",
"codec",
1833 .u1.name_canon =
"codec", },
1836 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
1839 "select the pass number (1 to 3)",
"n" },
1841 { .off =
OFFSET(passlogfiles) },
1842 "select two pass log file name prefix",
"prefix" },
1845 "dump video coding statistics to file" },
1848 "dump video coding statistics to file",
"file" },
1851 "Version of the vstats format to use."},
1854 "alias for -filter:v (apply filters to video streams)",
"filter_graph",
1855 .u1.name_canon =
"filter", },
1857 { .off =
OFFSET(intra_matrices) },
1858 "specify intra matrix coeffs",
"matrix" },
1860 { .off =
OFFSET(inter_matrices) },
1861 "specify inter matrix coeffs",
"matrix" },
1863 { .off =
OFFSET(chroma_intra_matrices) },
1864 "specify intra matrix coeffs",
"matrix" },
1867 "force video tag/fourcc",
"fourcc/tag",
1868 .u1.name_canon =
"tag", },
1870 { .off =
OFFSET(fps_mode) },
1871 "set framerate mode for matching video streams; overrides vsync" },
1873 { .off =
OFFSET(force_fps) },
1874 "force the selected framerate, disable the best supported framerate selection" },
1877 "set the value of an outfile streamid",
"streamIndex:value" },
1879 { .off =
OFFSET(forced_key_frames) },
1880 "force key frames at specified timestamps",
"timestamps" },
1883 "video bitrate (please use -b:v)",
"bitrate" },
1885 { .off =
OFFSET(hwaccels) },
1886 "use HW accelerated decoding",
"hwaccel name" },
1888 { .off =
OFFSET(hwaccel_devices) },
1889 "select a device for HW acceleration",
"devicename" },
1891 { .off =
OFFSET(hwaccel_output_formats) },
1892 "select output format used with HW accelerated decoding",
"format" },
1895 "show available HW acceleration methods" },
1898 "automatically insert correct rotate filters" },
1900 { .off =
OFFSET(autoscale) },
1901 "automatically insert a scale filter at the end of the filter graph" },
1904 "select the cropping to apply" },
1907 "set this video output stream to be a heartbeat stream for "
1908 "fix_sub_duration, according to which subtitles should be split at "
1909 "random access points" },
1914 "set the number of audio frames to output",
"number",
1915 .u1.name_canon =
"frames", },
1918 "set audio quality (codec-specific)",
"quality", },
1920 { .off =
OFFSET(audio_sample_rate) },
1921 "set audio sampling rate (in Hz)",
"rate" },
1924 "set number of audio channels",
"channels" },
1930 "alias for -c:a (select encoder/decoder for audio streams)",
"codec",
1931 .u1.name_canon =
"codec", },
1934 "alias for -b:a (select bitrate for audio streams)",
"bitrate" },
1940 "force audio tag/fourcc",
"fourcc/tag",
1941 .u1.name_canon =
"tag", },
1944 "set sample format",
"format" },
1946 { .off =
OFFSET(audio_ch_layouts) },
1947 "set channel layout",
"layout",
1948 .u1.names_alt = alt_channel_layout, },
1950 { .off =
OFFSET(audio_ch_layouts) },
1951 "set channel layout",
"layout",
1952 .u1.name_canon =
"channel_layout", },
1955 "alias for -filter:a (apply filters to audio streams)",
"filter_graph",
1956 .u1.name_canon =
"filter", },
1958 { .off =
OFFSET(guess_layout_max) },
1959 "set the maximum number of channels to try to guess the channel layout" },
1964 "disable subtitle" },
1967 "alias for -c:s (select encoder/decoder for subtitle streams)",
"codec",
1968 .u1.name_canon =
"codec", },
1971 ,
"force subtitle tag/fourcc",
"fourcc/tag",
1972 .u1.name_canon =
"tag" },
1974 { .off =
OFFSET(fix_sub_duration) },
1975 "fix subtitles duration" },
1977 { .off =
OFFSET(canvas_sizes) },
1978 "set canvas size (WxH or abbreviation)",
"size" },
1982 { .off =
OFFSET(mux_max_delay) },
1983 "set the maximum demux-decode delay",
"seconds" },
1985 { .off =
OFFSET(mux_preload) },
1986 "set the initial demux-decode delay",
"seconds" },
1989 "specify a file in which to print sdp information",
"file" },
1992 { .off =
OFFSET(time_bases) },
1993 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
1995 { .off =
OFFSET(enc_time_bases) },
1996 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
1997 "two special values are defined - "
1998 "0 = use frame rate (video) or sample rate (audio),"
1999 "-1 = match source time base",
"ratio" },
2002 { .off =
OFFSET(bitstream_filters) },
2003 "A comma-separated list of bitstream filters",
"bitstream_filters", },
2007 "set the audio options to the indicated preset",
"preset",
2008 .u1.name_canon =
"pre", },
2011 "set the video options to the indicated preset",
"preset",
2012 .u1.name_canon =
"pre", },
2015 "set the subtitle options to the indicated preset",
"preset",
2016 .u1.name_canon =
"pre", },
2019 "set options from indicated preset file",
"filename",
2020 .u1.name_canon =
"pre", },
2023 { .off =
OFFSET(max_muxing_queue_size) },
2024 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
2026 { .off =
OFFSET(muxing_queue_data_threshold) },
2027 "set the threshold after which max_muxing_queue_size is taken into account",
"bytes" },
2032 "alias for -c:d (select encoder/decoder for data streams)",
"codec",
2033 .u1.name_canon =
"codec", },
2035 { .off =
OFFSET(data_disable) },
"disable data" },
2039 { .func_arg = opt_vaapi_device },
2040 "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)",
"device" },
2045 { .func_arg = opt_qsv_device },
2046 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
2051 "initialise hardware device",
"args" },
2054 "set hardware device used when filtering",
"device" },
2057 #if FFMPEG_OPT_ADRIFT_THRESHOLD
2059 { .func_arg = opt_adrift_threshold },
2060 "deprecated, does nothing",
"threshold" },
2064 { .off =
OFFSET(top_field_first) },
2065 "deprecated, use the setfield video filter",
"" },
2067 #if FFMPEG_OPT_QPHIST
2069 { .func_arg = opt_qphist },
2070 "deprecated, does nothing" },
2072 #if FFMPEG_OPT_VSYNC
2075 "set video sync method globally; deprecated, use -fps_mode",
"" },
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
static int fix_sub_duration_heartbeat(DecoderPriv *dp, int64_t signal_pts)
#define AV_LOG_WARNING
Something somehow does not look correct.
int ignore_unknown_streams
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
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
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
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
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
int assert_file_overwrite(const char *filename)
enum AVMediaType codec_type
General type of the encoded data.
static int opt_video_filters(void *optctx, const char *opt, const char *arg)
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
The official guide to swscale for confused that is
static enum AVSampleFormat sample_fmts[]
static int opt_old2new(void *optctx, const char *opt, const char *arg)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int stream_specifier_parse(StreamSpecifier *ss, const char *spec, int allow_remainder, void *logctx)
Parse a stream specifier string into a form suitable for matching.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
char * av_asprintf(const char *fmt,...)
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
const char program_name[]
program name, defined by the program for show_version().
static int no_file_overwrite
static int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
int auto_conversion_filters
static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
AVStream ** streams
A list of all streams in the file.
int parse_number(const char *context, const char *numstr, enum OptionType type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
AVDictionary * format_opts
HWDevice * filter_hw_device
#define AV_LOG_VERBOSE
Detailed information.
AVIOContext * progress_avio
static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
Create a new filtergraph in the global filtergraph list.
#define fc(width, name, range_min, range_max)
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
int hw_device_init_from_string(const char *arg, HWDevice **dev)
@ VIEW_SPECIFIER_TYPE_ALL
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static int subtitle_disable
void stream_specifier_uninit(StreamSpecifier *ss)
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
A list of option groups that all have the same group type (e.g.
static void uninit_options(OptionsContext *o)
static const Preset presets[]
static int opt_timecode(void *optctx, const char *opt, const char *arg)
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
@ VIEW_SPECIFIER_TYPE_POS
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
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
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
#define ss(width, name, subs,...)
static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM
AVDictionary * codec_opts
static int opt_attach(void *optctx, const char *opt, const char *arg)
static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
This struct describes the properties of a single codec described by an AVCodecID.
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.
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
const struct AVInputFormat * iformat
The input container format.
@ VIEW_SPECIFIER_TYPE_NONE
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().
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static unsigned opt_match_per_stream(void *logctx, enum OptionType type, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st)
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
static int opt_video_frames(void *optctx, const char *opt, const char *arg)
#define AV_OPT_FLAG_BSF_PARAM
A generic parameter which can be set by the user for bit stream filtering.
int sch_sdp_filename(Scheduler *sch, const char *sdp_filename)
Set the file path for the SDP.
@ AVDISCARD_ALL
discard all
AVDictionary * format_opts
static int opt_target(void *optctx, const char *opt, const char *arg)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int open_file(AVFormatContext *avf, unsigned fileno)
static int opt_profile(void *optctx, const char *opt, const char *arg)
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
int dec_create(const OptionsContext *o, const char *arg, Scheduler *sch)
Create a standalone decoder.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
const char * av_default_item_name(void *ptr)
Return the context name.
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
unsigned stream_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStream *st, void *logctx)
static void correct_input_start_times(void)
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
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
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
static int opt_streamid(void *optctx, const char *opt, const char *arg)
char * file_read(const char *filename)
static int opt_preset(void *optctx, const char *opt, const char *arg)
static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
AVDictionary * codec_opts
const OptionDef options[]
static int opt_bitrate(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 const uint8_t frame_sizes[]
static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int opt_map(void *optctx, const char *opt, const char *arg)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int64_t start_time
char * url
input or output URL.
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.
static int file_overwrite
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
printf("static const uint8_t my_array[100] = {\n")
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
int fg_finalise_bindings(void)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
static int opt_data_codec(void *optctx, const char *opt, const char *arg)
static void init_options(OptionsContext *o)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
enum VideoSyncMethod video_sync_method
#define AV_LOG_INFO
Standard information.
static int apply_sync_offsets(void)
#define i(width, name, range_min, range_max)
SpecifierOptList codec_names
float shortest_buf_duration
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)
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
#define AV_OPT_FLAG_VIDEO_PARAM
static int opt_vstats(void *optctx, const char *opt, const char *arg)
const char * name
Name of the codec implementation.
float dts_error_threshold
int cmdutils_isalnum(char c)
const AVIOInterruptCB int_cb
static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
const struct OptionDef * opt_canon
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **pcodec)
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
@ VIEW_SPECIFIER_TYPE_IDX
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
StreamSpecifier stream_spec
static int find_stream_info
#define CMDUTILS_COMMON_OPTIONS
int index
stream index in AVFormatContext
#define OPT_FLAG_PERSTREAM
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
float audio_drift_threshold
const char *const * names_alt
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
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...
static int ref[MAX_W *MAX_W]
int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
#define GROW_ARRAY(array, nb_elems)
static int opt_vsync(void *optctx, const char *opt, const char *arg)
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
Parse an options group and write results into optctx.
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
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.
char * av_strdup(const char *s)
Duplicate a string.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
enum ViewSpecifierType type
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
const char ** attachments
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
float frame_drop_threshold
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
#define flags(name, subs,...)
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.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
#define OPT_MATCH_PER_STREAM(name, type, opt_type, m)
HWDevice * hw_device_get_by_name(const char *name)
const AVClass * avfilter_get_class(void)
static int dump_attachment(InputStream *ist, const char *filename)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
#define ABORT_ON_FLAG_EMPTY_OUTPUT
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
float dts_delta_threshold
int filter_complex_nbthreads