Go to the documentation of this file.
25 #if HAVE_SYS_RESOURCE_H
27 #include <sys/resource.h>
106 dst = (uint8_t*)o + po->u.off;
133 memset(o, 0,
sizeof(*o));
153 printf(
"Hardware acceleration methods:\n");
168 char *p = strchr(e->
key,
':');
186 if (spec[0] == mediatype && !spec[1])
197 #if FFMPEG_OPT_VSYNC_DROP
204 else if (!is_global) {
220 " use a string argument as described in the manual.\n");
233 int64_t new_start_time = INT64_MAX,
diff, abs_start_seek;
241 for (
int j = 0; j <
is->nb_streams; j++) {
248 diff = new_start_time -
is->start_time;
256 ifile->
ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
270 int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
271 int start_times_set = 1;
273 if (self->input_sync_ref == -1 || self->input_sync_ref ==
i)
continue;
274 if (self->input_sync_ref >=
nb_input_files || self->input_sync_ref < -1) {
275 av_log(
NULL,
AV_LOG_FATAL,
"-isync for input %d references non-existent input %d.\n",
i, self->input_sync_ref);
285 if (
ref->input_sync_ref != -1 &&
ref->input_sync_ref != self->input_sync_ref) {
286 av_log(
NULL,
AV_LOG_ERROR,
"-isync for input %d references a resynced input %d. Sync not set.\n",
i, self->input_sync_ref);
291 self_start_time =
self->ctx->start_time_realtime;
292 ref_start_time =
ref->ctx->start_time_realtime;
294 self_start_time =
self->start_time_effective;
295 ref_start_time =
ref->start_time_effective;
300 if (start_times_set) {
301 self_seek_start =
self->start_time ==
AV_NOPTS_VALUE ? 0 :
self->start_time;
304 adjustment = (self_start_time - ref_start_time) + !
copy_ts*(self_seek_start - ref_seek_start) +
ref->input_ts_offset;
306 self->ts_offset += adjustment;
308 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);
310 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);
338 const AVClass *pclass = &
class;
350 if (user_stats_period <= 0) {
385 static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
389 int i, negative = 0, file_idx, disabled = 0;
404 const char *
c =
map + 1;
418 if (allow_unused = strchr(
map,
'?'))
420 file_idx = strtol(
map, &p, 0);
433 *p ==
':' ? p + 1 : p) > 0)
439 *p ==
':' ? p + 1 : p) <= 0)
459 }
else if (disabled) {
461 "To ignore this, add a trailing '?' to the map.\n",
arg);
466 "To ignore this, add a trailing '?' to the map.\n",
arg);
498 static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
500 const char *prefix =
"vaapi:";
513 static int opt_qsv_device(
void *optctx,
const char *opt,
const char *
arg)
515 const char *prefix =
"qsv=__qsv_device:hw_any,child_device=";
531 if (!strcmp(
arg,
"list")) {
533 printf(
"Supported hardware device types:\n");
570 recording_timestamp /= 1e6;
571 time = *gmtime((time_t*)&recording_timestamp);
572 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
577 "tag instead.\n", opt);
585 const char *
codec_string = encoder ?
"encoder" :
"decoder";
619 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
624 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
626 fprintf(stderr,
"File '%s' already exists. Overwrite? [y/N] ", filename);
629 signal(SIGINT, SIG_DFL);
643 if (proto_name && !strcmp(proto_name,
"file")) {
648 if (!strcmp(filename, file->
ctx->
url)) {
667 p = strchr(idx_str,
':');
670 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
683 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
685 if (!strncmp(
arg,
"pal-", 4)) {
688 }
else if (!strncmp(
arg,
"ntsc-", 5)) {
691 }
else if (!strncmp(
arg,
"film-", 5)) {
708 }
else if ((fr == 29970) || (fr == 23976)) {
728 if (!strcmp(
arg,
"vcd")) {
755 }
else if (!strcmp(
arg,
"svcd")) {
777 }
else if (!strcmp(
arg,
"dvd")) {
799 }
else if (!strncmp(
arg,
"dv", 2)) {
805 norm ==
PAL ?
"yuv420p" :
"yuv411p",
options);
832 time_t today2 = time(
NULL);
833 struct tm *today = localtime(&today2);
840 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
887 char filename[1000],
line[1000], tmp_line[1000];
888 const char *codec_name =
NULL;
894 if(!strncmp(
arg,
"libx264-lossless", strlen(
"libx264-lossless"))){
902 char *
key = tmp_line, *
value, *endptr;
904 if (strcspn(
line,
"#\n\r") == 0)
949 if(!strcmp(opt,
"ab")){
952 }
else if(!strcmp(opt,
"b")){
966 if(!strcmp(opt,
"qscale")){
981 if(!strcmp(opt,
"profile")){
1002 #if FFMPEG_OPT_VSYNC
1040 #if FFMPEG_OPT_FILTER_SCRIPT
1057 int show_advanced = 0, show_avoptions = 0;
1060 if (!strcmp(opt,
"long"))
1062 else if (!strcmp(opt,
"full"))
1063 show_advanced = show_avoptions = 1;
1071 " -h -- print basic options\n"
1072 " -h long -- print more options\n"
1073 " -h full -- print all options (including all format and codec specific options, very long)\n"
1074 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1075 " See man %s for detailed description of the options.\n"
1077 "Per-stream options can be followed by :<stream_spec> to apply that option to specific streams only. "
1078 "<stream_spec> can be a stream index, or v/a/s for video/audio/subtitle (see manual for full syntax).\n"
1088 "instead of just one file):",
1157 if (show_avoptions) {
1164 #if CONFIG_SWRESAMPLE
1187 [GROUP_INFILE] = {
"input url",
"i",
OPT_INPUT },
1188 [GROUP_DECODER] = {
"loopback decoder",
"dec",
OPT_DECODER },
1207 "%s.\n", inout,
g->arg);
1229 const char *errmsg =
NULL;
1232 memset(&octx, 0,
sizeof(octx));
1238 errmsg =
"splitting the argument list";
1245 errmsg =
"parsing global options";
1255 errmsg =
"opening input files";
1262 errmsg =
"opening output files";
1269 errmsg =
"creating loopback decoders";
1277 errmsg =
"binding filtergraph inputs/outputs";
1297 static int opt_progress(
void *optctx,
const char *opt,
const char *
arg)
1302 if (!strcmp(
arg,
"-"))
1325 rl = (
struct rlimit){ lim, lim + 1 };
1326 if (setrlimit(RLIMIT_CPU, &rl))
1327 perror(
"setrlimit");
1334 #if FFMPEG_OPT_QPHIST
1335 static int opt_qphist(
void *optctx,
const char *opt,
const char *
arg)
1342 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1343 static int opt_adrift_threshold(
void *optctx,
const char *opt,
const char *
arg)
1350 static const char *
const alt_bsf[] = {
"absf",
"vbsf",
NULL };
1351 static const char *
const alt_channel_layout[] = {
"ch_layout",
NULL};
1352 static const char *
const alt_codec[] = {
"c",
"acodec",
"vcodec",
"scodec",
"dcodec",
NULL };
1353 static const char *
const alt_filter[] = {
"af",
"vf",
NULL };
1354 static const char *
const alt_frames[] = {
"aframes",
"vframes",
"dframes",
NULL };
1355 static const char *
const alt_pre[] = {
"apre",
"vpre",
"spre",
NULL};
1356 static const char *
const alt_qscale[] = {
"q",
NULL};
1357 static const char *
const alt_tag[] = {
"atag",
"vtag",
"stag",
NULL };
1359 #define OFFSET(x) offsetof(OptionsContext, x)
1365 "force container format (auto-detected otherwise)",
"fmt" },
1368 "overwrite output files" },
1371 "never overwrite output files" },
1374 "Ignore unknown stream types" },
1377 "Copy unknown stream types" },
1380 "allow recasting stream type in order to force a decoder of different media type" },
1382 { .off =
OFFSET(codec_names) },
1383 "select encoder/decoder ('copy' to copy stream without reencoding)",
"codec",
1384 .u1.name_canon =
"codec", },
1386 { .off =
OFFSET(codec_names) },
1387 "alias for -c (select encoder/decoder)",
"codec",
1388 .u1.names_alt = alt_codec, },
1391 "preset name",
"preset",
1392 .u1.names_alt = alt_pre, },
1395 "set input stream mapping",
1396 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1398 { .off =
OFFSET(metadata_map) },
1399 "set metadata information of outfile from infile",
1400 "outfile[,metadata]:infile[,metadata]" },
1402 { .off =
OFFSET(chapters_input_file) },
1403 "set chapters mapping",
"input_file_index" },
1405 { .off =
OFFSET(recording_time) },
1406 "stop transcoding after specified duration",
1409 { .off =
OFFSET(stop_time) },
1410 "stop transcoding after specified time is reached",
1413 { .off =
OFFSET(limit_filesize) },
1414 "set the limit file size in bytes",
"limit_size" },
1417 "start transcoding at specified time",
"time_off" },
1419 { .off =
OFFSET(start_time_eof) },
1420 "set the start time offset relative to EOF",
"time_off" },
1422 { .off =
OFFSET(seek_timestamp) },
1423 "enable/disable seeking by timestamp with -ss" },
1425 { .off =
OFFSET(accurate_seek) },
1426 "enable/disable accurate seeking with -ss" },
1428 { .off =
OFFSET(input_sync_ref) },
1429 "Indicate the input index for sync reference",
"sync ref" },
1431 { .off =
OFFSET(input_ts_offset) },
1432 "set the input ts offset",
"time_off" },
1434 { .off =
OFFSET(ts_scale) },
1435 "set the input ts scale",
"scale" },
1438 "set the recording timestamp ('now' to set the current time)",
"time" },
1440 { .off =
OFFSET(metadata) },
1441 "add metadata",
"key=value" },
1444 "add program with specified streams",
"title=string:st=number..." },
1446 { .off =
OFFSET(stream_groups) },
1447 "add stream group with specified streams and group type-specific arguments",
"id=number:st=number..." },
1450 "set the number of data frames to output",
"number",
1451 .u1.name_canon =
"frames" },
1454 "add timings for benchmarking" },
1457 "add timings for each task" },
1459 { .func_arg = opt_progress },
1460 "write program-readable progress information",
"url" },
1463 "enable or disable interaction on standard input" },
1466 "set max runtime in seconds in CPU user time",
"limit" },
1469 "dump each input packet" },
1472 "when dumping packets, also dump the payload" },
1474 { .off =
OFFSET(rate_emu) },
1475 "read input at native frame rate; equivalent to -readrate 1",
"" },
1477 { .off =
OFFSET(readrate) },
1478 "read input at specified rate",
"speed" },
1480 { .off =
OFFSET(readrate_initial_burst) },
1481 "The initial amount of input to burst read before imposing any readrate",
"seconds" },
1484 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1485 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
1488 "frame drop threshold",
"" },
1491 "copy timestamps" },
1494 "shift input timestamps to start at 0 when using copyts" },
1497 "copy input stream time base when stream copying",
"mode" },
1499 { .off =
OFFSET(shortest) },
1500 "finish encoding within shortest input" },
1502 { .off =
OFFSET(shortest_buf_duration) },
1503 "maximum buffering duration (in seconds) for the -shortest option" },
1505 { .off =
OFFSET(bitexact) },
1512 "timestamp discontinuity delta threshold",
"threshold" },
1515 "timestamp error delta threshold",
"threshold" },
1518 "exit on error",
"error" },
1521 "abort on the specified condition flags",
"flags" },
1523 { .off =
OFFSET(copy_initial_nonkeyframes) },
1524 "copy initial non-keyframes" },
1526 { .off =
OFFSET(copy_prior_start) },
1527 "copy or discard frames before start time" },
1529 { .off =
OFFSET(max_frames) },
1530 "set the number of frames to output",
"number",
1531 .u1.names_alt = alt_frames, },
1533 { .off =
OFFSET(codec_tags) },
1534 "force codec tag/fourcc",
"fourcc/tag",
1535 .u1.names_alt = alt_tag, },
1537 { .off =
OFFSET(qscale) },
1538 "use fixed quality scale (VBR)",
"q",
1539 .u1.name_canon =
"qscale", },
1542 "use fixed quality scale (VBR)",
"q",
1543 .u1.names_alt = alt_qscale, },
1546 "set profile",
"profile" },
1549 "apply specified filters to audio/video",
"filter_graph",
1550 .u1.names_alt = alt_filter, },
1553 "number of non-complex filter threads" },
1554 #if FFMPEG_OPT_FILTER_SCRIPT
1556 { .off =
OFFSET(filter_scripts) },
1557 "deprecated, use -/filter",
"filename" },
1560 { .off =
OFFSET(reinit_filters) },
1561 "reinit filtergraph on input parameter changes",
"" },
1564 "create a complex filtergraph",
"graph_description" },
1567 "number of threads for -filter_complex" },
1570 "create a complex filtergraph",
"graph_description" },
1571 #if FFMPEG_OPT_FILTER_SCRIPT
1574 "deprecated, use -/filter_complex instead",
"filename" },
1578 "enable automatic conversion filters globally" },
1581 "print progress report during encoding", },
1584 "set the period at which ffmpeg updates stats and -progress output",
"time" },
1587 "add an attachment to the output file",
"filename" },
1590 "extract an attachment into a file",
"filename" },
1592 { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
1595 "print timestamp debugging info" },
1598 "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.",
"maximum error rate" },
1600 { .off =
OFFSET(discard) },
1603 { .off =
OFFSET(disposition) },
1604 "disposition",
"" },
1606 { .off =
OFFSET(thread_queue_size) },
1607 "set the maximum number of queued packets from the demuxer" },
1610 "read and decode the streams to fill missing information with heuristics" },
1612 { .off =
OFFSET(bits_per_raw_sample) },
1613 "set the number of bits per raw sample",
"number" },
1616 { .off =
OFFSET(enc_stats_pre) },
1617 "write encoding stats before encoding" },
1619 { .off =
OFFSET(enc_stats_post) },
1620 "write encoding stats after encoding" },
1622 { .off =
OFFSET(mux_stats) },
1623 "write packets stats before muxing" },
1625 { .off =
OFFSET(enc_stats_pre_fmt) },
1626 "format of the stats written with -stats_enc_pre" },
1628 { .off =
OFFSET(enc_stats_post_fmt) },
1629 "format of the stats written with -stats_enc_post" },
1631 { .off =
OFFSET(mux_stats_fmt) },
1632 "format of the stats written with -stats_mux_pre" },
1637 "set the number of video frames to output",
"number",
1638 .u1.name_canon =
"frames", },
1640 { .off =
OFFSET(frame_rates) },
1641 "override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)",
"rate" },
1643 { .off =
OFFSET(max_frame_rates) },
1644 "set max frame rate (Hz value, fraction or abbreviation)",
"rate" },
1647 "set frame size (WxH or abbreviation)",
"size" },
1649 { .off =
OFFSET(frame_aspect_ratios) },
1650 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
1652 { .off =
OFFSET(frame_pix_fmts) },
1653 "set pixel format",
"format" },
1655 { .off =
OFFSET(display_rotations) },
1656 "set pure counter-clockwise rotation in degrees for stream(s)",
1659 { .off =
OFFSET(display_hflips) },
1660 "set display horizontal flip for stream(s) "
1661 "(overrides any display rotation if it is not set)"},
1663 { .off =
OFFSET(display_vflips) },
1664 "set display vertical flip for stream(s) "
1665 "(overrides any display rotation if it is not set)"},
1670 { .off =
OFFSET(rc_overrides) },
1671 "rate control override for specific intervals",
"override" },
1674 "alias for -c:v (select encoder/decoder for video streams)",
"codec",
1675 .u1.name_canon =
"codec", },
1678 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
1681 "select the pass number (1 to 3)",
"n" },
1683 { .off =
OFFSET(passlogfiles) },
1684 "select two pass log file name prefix",
"prefix" },
1687 "dump video coding statistics to file" },
1690 "dump video coding statistics to file",
"file" },
1693 "Version of the vstats format to use."},
1696 "alias for -filter:v (apply filters to video streams)",
"filter_graph",
1697 .u1.name_canon =
"filter", },
1699 { .off =
OFFSET(intra_matrices) },
1700 "specify intra matrix coeffs",
"matrix" },
1702 { .off =
OFFSET(inter_matrices) },
1703 "specify inter matrix coeffs",
"matrix" },
1705 { .off =
OFFSET(chroma_intra_matrices) },
1706 "specify intra matrix coeffs",
"matrix" },
1709 "force video tag/fourcc",
"fourcc/tag",
1710 .u1.name_canon =
"tag", },
1712 { .off =
OFFSET(fps_mode) },
1713 "set framerate mode for matching video streams; overrides vsync" },
1715 { .off =
OFFSET(force_fps) },
1716 "force the selected framerate, disable the best supported framerate selection" },
1719 "set the value of an outfile streamid",
"streamIndex:value" },
1721 { .off =
OFFSET(forced_key_frames) },
1722 "force key frames at specified timestamps",
"timestamps" },
1725 "video bitrate (please use -b:v)",
"bitrate" },
1727 { .off =
OFFSET(hwaccels) },
1728 "use HW accelerated decoding",
"hwaccel name" },
1730 { .off =
OFFSET(hwaccel_devices) },
1731 "select a device for HW acceleration",
"devicename" },
1733 { .off =
OFFSET(hwaccel_output_formats) },
1734 "select output format used with HW accelerated decoding",
"format" },
1737 "show available HW acceleration methods" },
1740 "automatically insert correct rotate filters" },
1742 { .off =
OFFSET(autoscale) },
1743 "automatically insert a scale filter at the end of the filter graph" },
1746 "set this video output stream to be a heartbeat stream for "
1747 "fix_sub_duration, according to which subtitles should be split at "
1748 "random access points" },
1753 "set the number of audio frames to output",
"number",
1754 .u1.name_canon =
"frames", },
1757 "set audio quality (codec-specific)",
"quality", },
1759 { .off =
OFFSET(audio_sample_rate) },
1760 "set audio sampling rate (in Hz)",
"rate" },
1763 "set number of audio channels",
"channels" },
1769 "alias for -c:a (select encoder/decoder for audio streams)",
"codec",
1770 .u1.name_canon =
"codec", },
1773 "alias for -b:a (select bitrate for audio streams)",
"bitrate" },
1776 "force audio tag/fourcc",
"fourcc/tag",
1777 .u1.name_canon =
"tag", },
1780 "set sample format",
"format" },
1782 { .off =
OFFSET(audio_ch_layouts) },
1783 "set channel layout",
"layout",
1784 .u1.names_alt = alt_channel_layout, },
1786 { .off =
OFFSET(audio_ch_layouts) },
1787 "set channel layout",
"layout",
1788 .u1.name_canon =
"channel_layout", },
1791 "alias for -filter:a (apply filters to audio streams)",
"filter_graph",
1792 .u1.name_canon =
"filter", },
1794 { .off =
OFFSET(guess_layout_max) },
1795 "set the maximum number of channels to try to guess the channel layout" },
1800 "disable subtitle" },
1803 "alias for -c:s (select encoder/decoder for subtitle streams)",
"codec",
1804 .u1.name_canon =
"codec", },
1807 ,
"force subtitle tag/fourcc",
"fourcc/tag",
1808 .u1.name_canon =
"tag" },
1810 { .off =
OFFSET(fix_sub_duration) },
1811 "fix subtitles duration" },
1813 { .off =
OFFSET(canvas_sizes) },
1814 "set canvas size (WxH or abbreviation)",
"size" },
1818 { .off =
OFFSET(mux_max_delay) },
1819 "set the maximum demux-decode delay",
"seconds" },
1821 { .off =
OFFSET(mux_preload) },
1822 "set the initial demux-decode delay",
"seconds" },
1825 "specify a file in which to print sdp information",
"file" },
1828 { .off =
OFFSET(time_bases) },
1829 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
1831 { .off =
OFFSET(enc_time_bases) },
1832 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
1833 "two special values are defined - "
1834 "0 = use frame rate (video) or sample rate (audio),"
1835 "-1 = match source time base",
"ratio" },
1838 { .off =
OFFSET(bitstream_filters) },
1839 "A comma-separated list of bitstream filters",
"bitstream_filters", },
1843 "set the audio options to the indicated preset",
"preset",
1844 .u1.name_canon =
"pre", },
1847 "set the video options to the indicated preset",
"preset",
1848 .u1.name_canon =
"pre", },
1851 "set the subtitle options to the indicated preset",
"preset",
1852 .u1.name_canon =
"pre", },
1855 "set options from indicated preset file",
"filename",
1856 .u1.name_canon =
"pre", },
1859 { .off =
OFFSET(max_muxing_queue_size) },
1860 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
1862 { .off =
OFFSET(muxing_queue_data_threshold) },
1863 "set the threshold after which max_muxing_queue_size is taken into account",
"bytes" },
1868 "alias for -c:d (select encoder/decoder for data streams)",
"codec",
1869 .u1.name_canon =
"codec", },
1871 { .off =
OFFSET(data_disable) },
"disable data" },
1875 { .func_arg = opt_vaapi_device },
1876 "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)",
"device" },
1881 { .func_arg = opt_qsv_device },
1882 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
1887 "initialise hardware device",
"args" },
1890 "set hardware device used when filtering",
"device" },
1893 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1895 { .func_arg = opt_adrift_threshold },
1896 "deprecated, does nothing",
"threshold" },
1900 { .off =
OFFSET(top_field_first) },
1901 "deprecated, use the setfield video filter",
"" },
1903 #if FFMPEG_OPT_QPHIST
1905 { .func_arg = opt_qphist },
1906 "deprecated, does nothing" },
1908 #if FFMPEG_OPT_VSYNC
1911 "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
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.
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.
#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.
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)
static int subtitle_disable
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)
int fg_finalise_bindings(FilterGraph *fg)
static int opt_data_frames(void *optctx, const char *opt, const char *arg)
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.
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
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
#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)
char * specifier
stream/chapter/program/...
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.
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.
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.
AVDictionary * strip_specifiers(const AVDictionary *dict)
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.
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)
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)
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
FilterGraph ** filtergraphs
const AVIOInterruptCB int_cb
static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
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...
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
static int find_stream_info
#define CMDUTILS_COMMON_OPTIONS
#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 * 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.
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 VDPAUPixFmtMap * map
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.
float frame_drop_threshold
#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)
HWDevice * hw_device_get_by_name(const char *name)
const AVClass * avfilter_get_class(void)
static int dump_attachment(InputStream *ist, const char *filename)
#define ABORT_ON_FLAG_EMPTY_OUTPUT
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
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