25#if HAVE_SYS_RESOURCE_H
27#include <sys/resource.h>
108 dst = (uint8_t*)o + po->u.off;
137 memset(o, 0,
sizeof(*o));
157 printf(
"Hardware acceleration methods:\n");
172 if (spec[0] == mediatype && !spec[1])
182 int matches = 0, match_idx = -1;
199 char namestr[128] =
"";
201 const char *optval = optval_buf;
206 for (
int i = 0; names_alt[
i];
i++)
207 av_strlcatf(namestr,
sizeof(namestr),
"/-%s", names_alt[
i]);
220 "stream %d, only the last option '-%s%s%s %s' will be used.\n",
225 return match_idx + 1;
228#define OPT_MATCH_PER_STREAM(name, type, opt_type, m) \
229void opt_match_per_stream_ ## name(void *logctx, const SpecifierOptList *sol, \
230 AVFormatContext *fc, AVStream *st, type *out) \
232 unsigned ret = opt_match_per_stream(logctx, opt_type, sol, fc, st); \
234 *out = sol->opt[ret - 1].u.m; \
246 int matches = 0, match_idx = -1;
250 for (
int i = 0;
i < sol->nb_opt;
i++) {
259 if (matches > 1 && sol->opt_canon) {
263 char namestr[128] =
"";
265 const char *optval = optval_buf;
267 snprintf(namestr,
sizeof(namestr),
"-%s", sol->opt_canon->name);
269 const char *
const *names_alt = sol->opt_canon->u1.names_alt;
270 for (
int i = 0; names_alt[
i];
i++)
271 av_strlcatf(namestr,
sizeof(namestr),
"/-%s", names_alt[
i]);
284 "stream group %d, only the last option '-%s%s%s %s' will be used.\n",
285 namestr, stg->index, sol->opt_canon->name, spec[0] ?
":" :
"",
289 return match_idx + 1;
292#define OPT_MATCH_PER_STREAM_GROUP(name, type, opt_type, m) \
293void opt_match_per_stream_group_ ## name(void *logctx, const SpecifierOptList *sol, \
294 AVFormatContext *fc, AVStreamGroup *stg, type *out) \
296 unsigned ret = opt_match_per_stream_group(logctx, opt_type, sol, fc, stg); \
298 *out = sol->opt[ret - 1].u.m; \
308 const char *spec = *pspec;
313 if (!strncmp(spec,
"view:", 5)) {
316 if (!strncmp(spec,
"all", 3)) {
321 vs->val = strtoul(spec, &endptr, 0);
322 if (endptr == spec) {
328 }
else if (!strncmp(spec,
"vidx:", 5)) {
331 vs->val = strtoul(spec, &endptr, 0);
332 if (endptr == spec) {
337 }
else if (!strncmp(spec,
"vpos:", 5)) {
379 int64_t new_start_time = INT64_MAX,
diff, abs_start_seek;
387 for (
int j = 0; j <
is->nb_streams; j++) {
394 diff = new_start_time -
is->start_time;
402 ifile->
ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
416 int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
417 int start_times_set = 1;
438 ref_start_time =
ref->ctx->start_time_realtime;
441 ref_start_time =
ref->start_time_effective;
446 if (start_times_set) {
450 adjustment = (self_start_time - ref_start_time) + !
copy_ts*(self_seek_start - ref_seek_start) +
ref->input_ts_offset;
484 const AVClass *pclass = &
class;
496 if (user_stats_period <= 0) {
531static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
536 int i, negative = 0, file_idx, disabled = 0;
537 int ret, allow_unused = 0;
539 memset(&
ss, 0,
sizeof(
ss));
549 const char *
c =
arg + 1;
567 file_idx = strtol(
arg, &endptr, 0);
576 arg =
ss.remainder ?
ss.remainder :
"";
578 if (ret < 0 || (*
arg && strcmp(
arg,
"]")))
588 file_idx = strtol(
arg, &endptr, 0);
602 arg =
ss.remainder ?
ss.remainder :
"";
609 if (!strcmp(
arg,
"?"))
613 "Trailing garbage after stream specifier: %s\n",
arg);
660 }
else if (disabled) {
662 "To ignore this, add a trailing '?' to the map.\n",
arg);
667 "To ignore this, add a trailing '?' to the map.\n",
arg);
700static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
702 const char *
prefix =
"vaapi:";
715static int opt_qsv_device(
void *optctx,
const char *opt,
const char *
arg)
717 const char *
prefix =
"qsv=__qsv_device:hw_any,child_device=";
733 if (!strcmp(
arg,
"list")) {
735 printf(
"Supported hardware device types:\n");
772 recording_timestamp /= 1e6;
773 time = *gmtime((time_t*)&recording_timestamp);
774 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
779 "tag instead.\n", opt);
787 const char *
codec_string = encoder ?
"encoder" :
"decoder";
821 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
826 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
828 fprintf(stderr,
"File '%s' already exists. Overwrite? [y/N] ", filename);
831 signal(SIGINT, SIG_DFL);
845 if (proto_name && !strcmp(proto_name,
"file")) {
850 if (!strcmp(filename, file->
ctx->
url)) {
869 p = strchr(idx_str,
':');
872 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
885 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
887 if (!strncmp(
arg,
"pal-", 4)) {
890 }
else if (!strncmp(
arg,
"ntsc-", 5)) {
893 }
else if (!strncmp(
arg,
"film-", 5)) {
910 }
else if ((fr == 29970) || (fr == 23976)) {
930 if (!strcmp(
arg,
"vcd")) {
957 }
else if (!strcmp(
arg,
"svcd")) {
979 }
else if (!strcmp(
arg,
"dvd")) {
1001 }
else if (!strncmp(
arg,
"dv", 2)) {
1007 norm == PAL ?
"yuv420p" :
"yuv411p",
options);
1034 time_t today2 = time(
NULL);
1035 struct tm *today = localtime(&today2);
1042 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
1089 char filename[1000],
line[1000], tmp_line[1000];
1090 const char *codec_name =
NULL;
1092 int depth = o->
depth;
1102 if(!strncmp(
arg,
"libx264-lossless", strlen(
"libx264-lossless"))){
1111 char *
key = tmp_line, *
value, *endptr;
1113 if (strcspn(
line,
"#\n\r") == 0)
1160 if(!strcmp(opt,
"ab")){
1163 }
else if(!strcmp(opt,
"b")){
1177 if(!strcmp(opt,
"qscale")){
1192 if(!strcmp(opt,
"profile")){
1255 int show_advanced = 0, show_avoptions = 0;
1258 if (!strcmp(opt,
"long"))
1260 else if (!strcmp(opt,
"full"))
1261 show_advanced = show_avoptions = 1;
1269 " -h -- print basic options\n"
1270 " -h long -- print more options\n"
1271 " -h full -- print all options (including all format and codec specific options, very long)\n"
1272 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1273 " See man %s for detailed description of the options.\n"
1275 "Per-stream options can be followed by :<stream_spec> to apply that option to specific streams only. "
1276 "<stream_spec> can be a stream index, or v/a/s for video/audio/subtitle (see manual for full syntax).\n"
1286 "instead of just one file):",
1355 if (show_avoptions) {
1362#if CONFIG_SWRESAMPLE
1405 "%s.\n", inout,
g->arg);
1428 const char *errmsg =
NULL;
1431 memset(&octx, 0,
sizeof(octx));
1437 errmsg =
"splitting the argument list";
1444 errmsg =
"parsing global options";
1462 errmsg =
"opening input files";
1469 errmsg =
"opening output files";
1476 errmsg =
"creating loopback decoders";
1483 errmsg =
"binding filtergraph inputs/outputs";
1511 if (!strcmp(
arg,
"-"))
1534 rl = (
struct rlimit){ lim, lim + 1 };
1535 if (setrlimit(RLIMIT_CPU, &rl))
1536 perror(
"setrlimit");
1544static const char *
const alt_codec[] = {
"c",
"acodec",
"vcodec",
"scodec",
"dcodec",
NULL };
1551#define OFFSET(x) offsetof(OptionsContext, x)
1557 "force container format (auto-detected otherwise)",
"fmt" },
1560 "overwrite output files" },
1563 "never overwrite output files" },
1566 "Ignore unknown stream types" },
1569 "Copy unknown stream types" },
1572 "allow recasting stream type in order to force a decoder of different media type" },
1574 { .off =
OFFSET(codec_names) },
1575 "select encoder/decoder ('copy' to copy stream without reencoding)",
"codec",
1576 .u1.name_canon =
"codec", },
1578 { .off =
OFFSET(codec_names) },
1579 "alias for -c (select encoder/decoder)",
"codec",
1583 "preset name",
"preset",
1587 "set input stream mapping",
1588 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1590 { .off =
OFFSET(metadata_map) },
1591 "set metadata information of outfile from infile",
1592 "outfile[,metadata]:infile[,metadata]" },
1594 { .off =
OFFSET(chapters_input_file) },
1595 "set chapters mapping",
"input_file_index" },
1597 { .off =
OFFSET(recording_time) },
1598 "stop transcoding after specified duration",
1601 { .off =
OFFSET(stop_time) },
1602 "stop transcoding after specified time is reached",
1605 { .off =
OFFSET(limit_filesize) },
1606 "set the limit file size in bytes",
"limit_size" },
1609 "start transcoding at specified time",
"time_off" },
1611 { .off =
OFFSET(start_time_eof) },
1612 "set the start time offset relative to EOF",
"time_off" },
1614 { .off =
OFFSET(seek_timestamp) },
1615 "enable/disable seeking by timestamp with -ss" },
1617 { .off =
OFFSET(accurate_seek) },
1618 "enable/disable accurate seeking with -ss" },
1620 { .off =
OFFSET(input_sync_ref) },
1621 "Indicate the input index for sync reference",
"sync ref" },
1623 { .off =
OFFSET(input_ts_offset) },
1624 "set the input ts offset",
"time_off" },
1626 { .off =
OFFSET(ts_scale) },
1627 "set the input ts scale",
"scale" },
1630 "set the recording timestamp ('now' to set the current time)",
"time" },
1633 "add metadata",
"key=value" },
1635 { .off =
OFFSET(keep_metadata) },
1636 "keep metadata key from input when re-encoding",
"key" },
1638 { .off =
OFFSET(program) },
1639 "add program with specified streams",
"title=string:st=number..." },
1641 { .off =
OFFSET(stream_groups) },
1642 "add stream group with specified streams and group type-specific arguments",
"id=number:st=number..." },
1645 "set the number of data frames to output",
"number",
1646 .u1.name_canon =
"frames" },
1649 "add timings for benchmarking" },
1652 "add timings for each task" },
1655 "write program-readable progress information",
"url" },
1658 "enable or disable interaction on standard input" },
1661 "set max runtime in seconds in CPU user time",
"limit" },
1664 "dump each input packet" },
1667 "when dumping packets, also dump the payload" },
1669 { .off =
OFFSET(rate_emu) },
1670 "read input at native frame rate; equivalent to -readrate 1",
"" },
1672 { .off =
OFFSET(readrate) },
1673 "read input at specified rate",
"speed" },
1675 { .off =
OFFSET(readrate_initial_burst) },
1676 "The initial amount of input to burst read before imposing any readrate",
"seconds" },
1678 { .off =
OFFSET(readrate_catchup) },
1679 "Temporary readrate used to catch up if an input lags behind the specified readrate",
"speed" },
1682 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1683 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
1686 "frame drop threshold",
"" },
1689 "copy timestamps" },
1692 "shift input timestamps to start at 0 when using copyts" },
1695 "copy input stream time base when stream copying",
"mode" },
1697 { .off =
OFFSET(shortest) },
1698 "finish encoding within shortest input" },
1700 { .off =
OFFSET(shortest_buf_duration) },
1701 "maximum buffering duration (in seconds) for the -shortest option" },
1703 { .off =
OFFSET(bitexact) },
1707 "timestamp discontinuity delta threshold",
"threshold" },
1710 "timestamp error delta threshold",
"threshold" },
1713 "exit on error",
"error" },
1716 "abort on the specified condition flags",
"flags" },
1718 { .off =
OFFSET(copy_initial_nonkeyframes) },
1719 "copy initial non-keyframes" },
1721 { .off =
OFFSET(copy_prior_start) },
1722 "copy or discard frames before start time" },
1724 { .off =
OFFSET(max_frames) },
1725 "set the number of frames to output",
"number",
1728 { .off =
OFFSET(codec_tags) },
1729 "force codec tag/fourcc",
"fourcc/tag",
1732 { .off =
OFFSET(qscale) },
1733 "use fixed quality scale (VBR)",
"q",
1734 .u1.name_canon =
"qscale", },
1737 "use fixed quality scale (VBR)",
"q",
1741 "set profile",
"profile" },
1744 "apply specified filters to audio/video",
"filter_graph",
1748 "number of non-complex filter threads" },
1751 "maximum number of buffered frames in a filter graph" },
1753 { .off =
OFFSET(reinit_filters) },
1754 "reinit filtergraph on input parameter changes",
"" },
1756 { .off =
OFFSET(drop_changed) },
1757 "drop frame instead of reiniting filtergraph on input parameter changes",
"" },
1760 "create a complex filtergraph",
"graph_description" },
1763 "number of threads for -filter_complex" },
1766 "create a complex filtergraph",
"graph_description" },
1769 "print execution graph data to stderr" },
1772 "write execution graph data to the specified file",
"filename" },
1775 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml, mermaid, mermaidhtml)",
"format" },
1778 "enable automatic conversion filters globally" },
1781 "print progress report during encoding", },
1784 "set the period at which ffmpeg updates stats and -progress output",
"time" },
1787 "add an attachment to the output file",
"filename" },
1790 "extract an attachment into a file",
"filename" },
1792 { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
1795 "print timestamp debugging info" },
1798 "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.",
"maximum error rate" },
1800 { .off =
OFFSET(discard) },
1803 { .off =
OFFSET(disposition) },
1804 "disposition",
"" },
1806 { .off =
OFFSET(thread_queue_size) },
1807 "set the maximum number of queued packets from the demuxer" },
1810 "read and decode the streams to fill missing information with heuristics" },
1812 { .off =
OFFSET(bits_per_raw_sample) },
1813 "set the number of bits per raw sample",
"number" },
1816 { .off =
OFFSET(enc_stats_pre) },
1817 "write encoding stats before encoding" },
1819 { .off =
OFFSET(enc_stats_post) },
1820 "write encoding stats after encoding" },
1822 { .off =
OFFSET(mux_stats) },
1823 "write packets stats before muxing" },
1825 { .off =
OFFSET(enc_stats_pre_fmt) },
1826 "format of the stats written with -stats_enc_pre" },
1828 { .off =
OFFSET(enc_stats_post_fmt) },
1829 "format of the stats written with -stats_enc_post" },
1831 { .off =
OFFSET(mux_stats_fmt) },
1832 "format of the stats written with -stats_mux_pre" },
1835 { .off =
OFFSET(enc_reinit_opts) },
1836 "List of encoder options to use to reinitialize the encoder at given timestamps",
1837 "pts1|video_size=size:g=12,pts2|video_size=size..." },
1842 "set the number of video frames to output",
"number",
1843 .u1.name_canon =
"frames", },
1845 { .off =
OFFSET(frame_rates) },
1846 "override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)",
"rate" },
1848 { .off =
OFFSET(max_frame_rates) },
1849 "set max frame rate (Hz value, fraction or abbreviation)",
"rate" },
1852 "set frame size (WxH or abbreviation)",
"size" },
1854 { .off =
OFFSET(frame_aspect_ratios) },
1855 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
1857 { .off =
OFFSET(frame_pix_fmts) },
1858 "set pixel format",
"format" },
1860 { .off =
OFFSET(display_rotations) },
1861 "set pure counter-clockwise rotation in degrees for stream(s)",
1864 { .off =
OFFSET(display_hflips) },
1865 "set display horizontal flip for stream(s) "
1866 "(overrides any display rotation if it is not set)"},
1868 { .off =
OFFSET(display_vflips) },
1869 "set display vertical flip for stream(s) "
1870 "(overrides any display rotation if it is not set)"},
1872 { .off =
OFFSET(mastering_displays) },
1873 "set SMPTE2084 mastering display color volume info" },
1875 { .off =
OFFSET(content_lights) },
1876 "set SMPTE2084 Max CLL and Max FALL values" },
1881 { .off =
OFFSET(rc_overrides) },
1882 "rate control override for specific intervals",
"override" },
1885 "alias for -c:v (select encoder/decoder for video streams)",
"codec",
1886 .u1.name_canon =
"codec", },
1889 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
1892 "select the pass number (1 to 3)",
"n" },
1894 { .off =
OFFSET(passlogfiles) },
1895 "select two pass log file name prefix",
"prefix" },
1898 "dump video coding statistics to file" },
1901 "dump video coding statistics to file",
"file" },
1904 "Version of the vstats format to use."},
1907 "alias for -filter:v (apply filters to video streams)",
"filter_graph",
1908 .u1.name_canon =
"filter", },
1910 { .off =
OFFSET(intra_matrices) },
1911 "specify intra matrix coeffs",
"matrix" },
1913 { .off =
OFFSET(inter_matrices) },
1914 "specify inter matrix coeffs",
"matrix" },
1916 { .off =
OFFSET(chroma_intra_matrices) },
1917 "specify intra matrix coeffs",
"matrix" },
1920 "force video tag/fourcc",
"fourcc/tag",
1921 .u1.name_canon =
"tag", },
1923 { .off =
OFFSET(fps_mode) },
1924 "set framerate mode for matching video streams" },
1926 { .off =
OFFSET(force_fps) },
1927 "force the selected framerate, disable the best supported framerate selection" },
1930 "set the value of an outfile streamid",
"streamIndex:value" },
1932 { .off =
OFFSET(forced_key_frames) },
1933 "force key frames at specified timestamps",
"timestamps" },
1936 "video bitrate (please use -b:v)",
"bitrate" },
1938 { .off =
OFFSET(hwaccels) },
1939 "use HW accelerated decoding",
"hwaccel name" },
1941 { .off =
OFFSET(hwaccel_devices) },
1942 "select a device for HW acceleration",
"devicename" },
1944 { .off =
OFFSET(hwaccel_output_formats) },
1945 "select output format used with HW accelerated decoding",
"format" },
1948 "show available HW acceleration methods" },
1951 "automatically insert correct rotate filters" },
1953 { .off =
OFFSET(autoscale) },
1954 "automatically insert a scale filter at the end of the filter graph" },
1957 "select the cropping to apply" },
1960 "set this video output stream to be a heartbeat stream for "
1961 "fix_sub_duration, according to which subtitles should be split at "
1962 "random access points" },
1967 "set the number of audio frames to output",
"number",
1968 .u1.name_canon =
"frames", },
1971 "set audio quality (codec-specific)",
"quality", },
1973 { .off =
OFFSET(audio_sample_rate) },
1974 "set audio sampling rate (in Hz)",
"rate" },
1977 "set number of audio channels",
"channels" },
1983 "alias for -c:a (select encoder/decoder for audio streams)",
"codec",
1984 .u1.name_canon =
"codec", },
1987 "alias for -b:a (select bitrate for audio streams)",
"bitrate" },
1993 "force audio tag/fourcc",
"fourcc/tag",
1994 .u1.name_canon =
"tag", },
1997 "set sample format",
"format" },
1999 { .off =
OFFSET(audio_ch_layouts) },
2000 "set channel layout",
"layout",
2003 { .off =
OFFSET(audio_ch_layouts) },
2004 "set channel layout",
"layout",
2005 .u1.name_canon =
"channel_layout", },
2008 "alias for -filter:a (apply filters to audio streams)",
"filter_graph",
2009 .u1.name_canon =
"filter", },
2011 { .off =
OFFSET(guess_layout_max) },
2012 "set the maximum number of channels to try to guess the channel layout" },
2017 "disable subtitle" },
2020 "alias for -c:s (select encoder/decoder for subtitle streams)",
"codec",
2021 .u1.name_canon =
"codec", },
2024 ,
"force subtitle tag/fourcc",
"fourcc/tag",
2025 .u1.name_canon =
"tag" },
2027 { .off =
OFFSET(fix_sub_duration) },
2028 "fix subtitles duration" },
2030 { .off =
OFFSET(canvas_sizes) },
2031 "set canvas size (WxH or abbreviation)",
"size" },
2035 { .off =
OFFSET(mux_max_delay) },
2036 "set the maximum demux-decode delay",
"seconds" },
2038 { .off =
OFFSET(mux_preload) },
2039 "set the initial demux-decode delay",
"seconds" },
2042 "specify a file in which to print sdp information",
"file" },
2045 { .off =
OFFSET(time_bases) },
2046 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
2048 { .off =
OFFSET(enc_time_bases) },
2049 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
2050 "two special values are defined - "
2051 "0 = use frame rate (video) or sample rate (audio),"
2052 "-1 = match source time base",
"ratio" },
2055 { .off =
OFFSET(bitstream_filters) },
2056 "A comma-separated list of bitstream filters",
"bitstream_filters", },
2060 "set the audio options to the indicated preset",
"preset",
2061 .u1.name_canon =
"pre", },
2064 "set the video options to the indicated preset",
"preset",
2065 .u1.name_canon =
"pre", },
2068 "set the subtitle options to the indicated preset",
"preset",
2069 .u1.name_canon =
"pre", },
2072 "set options from indicated preset file",
"filename",
2073 .u1.name_canon =
"pre", },
2076 { .off =
OFFSET(max_muxing_queue_size) },
2077 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
2079 { .off =
OFFSET(muxing_queue_data_threshold) },
2080 "set the threshold after which max_muxing_queue_size is taken into account",
"bytes" },
2085 "alias for -c:d (select encoder/decoder for data streams)",
"codec",
2086 .u1.name_canon =
"codec", },
2088 { .off =
OFFSET(data_disable) },
"disable data" },
2092 { .func_arg = opt_vaapi_device },
2093 "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)",
"device" },
2098 { .func_arg = opt_qsv_device },
2099 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
2104 "initialise hardware device",
"args" },
2107 "set hardware device used when filtering",
"device" },
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static enum AVSampleFormat sample_fmts[]
static const char *const format[]
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
Main libavfilter public API header.
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
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.
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
#define AVIO_FLAG_WRITE
write-only
char * av_asprintf(const char *fmt,...)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Convenience header that includes libavutil's core.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define is(width, name, range_min, range_max, subs,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define ss(width, name, subs,...)
unsigned stream_group_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStreamGroup *stg, void *logctx)
int parse_optgroup(void *optctx, OptionGroup *g, const OptionDef *defs)
Parse an options group and write results into optctx.
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.
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.
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0.
int cmdutils_isalnum(char c)
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.
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
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
AVDictionary * codec_opts
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.
unsigned stream_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStream *st, void *logctx)
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.
void stream_specifier_uninit(StreamSpecifier *ss)
const char program_name[]
program name, defined by the program for show_version().
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
#define GROW_ARRAY(array, nb_elems)
#define OPT_FLAG_PERSTREAM
static int open_file(AVFormatContext *avf, unsigned fileno)
__device__ int printf(const char *,...)
static const uint16_t fc[]
static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
AVIOContext * progress_avio
const AVIOInterruptCB int_cb
int fg_finalise_bindings(void)
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
float dts_error_threshold
@ VIEW_SPECIFIER_TYPE_ALL
@ VIEW_SPECIFIER_TYPE_POS
@ VIEW_SPECIFIER_TYPE_IDX
@ VIEW_SPECIFIER_TYPE_NONE
HWDevice * hw_device_get_by_name(const char *name)
int ignore_unknown_streams
int filter_complex_nbthreads
float frame_drop_threshold
char * print_graphs_format
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
int dec_create(const OptionsContext *o, const char *arg, Scheduler *sch)
Create a standalone decoder.
int auto_conversion_filters
HWDevice * filter_hw_device
#define ABORT_ON_FLAG_EMPTY_OUTPUT
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch, const OutputFilterOptions *opts)
Create a new filtergraph in the global filtergraph list.
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
float dts_delta_threshold
int hw_device_init_from_string(const char *arg, HWDevice **dev)
#define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM
int filter_buffered_frames
static int fix_sub_duration_heartbeat(DecoderPriv *dp, int64_t signal_pts)
static int dump_attachment(InputStream *ist, const char *filename)
static const char *const alt_tag[]
static int opt_video_filters(void *optctx, const char *opt, const char *arg)
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 int opt_data_codec(void *optctx, const char *opt, const char *arg)
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_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 int opt_map(void *optctx, const char *opt, const char *arg)
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
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 int opt_vstats_file(void *optctx, const char *opt, const char *arg)
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
static const char *const alt_filter[]
static const char *const alt_frames[]
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx)
static int opt_old2new(void *optctx, const char *opt, const char *arg)
static int no_file_overwrite
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
static int opt_progress(void *optctx, const char *opt, const char *arg)
int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
int assert_file_overwrite(const char *filename)
static int opt_video_codec(void *optctx, const char *opt, const char *arg)
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.
#define OPT_MATCH_PER_STREAM_GROUP(name, type, opt_type, m)
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
static const char *const alt_codec[]
static unsigned opt_match_per_stream(void *logctx, enum OptionType type, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st)
#define OPT_MATCH_PER_STREAM(name, type, opt_type, m)
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
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 const char *const alt_qscale[]
static int apply_sync_offsets(void)
static const char *const alt_pre[]
static void correct_input_start_times(void)
static int open_files(OptionGroupList *l, const char *inout, Scheduler *sch, int(*open_file)(const OptionsContext *, const char *, Scheduler *))
static int opt_target(void *optctx, const char *opt, const char *arg)
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 int opt_stats_period(void *optctx, const char *opt, const char *arg)
static int opt_vstats(void *optctx, const char *opt, const char *arg)
static unsigned opt_match_per_stream_group(void *logctx, enum OptionType type, const SpecifierOptList *sol, AVFormatContext *fc, AVStreamGroup *stg)
static const char *const alt_channel_layout[]
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_attach(void *optctx, const char *opt, const char *arg)
static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **pcodec)
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 const OptionGroupDef groups[]
int sch_sdp_filename(Scheduler *sch, const char *sdp_filename)
Set the file path for the SDP.
static int find_stream_info
static int subtitle_disable
static int64_t start_time
#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.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
@ AVDISCARD_ALL
discard all
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
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.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
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 AVERROR_DECODER_NOT_FOUND
Decoder not found.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#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.
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_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
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_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
Memory handling functions.
#define CMDUTILS_COMMON_OPTIONS
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
static const uint8_t frame_sizes[]
#define FF_ARRAY_ELEMS(a)
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...
This struct describes the properties of a single codec described by an AVCodecID.
enum AVMediaType codec_type
General type of the encoded data.
const char * name
Name of the codec implementation.
char * url
input or output URL.
const struct AVInputFormat * iformat
The input container format.
int64_t start_time_realtime
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January ...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
const char *const * names_alt
union OptionDef::@302341376237271032103161277113207234376351006005 u1
A list of option groups that all have the same group type (e.g.
AVDictionary * codec_opts
AVDictionary * format_opts
SpecifierOptList codec_names
float shortest_buf_duration
const char ** attachments
const struct OptionDef * opt_canon
StreamSpecifier stream_spec
union SpecifierOpt::@356325016025214271156003270003007057215065005026 u
static int ref[MAX_W *MAX_W]
static AVFormatContext * ctx
static AVDictionary * opts
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
static const Preset presets[]