Go to the documentation of this file.
25 #if HAVE_SYS_RESOURCE_H
27 #include <sys/resource.h>
110 void *dst = (uint8_t*)o + po->
u.
off;
114 int i, *count = (
int*)(so + 1);
115 for (
i = 0;
i < *count;
i++) {
130 #if FFMPEG_OPT_MAP_CHANNEL
140 memset(o, 0,
sizeof(*o));
160 printf(
"Hardware acceleration methods:\n");
175 char *p = strchr(e->
key,
':');
193 else if (!is_global) {
208 " use a string argument as described in the manual.\n");
219 int64_t new_start_time = INT64_MAX,
diff, abs_start_seek;
227 for (
int j = 0; j <
is->nb_streams; j++) {
234 diff = new_start_time -
is->start_time;
242 ifile->
ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time;
256 int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
257 int start_times_set = 1;
259 if (self->input_sync_ref == -1 || self->input_sync_ref ==
i)
continue;
260 if (self->input_sync_ref >=
nb_input_files || self->input_sync_ref < -1) {
261 av_log(
NULL,
AV_LOG_FATAL,
"-isync for input %d references non-existent input %d.\n",
i, self->input_sync_ref);
271 if (
ref->input_sync_ref != -1 &&
ref->input_sync_ref != self->input_sync_ref) {
272 av_log(
NULL,
AV_LOG_ERROR,
"-isync for input %d references a resynced input %d. Sync not set.\n",
i, self->input_sync_ref);
277 self_start_time =
self->ctx->start_time_realtime;
278 ref_start_time =
ref->ctx->start_time_realtime;
280 self_start_time =
self->start_time_effective;
281 ref_start_time =
ref->start_time_effective;
286 if (start_times_set) {
287 self_seek_start =
self->start_time ==
AV_NOPTS_VALUE ? 0 :
self->start_time;
290 adjustment = (self_start_time - ref_start_time) + !
copy_ts*(self_seek_start - ref_seek_start) +
ref->input_ts_offset;
292 self->ts_offset += adjustment;
294 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);
296 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);
324 const AVClass *pclass = &
class;
331 int64_t user_stats_period;
336 if (user_stats_period <= 0) {
371 static int opt_map(
void *optctx,
const char *opt,
const char *
arg)
375 int i, negative = 0, file_idx, disabled = 0;
388 #if FFMPEG_OPT_MAP_SYNC
391 char *sync = strchr(
map,
',');
403 const char *
c =
map + 1;
417 if (allow_unused = strchr(
map,
'?'))
419 file_idx = strtol(
map, &p, 0);
432 *p ==
':' ? p + 1 : p) > 0)
438 *p ==
':' ? p + 1 : p) <= 0)
458 }
else if (disabled) {
460 "To ignore this, add a trailing '?' to the map.\n",
arg);
465 "To ignore this, add a trailing '?' to the map.\n",
arg);
487 #if FFMPEG_OPT_MAP_CHANNEL
498 "The -%s option is deprecated and will be removed. "
499 "It can be replaced by the 'pan' filter, or in some cases by "
500 "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt);
523 n = sscanf(
arg,
"%d.%d.%d:%d.%d",
527 if (n != 3 && n != 5) {
529 "[file.stream.channel|-1][:syncfile:syncstream]\n");
555 if (allow_unused = strchr(mapchan,
'?'))
564 "To ignore this, add a trailing '?' to the map_channel.\n",
588 static int opt_vaapi_device(
void *optctx,
const char *opt,
const char *
arg)
590 const char *prefix =
"vaapi:";
603 static int opt_qsv_device(
void *optctx,
const char *opt,
const char *
arg)
605 const char *prefix =
"qsv=__qsv_device:hw_any,child_device=";
621 if (!strcmp(
arg,
"list")) {
623 printf(
"Supported hardware device types:\n");
652 int64_t recording_timestamp;
660 recording_timestamp /= 1e6;
661 time = *gmtime((time_t*)&recording_timestamp);
662 if (!strftime(buf,
sizeof(buf),
"creation_time=%Y-%m-%dT%H:%M:%S%z", &time))
667 "tag instead.\n", opt);
675 const char *
codec_string = encoder ?
"encoder" :
"decoder";
709 fprintf(stderr,
"Error, both -y and -n supplied. Exiting.\n");
714 if (proto_name && !strcmp(proto_name,
"file") &&
avio_check(filename, 0) == 0) {
716 fprintf(stderr,
"File '%s' already exists. Overwrite? [y/N] ", filename);
719 signal(SIGINT, SIG_DFL);
733 if (proto_name && !strcmp(proto_name,
"file")) {
738 if (!strcmp(filename, file->
ctx->
url)) {
783 p = strchr(idx_str,
':');
786 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
811 static const char *
const frame_rates[] = {
"25",
"30000/1001",
"24000/1001" };
813 if (!strncmp(
arg,
"pal-", 4)) {
816 }
else if (!strncmp(
arg,
"ntsc-", 5)) {
819 }
else if (!strncmp(
arg,
"film-", 5)) {
836 }
else if ((fr == 29970) || (fr == 23976)) {
856 if (!strcmp(
arg,
"vcd")) {
883 }
else if (!strcmp(
arg,
"svcd")) {
905 }
else if (!strcmp(
arg,
"dvd")) {
927 }
else if (!strncmp(
arg,
"dv", 2)) {
933 norm ==
PAL ?
"yuv420p" :
"yuv411p",
options);
960 time_t today2 = time(
NULL);
961 struct tm *today = localtime(&today2);
968 snprintf(filename,
sizeof(filename),
"vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
1015 char filename[1000],
line[1000], tmp_line[1000];
1016 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")){
1180 int show_advanced = 0, show_avoptions = 0;
1183 if (!strcmp(opt,
"long"))
1185 else if (!strcmp(opt,
"full"))
1186 show_advanced = show_avoptions = 1;
1194 " -h -- print basic options\n"
1195 " -h long -- print more options\n"
1196 " -h full -- print all options (including all format and codec specific options, very long)\n"
1197 " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
1198 " See man %s for detailed description of the options.\n"
1205 "instead of just one file):",
1233 if (show_avoptions) {
1240 #if CONFIG_SWRESAMPLE
1262 [GROUP_INFILE] = {
"input url",
"i",
OPT_INPUT },
1280 "%s.\n", inout,
g->arg);
1302 const char *errmsg =
NULL;
1305 memset(&octx, 0,
sizeof(octx));
1311 errmsg =
"splitting the argument list";
1318 errmsg =
"parsing global options";
1328 errmsg =
"opening input files";
1335 errmsg =
"initializing complex filters";
1342 errmsg =
"opening output files";
1365 static int opt_progress(
void *optctx,
const char *opt,
const char *
arg)
1370 if (!strcmp(
arg,
"-"))
1393 rl = (
struct rlimit){ lim, lim + 1 };
1394 if (setrlimit(RLIMIT_CPU, &rl))
1395 perror(
"setrlimit");
1402 #if FFMPEG_OPT_QPHIST
1403 static int opt_qphist(
void *optctx,
const char *opt,
const char *
arg)
1410 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1411 static int opt_adrift_threshold(
void *optctx,
const char *opt,
const char *
arg)
1418 #define OFFSET(x) offsetof(OptionsContext, x)
1424 "force format",
"fmt" },
1426 "overwrite output files" },
1428 "never overwrite output files" },
1430 "Ignore unknown stream types" },
1432 "Copy unknown stream types" },
1434 "allow recasting stream type in order to force a decoder of different media type" },
1437 "codec name",
"codec" },
1440 "codec name",
"codec" },
1443 "preset name",
"preset" },
1446 "set input stream mapping",
1447 "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
1448 #if FFMPEG_OPT_MAP_CHANNEL
1450 "map an audio channel from one stream to another (deprecated)",
"file.stream.channel[:syncfile.syncstream]" },
1454 "set metadata information of outfile from infile",
1455 "outfile[,metadata]:infile[,metadata]" },
1458 "set chapters mapping",
"input_file_index" },
1461 "record or transcode \"duration\" seconds of audio/video",
1464 "record or transcode stop time",
"time_stop" },
1466 "set the limit file size in bytes",
"limit_size" },
1469 "set the start time offset",
"time_off" },
1472 "set the start time offset relative to EOF",
"time_off" },
1475 "enable/disable seeking by timestamp with -ss" },
1478 "enable/disable accurate seeking with -ss" },
1481 "Indicate the input index for sync reference",
"sync ref" },
1484 "set the input ts offset",
"time_off" },
1487 "set the input ts scale",
"scale" },
1489 "set the recording timestamp ('now' to set the current time)",
"time" },
1491 "add metadata",
"string=string" },
1493 "add program with specified streams",
"title=string:st=number..." },
1496 "set the number of data frames to output",
"number" },
1498 "add timings for benchmarking" },
1500 "add timings for each task" },
1502 "write program-readable progress information",
"url" },
1504 "enable or disable interaction on standard input" },
1506 "set max runtime in seconds in CPU user time",
"limit" },
1508 "dump each input packet" },
1510 "when dumping packets, also dump the payload" },
1513 "read input at native frame rate; equivalent to -readrate 1",
"" },
1516 "read input at specified rate",
"speed" },
1519 "The initial amount of input to burst read before imposing any readrate",
"seconds" },
1521 "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
1522 "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")",
"type" },
1524 "set video sync method globally; deprecated, use -fps_mode",
"" },
1526 "frame drop threshold",
"" },
1527 #if FFMPEG_OPT_ADRIFT_THRESHOLD
1528 {
"adrift_threshold",
HAS_ARG |
OPT_EXPERT, { .func_arg = opt_adrift_threshold },
1529 "deprecated, does nothing",
"threshold" },
1532 "copy timestamps" },
1534 "shift input timestamps to start at 0 when using copyts" },
1536 "copy input stream time base when stream copying",
"mode" },
1539 "finish encoding within shortest input" },
1541 "maximum buffering duration (in seconds) for the -shortest option" },
1549 "timestamp discontinuity delta threshold",
"threshold" },
1551 "timestamp error delta threshold",
"threshold" },
1553 "exit on error",
"error" },
1555 "abort on the specified condition flags",
"flags" },
1558 "copy initial non-keyframes" },
1560 "copy or discard frames before start time" },
1562 "set the number of frames to output",
"number" },
1565 "force codec tag/fourcc",
"fourcc/tag" },
1568 "use fixed quality scale (VBR)",
"q" },
1571 "use fixed quality scale (VBR)",
"q" },
1573 "set profile",
"profile" },
1575 "set stream filtergraph",
"filter_graph" },
1577 "number of non-complex filter threads" },
1579 "read stream filtergraph description from a file",
"filename" },
1581 "reinit filtergraph on input parameter changes",
"" },
1583 "create a complex filtergraph",
"graph_description" },
1585 "number of threads for -filter_complex" },
1587 "create a complex filtergraph",
"graph_description" },
1589 "read complex filtergraph description from a file",
"filename" },
1591 "enable automatic conversion filters globally" },
1593 "print progress report during encoding", },
1595 "set the period at which ffmpeg updates stats and -progress output",
"time" },
1598 "add an attachment to the output file",
"filename" },
1601 "extract an attachment into a file",
"filename" },
1603 OPT_OFFSET, { .off =
OFFSET(
loop) },
"set number of times input stream shall be looped",
"loop count" },
1605 "print timestamp debugging info" },
1607 "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.",
"maximum error rate" },
1613 "disposition",
"" },
1615 { .off =
OFFSET(thread_queue_size) },
1616 "set the maximum number of queued packets from the demuxer" },
1618 "read and decode the streams to fill missing information with heuristics" },
1620 { .off =
OFFSET(bits_per_raw_sample) },
1621 "set the number of bits per raw sample",
"number" },
1624 "write encoding stats before encoding" },
1626 "write encoding stats after encoding" },
1628 "write packets stats before muxing" },
1630 "format of the stats written with -stats_enc_pre" },
1632 "format of the stats written with -stats_enc_post" },
1634 "format of the stats written with -stats_mux_pre" },
1638 "set the number of video frames to output",
"number" },
1641 "set frame rate (Hz value, fraction or abbreviation)",
"rate" },
1644 "set max frame rate (Hz value, fraction or abbreviation)",
"rate" },
1647 "set frame size (WxH or abbreviation)",
"size" },
1650 "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)",
"aspect" },
1653 "set pixel format",
"format" },
1656 "set pure counter-clockwise rotation in degrees for stream(s)",
1659 "set display horizontal flip for stream(s) "
1660 "(overrides any display rotation if it is not set)"},
1662 "set display vertical flip for stream(s) "
1663 "(overrides any display rotation if it is not set)"},
1668 "rate control override for specific intervals",
"override" },
1671 "force video codec ('copy' to copy stream)",
"codec" },
1673 "set initial TimeCode value.",
"hh:mm:ss[:;.]ff" },
1675 "select the pass number (1 to 3)",
"n" },
1678 "select two pass log file name prefix",
"prefix" },
1681 "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
1684 "dump video coding statistics to file" },
1686 "dump video coding statistics to file",
"file" },
1688 "Version of the vstats format to use."},
1690 "set video filters",
"filter_graph" },
1693 "specify intra matrix coeffs",
"matrix" },
1696 "specify inter matrix coeffs",
"matrix" },
1699 "specify intra matrix coeffs",
"matrix" },
1703 "deprecated, use the setfield video filter",
"" },
1707 "force video tag/fourcc",
"fourcc/tag" },
1708 #if FFMPEG_OPT_QPHIST
1710 "deprecated, does nothing" },
1714 "set framerate mode for matching video streams; overrides vsync" },
1717 "force the selected framerate, disable the best supported framerate selection" },
1720 "set the value of an outfile streamid",
"streamIndex:value" },
1723 "force key frames at specified timestamps",
"timestamps" },
1725 "video bitrate (please use -b:v)",
"bitrate" },
1728 "use HW accelerated decoding",
"hwaccel name" },
1731 "select a device for HW acceleration",
"devicename" },
1734 "select output format used with HW accelerated decoding",
"format" },
1736 "show available HW acceleration methods" },
1739 "automatically insert correct rotate filters" },
1742 "automatically insert a scale filter at the end of the filter graph" },
1745 "set this video output stream to be a heartbeat stream for "
1746 "fix_sub_duration, according to which subtitles should be split at "
1747 "random access points" },
1751 "set the number of audio frames to output",
"number" },
1753 "set audio quality (codec-specific)",
"quality", },
1756 "set audio sampling rate (in Hz)",
"rate" },
1759 "set number of audio channels",
"channels" },
1764 "force audio codec ('copy' to copy stream)",
"codec" },
1766 "audio bitrate (please use -b:a)",
"bitrate" },
1769 "force audio tag/fourcc",
"fourcc/tag" },
1772 "set sample format",
"format" },
1775 "set channel layout",
"layout" },
1778 "set channel layout",
"layout" },
1780 "set audio filters",
"filter_graph" },
1782 "set the maximum number of channels to try to guess the channel layout" },
1786 "disable subtitle" },
1788 "force subtitle codec ('copy' to copy stream)",
"codec" },
1790 ,
"force subtitle tag/fourcc",
"fourcc/tag" },
1792 "fix subtitles duration" },
1794 "set canvas size (WxH or abbreviation)",
"size" },
1798 "set the maximum demux-decode delay",
"seconds" },
1800 "set the initial demux-decode delay",
"seconds" },
1802 "specify a file in which to print sdp information",
"file" },
1805 "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)",
"ratio" },
1807 "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). "
1808 "two special values are defined - "
1809 "0 = use frame rate (video) or sample rate (audio),"
1810 "-1 = match source time base",
"ratio" },
1813 "A comma-separated list of bitstream filters",
"bitstream_filters" },
1815 "deprecated",
"audio bitstream_filters" },
1817 "deprecated",
"video bitstream_filters" },
1820 "set the audio options to the indicated preset",
"preset" },
1822 "set the video options to the indicated preset",
"preset" },
1824 "set the subtitle options to the indicated preset",
"preset" },
1826 "set options from indicated preset file",
"filename" },
1829 "maximum number of packets that can be buffered while waiting for all streams to initialize",
"packets" },
1831 "set the threshold after which max_muxing_queue_size is taken into account",
"bytes" },
1835 "force data codec ('copy' to copy stream)",
"codec" },
1841 "set VAAPI hardware device (DirectX adapter index, DRM path or X11 display name)",
"device" },
1846 "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)",
"device"},
1850 "initialise hardware device",
"args" },
1852 "set hardware device used when filtering",
"device" },
int of_open(const OptionsContext *o, const char *filename)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
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
#define AV_OPT_FLAG_VIDEO_PARAM
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.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
The official guide to swscale for confused that is
#define u(width, name, range_min, range_max)
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 MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)
#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.
const char *const opt_name_top_field_first[]
int auto_conversion_filters
static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
int ffmpeg_parse_options(int argc, char **argv)
AVStream ** streams
A list of all streams in the file.
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)
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)
int nb_channels
Number of channels in this layout.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
static int subtitle_disable
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
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)
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)
int nb_audio_channel_maps
static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
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.
static int init_complex_filters(void)
#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.
const char *const opt_name_frame_rates[]
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.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
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 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.
const char *const opt_name_codec_names[]
#define AV_OPT_FLAG_BSF_PARAM
a generic parameter which can be set by the user for bit stream filtering
static int opt_video_frames(void *optctx, const char *opt, const char *arg)
#define AV_OPT_FLAG_AUDIO_PARAM
@ 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.
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.
AVChannelLayout ch_layout
Audio only.
static void correct_input_start_times(void)
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)
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)
static const uint8_t frame_sizes[]
static int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
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.
int check_filter_outputs(void)
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)
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
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.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int init_complex_filtergraph(FilterGraph *fg)
static int apply_sync_offsets(void)
#define i(width, name, range_min, range_max)
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_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
static int opt_vstats(void *optctx, const char *opt, const char *arg)
char * file_read(const char *filename)
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 parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
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.
AudioChannelMap * audio_channel_maps
static int find_stream_info
#define CMDUTILS_COMMON_OPTIONS
int ifile_open(const OptionsContext *o, const char *filename)
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
float audio_drift_threshold
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 avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
#define GROW_ARRAY(array, nb_elems)
static int opt_vsync(void *optctx, const char *opt, const char *arg)
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
#define AVIO_FLAG_READ
read-only
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 AVERROR_ENCODER_NOT_FOUND
Encoder not found.
static int opt_stats_period(void *optctx, const char *opt, const char *arg)
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.
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
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.
int parse_number(const char *context, const char *numstr, int type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
const char *const opt_name_codec_tags[]
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