52#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
55 const char *opt_name,
int flag)
75 const char *codec_name =
NULL;
84 if (codec_name && strcmp(codec_name,
"copy")) {
87 "Encoder '%s' specified, but only '-codec copy' supported "
88 "for %s streams\n", codec_name, type_str);
99 "Default encoder for format %s (codec %s) is "
100 "probably disabled. Please choose an encoder manually.\n",
104 }
else if (strcmp(codec_name,
"copy")) {
131 char *env_avconv_datadir =
getenv_utf8(
"AVCONV_DATADIR");
133 const char *
base[3] = { env_avconv_datadir,
142 snprintf(filename,
sizeof(filename),
"%s%s/%s-%s.avpreset",
base[
i],
143 i != 1 ?
"" :
"/.avconv", codec_name, preset_name);
147 snprintf(filename,
sizeof(filename),
"%s%s/%s.avpreset",
base[
i],
148 i != 1 ?
"" :
"/.avconv", preset_name);
209 const char **pstr,
char delim)
211 const char *str = *pstr;
225 for (idx = 0; *str; idx++, str++) {
226 if (str[0] ==
'\\' && str[1])
228 else if (*str == delim)
248 const char *path,
const char *fmt_spec)
250 static const struct {
254 unsigned post_only:1;
255 unsigned need_input_data:1;
276 const char *next = fmt_spec;
300 c->str_len = val_len;
314 "Empty formatting directive in: %s\n", fmt_spec);
320 "Missing closing brace in: %s\n", fmt_spec);
333 if (!strcmp(
val, fmt_specs[
i].str)) {
334 if ((pre && fmt_specs[
i].post_only) || (!pre && fmt_specs[
i].pre_only)) {
336 "Format directive '%s' may only be used %s-encoding\n",
337 val, pre ?
"post" :
"pre");
342 c->type = fmt_specs[
i].type;
344 if (fmt_specs[
i].need_input_data && !
ost->ist) {
346 "Format directive '%s' is unavailable, because "
347 "this output stream has no associated input stream\n",
387 .class_name =
"OutputStream",
426 "Filtergraph '%s' was specified for a stream fed from a complex "
427 "filtergraph. Simple and complex filtering cannot be used "
428 "together for the same stream.\n",
filters);
444 for (
int i = 0;;
i++) {
451 "Syntax error in matrix \"%s\" at coeff %d\n", str,
i);
474 int has_alpha =
desc ?
desc->nb_components % 2 == 0 : 0;
479 0, (
const void **) &p,
NULL);
491 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
513 0, (
const void **) &fmts,
NULL);
524 int len = strlen(name_canonical);
526 if (strcmp(
name, name_canonical) &&
527 (!strcmp(name_canonical +
len - 2,
"le") ||
528 !strcmp(name_canonical +
len - 2,
"be"))) {
532 snprintf(name_other,
sizeof(name_other),
"%s%ce",
533 name, name_canonical[
len - 2] ==
'l' ?
'b' :
'l');
551 static const struct {
584 "Invalid stereoscopic 3D layout '%s'. "
585 "Valid values are: 2d, mono, sbs, sbsl, side by side, "
586 "tb, tbl, top and bottom.\n",
arg);
596 int matched_video = 0, matched_other = 0;
602 for (
unsigned j = 0; j < oc->
nb_streams; j++) {
614 "-stereo3d is only valid for video streams (specifier '%s').\n",
618 if (!matched_video) {
620 "Stream specifier '%s' for -stereo3d matches no video streams.\n",
636 const char *frame_rate =
NULL, *max_frame_rate =
NULL, *frame_aspect_ratio =
NULL;
637 const char *stereo3d =
NULL;
654 if (frame_rate && max_frame_rate) {
660 if (frame_aspect_ratio) {
663 q.
num <= 0 || q.
den <= 0) {
667 ost->frame_aspect_ratio = q;
680 const char *p =
NULL, *fps_mode =
NULL;
682 const char *frame_pix_fmt =
NULL;
683 const char *intra_matrix =
NULL, *inter_matrix =
NULL;
684 const char *chroma_intra_matrix =
NULL;
698 if (frame_pix_fmt && *frame_pix_fmt ==
'+') {
700 if (!*++frame_pix_fmt)
701 frame_pix_fmt =
NULL;
719 if (chroma_intra_matrix) {
736 for (
i = 0; p;
i++) {
738 int e = sscanf(p,
"%d,%d,%d", &start, &end, &q);
775 if (
ost->logfile_prefix &&
781 char logfilename[1024];
785 for (
int idx = 0; idx <=
ost->file->index; idx++)
788 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
789 ost->logfile_prefix ?
ost->logfile_prefix :
792 if (!strcmp(video_enc->
codec->
name,
"libx264") || !strcmp(video_enc->
codec->
name,
"libvvenc")) {
797 }
else if (!strcmp(video_enc->
codec->
name,
"libx265")) {
800 av_opt_set(video_enc,
"x265-stats", logfilename,
817 "Cannot write log file '%s' for pass-1 encoding: %s\n",
818 logfilename, strerror(errno));
840 "together a non-CFR -vsync/-fps_mode. This is contradictory.\n");
882 const char *sample_fmt =
NULL;
924 int input_props = 0, output_props = 0;
936 if (input_descriptor)
938 if (output_descriptor)
940 if (input_props && output_props && input_props != output_props) {
942 "Subtitle encoding currently only possible from text to text "
943 "or bitmap to bitmap\n");
955 int keep_pix_fmt,
int autoscale,
int threads_manual,
966 .enc = enc_ctx->
codec,
970 .width = enc_ctx->
width,
971 .height = enc_ctx->
height,
975 .vsync_method = vsync_method,
989 .reinit_opts =
ost->enc->reinit_opts,
1002 (
const void **) &
opts.pix_fmts,
NULL);
1009 (
const void **) &
opts.frame_rates,
NULL);
1015 (
const void **) &
opts.color_spaces,
NULL);
1020 (
const void **) &
opts.color_ranges,
NULL);
1025 (
const void **) &
opts.alpha_modes,
NULL);
1031 (
const void **) &
opts.sample_fmts,
NULL);
1036 (
const void **) &
opts.sample_rates,
NULL);
1041 (
const void **) &
opts.ch_layouts,
NULL);
1046 if (threads_manual) {
1058 ost->filter = ofilter;
1064 ost->filter =
ost->fg_simple->outputs[0];
1097 "Filtergraph '%s' was specified, but codec copy was selected. "
1098 "Filtering and streamcopy cannot be used together.\n",
filters);
1111 "Error setting up codec context options.\n");
1118 "Error getting reference codec parameters.\n");
1124 unsigned int codec_tag_tmp;
1136 ost->st->avg_frame_rate = fr;
1141 if (
ost->st->time_base.num <= 0 ||
ost->st->time_base.den <= 0) {
1162 &
ost->st->codecpar->nb_coded_side_data,
1181 if (
ost->frame_aspect_ratio.num) {
1186 "with stream copy may produce invalid files\n");
1205 const char *cname = codec->
name;
1206 uint8_t *encoder_string;
1207 int encoder_string_len;
1210 encoder_string =
av_mallocz(encoder_string_len);
1211 if (!encoder_string)
1214 if (!
ost->file->bitexact && !
ost->bitexact)
1217 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
1218 av_strlcat(encoder_string, cname, encoder_string_len);
1236 int ret = 0, keep_pix_fmt = 0, autoscale = 1;
1237 int threads_manual = 0;
1240 const char *bsfs =
NULL, *time_base =
NULL, *codec_tag =
NULL, *manual_disp =
NULL;
1254 if (ist || ofilter) {
1273 snprintf(idx,
sizeof(idx),
"%d",
ost->index);
1277 st->
id = strtol(e->
value, &p, 0);
1278 if (!e->
value[0] || *p) {
1299 ost->st->disposition =
ost->ist->st->disposition;
1333 "Streamcopy requested for output stream fed "
1334 "from a complex filtergraph. Filtering and streamcopy "
1335 "cannot be used together.\n");
1362 const char *enc_stats_pre =
NULL, *enc_stats_post =
NULL, *mux_stats =
NULL;
1366 oc, st, enc, &encoder_opts,
1384 if (!buf[0] || buf[0] ==
'#')
1386 if (!(
arg = strchr(buf,
'='))) {
1393 }
while (!
s->eof_reached);
1399 "Preset %s specified, but could not be opened.\n",
preset);
1404 if (enc_reinit_opts &&
1407 if (!
ost->enc->reinit_opts) {
1414 if (enc_stats_pre &&
1416 const char *
format =
"{fidx} {sidx} {n} {t}";
1426 if (enc_stats_post &&
1428 const char *
format =
"{fidx} {sidx} {n} {t}";
1440 const char *
format =
"{fidx} {sidx} {n} {t}";
1452 "-enc_time_base not supported for subtitles, ignoring\n");
1453 else if (enc_time_base) {
1456 if (!strcmp(enc_time_base,
"demux")) {
1458 }
else if (!strcmp(enc_time_base,
"filter")) {
1462 if (ret < 0 || q.
den <= 0 || q.
num < 0) {
1464 ret = ret < 0 ? ret :
AVERROR(EINVAL);
1489 if (!threads_manual)
1490 ost->enc->enc_ctx->thread_count = 0;
1493 NULL, &encoder_opts,
1502 }
else if (
ost->enc) {
1516 q.
num <= 0 || q.
den <= 0) {
1529 av_log(
ost,
AV_LOG_WARNING,
"Applying unspecific -frames to non video streams, maybe you meant -vframes ?\n");
1537 if (bsfs && *bsfs) {
1547 uint32_t
tag = strtol(codec_tag, &next, 0);
1549 uint8_t buf[4] = { 0 };
1550 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
1553 ost->st->codecpar->codec_tag =
tag;
1556 ost->enc->codec_tag =
tag;
1560 if (
ost->enc && qscale >= 0) {
1566 int max_muxing_queue_size = 128;
1567 int muxing_queue_data_threshold = 50 * 1024 * 1024;
1570 &max_muxing_queue_size);
1572 oc, st, &muxing_queue_data_threshold);
1575 max_muxing_queue_size, muxing_queue_data_threshold);
1579 &
ost->bits_per_raw_sample);
1582 oc, st, &
ost->fix_sub_duration_heartbeat);
1602 keep_pix_fmt, autoscale, threads_manual, vs, &
src);
1605 }
else if (
ost->ist) {
1609 "Error binding an input stream\n");
1634 if (
ost->ist && !
ost->enc) {
1641 if (
ost->ist &&
ost->ist->st->duration > 0) {
1702 if (score > file_best_score) {
1703 file_best_score = score;
1704 file_best_istg = istg;
1723 if (score > file_best_score) {
1726 file_best_score = score;
1727 file_best_ist = ist;
1728 file_best_istg =
NULL;
1731 if (file_best_istg) {
1733 if (file_best_score > best_score) {
1734 best_score = file_best_score;
1735 best_istg = file_best_istg;
1739 if (file_best_ist) {
1740 if((qcr ==
MKTAG(
'A',
'P',
'I',
'C')) ||
1743 if (file_best_score > best_score) {
1744 best_score = file_best_score;
1745 best_ist = file_best_ist;
1778 int file_best_score = 0;
1790 if (score > file_best_score) {
1791 file_best_score = score;
1792 file_best_ist = ist;
1795 if (file_best_ist) {
1797 if (file_best_score > best_score) {
1798 best_score = file_best_score;
1799 best_ist = file_best_ist;
1826 int input_props = 0, output_props = 0;
1831 if (input_descriptor)
1833 if (output_descriptor)
1836 input_props & output_props ||
1838 input_descriptor && output_descriptor &&
1839 (!input_descriptor->
props ||
1840 !output_descriptor->
props)) {
1861 ist->st->codecpar->codec_id ==
codec_id) {
1879 if (
map->linklabel) {
1888 if (linklabel && !strcmp(linklabel,
map->linklabel)) {
1897 "in any defined filter graph, or was already used elsewhere.\n",
map->linklabel);
1902 "mapped complex filtergraph %d, output [%s]\n", fg->
index,
map->linklabel);
1914 map->file_index,
map->stream_index);
1929 "Cannot map stream #%d:%d - unsupported type.\n",
1930 map->file_index,
map->stream_index);
1933 "If you want unsupported types ignored instead "
1934 "of failing, please use the -ignore_unknown option\n"
1935 "If you want them copied, please use -copy_unknown\n");
1943 "View specifier given for mapping a %s input stream\n",
1964 uint8_t *attachment;
1965 char *attachment_filename;
1997 else if (err !=
len) {
2014 if (!attachment_filename) {
2028 ost->attachment_filename = attachment_filename;
2067 auto_disable |= 1 << ofilter->
type;
2070 "output of complex filtergraph %d.", fg->
index);
2087 if (!map_func[
i] || auto_disable & (1 <<
i))
2089 ret = map_func[
i](mux, o);
2111 if (!
src->ost.fix_sub_duration_heartbeat)
2114 for (
unsigned j = 0; j < oc->
nb_streams; j++) {
2118 !
dst->ost.enc || !
dst->ost.ist || !
dst->ost.ist->fix_sub_duration)
2164 int64_t buf_size_us,
int shortest)
2167 int nb_av_enc = 0, nb_audio_fs = 0, nb_interleaved = 0;
2168 int limit_frames = 0, limit_frames_av_enc = 0;
2170#define IS_AV_ENC(ost, type) \
2171 (ost->enc && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
2172#define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)
2191 if (!((nb_interleaved > 1 && shortest) ||
2192 (nb_interleaved > 0 && limit_frames) ||
2207 if ((shortest && nb_av_enc > 1) || limit_frames_av_enc || nb_audio_fs) {
2232 if (nb_interleaved > nb_av_enc) {
2260#undef IS_INTERLEAVED
2285 int demixing = 0, recon_gain = 0;
2289 ptr += strspn(ptr,
" \n\t\r");
2294 else if (
av_strstart(token,
"recon_gain=", &token))
2312 }
else if (demixing || recon_gain) {
2333 if (!ret && !audio_element->
nb_layers) {
2347 char *submix_str =
NULL;
2354 const char *subtoken;
2355 char *subptr =
NULL;
2358 ptr += strspn(ptr,
" \n\t\r");
2360 av_log(mux,
AV_LOG_ERROR,
"No submix in mix presentation specification \"%s\"\n", token);
2382 subtoken =
av_strtok(submix_str,
"|", &subptr);
2385 int element = 0,
layout = 0;
2388 subptr += strspn(subptr,
" \n\t\r");
2391 else if (
av_strstart(subtoken,
"layout=", &subtoken))
2403 char *endptr =
NULL;
2407 idx = strtoll(e->
value, &endptr, 0);
2411 "submix element specification \"%s\"\n", subtoken);
2416 if (!submix_element) {
2432 if (!submix_layout) {
2457 av_log(mux,
AV_LOG_ERROR,
"No audio elements in submix specification \"%s\"\n", token);
2489#define SERIALIZE(parent, child) do { \
2490 ret = of_serialize_options(mux, parent->child, bp); \
2495#define SERIALIZE_LOOP_SUBBLOCK(obj) do { \
2496 for (int k = 0; k < obj->nb_subblocks; k++) { \
2497 ret = of_serialize_options(mux, \
2498 av_iamf_param_definition_get_subblock(obj, k), bp); \
2504#define SERIALIZE_LOOP(parent, child, suffix, separator) do { \
2505 for (int j = 0; j < parent->nb_## child ## suffix; j++) { \
2506 av_bprintf(bp, separator#child "="); \
2507 SERIALIZE(parent, child ## suffix[j]); \
2525 int ret, file_idx, stream_idx;
2528 file_idx = strtol(
map, &ptr, 0);
2534 stream_idx = strtol(*ptr ==
'=' ? ptr + 1 : ptr, &ptr, 0);
2535 if (*ptr || stream_idx >=
input_files[file_idx]->
ctx->nb_stream_groups || stream_idx < 0) {
2540 stg =
input_files[file_idx]->ctx->stream_groups[stream_idx];
2558 SERIALIZE(audio_element, demixing_info);
2566 SERIALIZE(audio_element, recon_gain_info);
2577 for (
int i = 0;
i <
mix->nb_submixes;
i++) {
2627 char *mapped_string =
NULL;
2648 const AVClass *pclass = &
class;
2677 ptr = mapped_string;
2706 if (*endptr || idx < 0 || idx >= oc->
nb_streams) {
2753 if (!strcmp(e->
key,
"st") || !strcmp(e->
key,
"stg"))
2775 char *str, *ptr =
NULL;
2785 ptr += strspn(ptr,
" \n\t\r");
2805 int ret, progid =
i + 1;
2842 if (!strcmp(e->
key,
"st"))
2867 char *
type,
int *
index,
const char **stream_spec)
2875 if (*(++
arg) && *
arg !=
':') {
2879 *stream_spec = *
arg ==
':' ?
arg + 1 :
"";
2883 if (*(++
arg) ==
':')
2902 const char *stream_spec;
2903 int index = 0, ret = 0;
2965 for (
int i = 0;
i <
is->nb_chapters;
i++) {
2974 if (in_ch->
end < ts_off)
2976 if (rt != INT64_MAX && in_ch->
start > rt + ts_off)
2983 out_ch->id = in_ch->
id;
2985 out_ch->start =
FFMAX(0, in_ch->
start - ts_off);
2986 out_ch->end =
FFMIN(rt, in_ch->
end - ts_off);
2997 const char *outspec,
const char *inspec,
2998 int *metadata_global_manual,
int *metadata_streams_manual,
2999 int *metadata_chapters_manual)
3005 char type_in, type_out;
3006 const char *istream_spec =
NULL, *ostream_spec =
NULL;
3007 int idx_in = 0, idx_out = 0;
3011 ret =
parse_meta_type(mux, outspec, &type_out, &idx_out, &ostream_spec);
3015 if (type_in ==
'g' || type_out ==
'g' || (!*outspec && !ic))
3016 *metadata_global_manual = 1;
3017 if (type_in ==
's' || type_out ==
's' || (!*outspec && !ic))
3018 *metadata_streams_manual = 1;
3019 if (type_in ==
'c' || type_out ==
'c' || (!*outspec && !ic))
3020 *metadata_chapters_manual = 1;
3026#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
3027 if ((index) < 0 || (index) >= (nb_elems)) {\
3028 av_log(mux, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
3030 return AVERROR(EINVAL);\
3033#define SET_DICT(type, meta, context, index)\
3036 meta = &context->metadata;\
3039 METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
3040 meta = &context->chapters[index]->metadata;\
3043 METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
3044 meta = &context->programs[index]->metadata;\
3048 default: av_assert0(0);\
3051 SET_DICT(type_in, meta_in, ic, idx_in);
3052 SET_DICT(type_out, meta_out, oc, idx_out);
3055 if (type_in ==
's') {
3064 av_log(mux,
AV_LOG_FATAL,
"Stream specifier %s does not match any streams.\n", istream_spec);
3069 if (type_out ==
's') {
3083#define REENC_MASK(type) (1u << (type))
3084#define REENC_AUDIO_ONLY REENC_MASK(AVMEDIA_TYPE_AUDIO)
3085#define REENC_VIDEO_ONLY REENC_MASK(AVMEDIA_TYPE_VIDEO)
3086#define REENC_ANY (REENC_AUDIO_ONLY | REENC_VIDEO_ONLY)
3088static const struct {
3124 {
"major_brand", 0, 0 },
3125 {
"minor_version", 0, 0 },
3126 {
"compatible_brands", 0, 0 },
3135 const char *stream_spec =
NULL;
3141 if (
type ==
'g' && st)
3148 return ret < 0 ? ret : ret > 0;
3158 const char *family,
const char *
key,
int flags)
3171 if (!strcmp(keep, family) || !strcmp(keep,
key))
3174 if (!strcmp(
key, keep))
3219 "Discarding %s metadata '%s' because %s stream is being "
3220 "re-encoded. Use '-keep_metadata %s' to keep it.\n",
3222 !strcmp(kind,
"stream") ?
"the" :
"a", e->
key);
3235 int metadata_global_manual = 0;
3236 int metadata_streams_manual = 0;
3237 int metadata_chapters_manual = 0;
3247 "processing metadata maps\n", in_file_index);
3253 &metadata_global_manual, &metadata_streams_manual,
3254 &metadata_chapters_manual);
3261 if (chapters_input_file == INT_MAX) {
3263 chapters_input_file = -1;
3266 chapters_input_file =
i;
3271 chapters_input_file);
3275 if (chapters_input_file >= 0)
3277 !metadata_chapters_manual);
3294 const char *stream_spec =
NULL;
3301 "-keep_metadata:%s: chapter and program metadata filtering "
3302 "is not supported and will be ignored.\n", spec);
3303 }
else if (
type ==
's') {
3326 if (!metadata_streams_manual)
3356 int have_manual = 0;
3359 const char **dispositions;
3361 dispositions =
av_calloc(
ctx->nb_streams,
sizeof(*dispositions));
3366 for (
int i = 0;
i <
ctx->nb_streams;
i++) {
3371 for (
int i = 0;
i <
ctx->nb_streams;
i++) {
3378 have_manual |= !!dispositions[
i];
3381 ost->st->disposition =
ost->ist->st->disposition;
3384 have_default[
ost->type + 1] = 1;
3390 for (
int i = 0;
i <
ctx->nb_streams;
i++) {
3392 const char *disp = dispositions[
i];
3405 for (
int i = 0;
i <
ctx->nb_streams;
i++) {
3414 have_default[
type + 1] = 1;
3439 const Muxer *mux,
const char *spec)
3444 for (
const char *p = spec; *p; p++)
3451 if (!spec_dup || !
pts) {
3457 for (
i = 0;
i < n;
i++) {
3458 char *next = strchr(p,
',');
3463 if (strstr(p,
"chapters") == p) {
3468 if (nb_ch > INT_MAX -
size) {
3483 "Invalid chapter time offset: %s\n", p + 8);
3489 for (j = 0; j < nb_ch; j++) {
3528 const char *forced_keyframes =
NULL;
3531 mux->
fc,
ost->st, &forced_keyframes);
3534 ost->enc && forced_keyframes))
3537 if (!strncmp(forced_keyframes,
"expr:", 5)) {
3542 "Invalid force_key_frames expression '%s'\n", forced_keyframes + 5);
3545 ost->kf.expr_const_values[
FKF_N] = 0;
3552 }
else if (!strcmp(forced_keyframes,
"source")) {
3554 }
else if (!strcmp(forced_keyframes,
"scd_metadata")) {
3574 .class_name =
"OutputFile",
3611 if (stop_time != INT64_MAX && recording_time != INT64_MAX) {
3612 stop_time = INT64_MAX;
3616 if (stop_time != INT64_MAX && recording_time == INT64_MAX) {
3626 if (recording_time < 0) {
3637 if (!strcmp(filename,
"-"))
3652 if (recording_time != INT64_MAX)
3686 "Output filename '%s' does not contain a numeric pattern like "
3687 "'%%d', which is required by output format '%s'.\n",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
static const char *const format[]
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
static AVFormatContext * ctx
static AVDictionary * opts
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
Main libavfilter public API header.
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 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.
#define AVIO_FLAG_READ
read-only
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AVIO_FLAG_WRITE
write-only
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_r8(AVIOContext *s)
Convenience header that includes libavutil's core.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
#define is(width, name, range_min, range_max, subs,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
int check_avoptions(AVDictionary *m)
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
void * allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
Atomically add a new element to an array of pointers, i.e.
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst, AVDictionary **opts_used)
Filter out options for given codec.
char * read_file_to_string(const char *filename)
unsigned stream_specifier_match(const StreamSpecifier *ss, const AVFormatContext *s, const AVStream *st, void *logctx)
#define GROW_ARRAY(array, nb_elems)
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
AVCodecParameters * avcodec_parameters_alloc(void)
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
const AVIOInterruptCB int_cb
FilterGraph ** filtergraphs
int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used, void *logctx, int decode)
OutputFile ** output_files
InputStream * ist_iter(InputStream *prev)
int muxer_thread(void *arg)
int of_stream_init(OutputFile *of, OutputStream *ost, const AVCodecContext *enc_ctx)
int enc_alloc(Encoder **penc, const AVCodec *codec, Scheduler *sch, unsigned sch_idx, void *log_parent)
@ VIEW_SPECIFIER_TYPE_NONE
int parse_and_set_vsync(const char *arg, enum VideoSyncMethod *vsync_var, int file_idx, int st_idx)
int ignore_unknown_streams
int ist_use(InputStream *ist, int decoding_needed, const ViewSpecifier *vs, SchedulerNode *src)
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
int encoder_thread(void *arg)
int enc_open(void *opaque, const AVFrame *frame)
void opt_match_per_stream_int(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int *out)
int assert_file_overwrite(const char *filename)
void opt_match_per_stream_dbl(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, double *out)
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
@ OFILTER_FLAG_AUDIO_24BIT
@ OFILTER_FLAG_DISABLE_CONVERT
void opt_match_per_stream_int64(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int64_t *out)
int fg_create_simple(FilterGraph **pfg, InputStream *ist, char **graph_desc, Scheduler *sch, unsigned sched_idx_enc, const OutputFilterOptions *opts)
int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc, const OutputFilterOptions *opts)
void opt_match_per_stream_str(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, const char **out)
int mux_check_init(void *arg)
static MuxStream * ms_from_ost(OutputStream *ost)
static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
#define SET_DICT(type, meta, context, index)
#define SERIALIZE_LOOP_SUBBLOCK(obj)
static int parse_stereo3d_type(void *logctx, const char *arg, int *type)
static int of_parse_iamf_audio_element_layers(Muxer *mux, AVStreamGroup *stg, char *ptr)
#define SERIALIZE_LOOP(parent, child, suffix, separator)
static int of_parse_group_token(Muxer *mux, const char *token, char *ptr)
static int create_streams(Muxer *mux, const OptionsContext *o)
static int streamcopy_init(const OptionsContext *o, const Muxer *mux, OutputStream *ost, AVDictionary **encoder_opts)
#define IS_AV_ENC(ost, type)
static int meta_spec_matches(void *log_ctx, AVFormatContext *oc, AVStream *st, const char *spec)
static const char *const forced_keyframes_const_names[]
static int of_add_programs(Muxer *mux, const OptionsContext *o)
static const char * output_file_item_name(void *obj)
static int reenc_delete_metadata_key(const OptionsContext *o, void *log_ctx, AVFormatContext *oc, AVStream *st, const char *family, const char *key, int flags)
static int map_manual(Muxer *mux, const OptionsContext *o, const StreamMap *map)
#define SERIALIZE(parent, child)
static int of_add_attachments(Muxer *mux, const OptionsContext *o)
static int of_add_metadata(OutputFile *of, AVFormatContext *oc, const OptionsContext *o)
static const struct @155315260326237246327062132355032355213237357165 reenc_delete_keys[]
static int of_map_group(Muxer *mux, AVDictionary **dict, AVBPrint *bp, const char *map)
static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *os, int copy_metadata)
static int map_auto_data(Muxer *mux, const OptionsContext *o)
static const AVClass output_stream_class
static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc, OutputStream *ost, char **dst)
#define DEFAULT_PASS_LOGFILENAME_PREFIX
static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
static int parse_forced_key_frames(void *log, KeyframeForceCtx *kf, const Muxer *mux, const char *spec)
static const char * output_stream_item_name(void *obj)
static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_us, int shortest)
static int copy_meta(Muxer *mux, const OptionsContext *o)
static int unescape(char **pdst, size_t *dst_len, const char **pstr, char delim)
static int reenc_delete_stale_metadata(const OptionsContext *o, void *log_ctx, AVFormatContext *oc, AVStream *st, AVDictionary **dict, const char *kind, unsigned reenc_mask)
static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, InputStream *ist, OutputFilter *ofilter, const ViewSpecifier *vs, OutputStream **post)
static int compare_int64(const void *a, const void *b)
static int enc_stats_init(OutputStream *ost, EncStats *es, int pre, const char *path, const char *fmt_spec)
static int map_auto_video(Muxer *mux, const OptionsContext *o)
static int64_t get_stream_group_index_from_id(Muxer *mux, int64_t id)
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
static int enc_stats_get_file(AVIOContext **io, const char *path)
#define IS_INTERLEAVED(type)
static int new_stream_subtitle(Muxer *mux, const OptionsContext *o, OutputStream *ost)
static int process_forced_keyframes(Muxer *mux, const OptionsContext *o)
void of_enc_stats_close(void)
static int set_encoder_id(OutputStream *ost, const AVCodec *codec)
static MuxStream * mux_stream_alloc(Muxer *mux, enum AVMediaType type)
static char * get_line(AVIOContext *s, AVBPrint *bprint)
static Muxer * mux_alloc(void)
static int parse_meta_type(void *logctx, const char *arg, char *type, int *index, const char **stream_spec)
Parse a metadata specifier passed as 'arg' parameter.
static int set_dispositions(Muxer *mux, const OptionsContext *o)
static int check_stereo3d_leftovers(Muxer *mux, const OptionsContext *o)
static int new_stream_audio(Muxer *mux, const OptionsContext *o, OutputStream *ost)
static int choose_encoder(const OptionsContext *o, AVFormatContext *s, MuxStream *ms, const AVCodec **enc)
static const AVClass output_file_class
static int nb_enc_stats_files
static int parse_matrix_coeffs(void *logctx, uint16_t *dest, const char *str)
static int of_parse_iamf_submixes(Muxer *mux, AVStreamGroup *stg, char *ptr)
static int check_opt_bitexact(void *ctx, const AVDictionary *opts, const char *opt_name, int flag)
static int map_auto_audio(Muxer *mux, const OptionsContext *o)
static int copy_metadata(Muxer *mux, AVFormatContext *ic, const char *outspec, const char *inspec, int *metadata_global_manual, int *metadata_streams_manual, int *metadata_chapters_manual)
static int map_auto_subtitle(Muxer *mux, const OptionsContext *o)
static EncStatsFile * enc_stats_files
static int pixfmt_in_list(const enum AVPixelFormat *formats, enum AVPixelFormat format)
static int of_add_groups(Muxer *mux, const OptionsContext *o)
static int of_serialize_options(Muxer *mux, void *obj, AVBPrint *bp)
static int new_stream_video(Muxer *mux, const OptionsContext *o, OutputStream *ost, int *keep_pix_fmt, enum VideoSyncMethod *vsync_method)
static int ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, const OptionsContext *o, AVRational enc_tb, enum VideoSyncMethod vsync_method, int keep_pix_fmt, int autoscale, int threads_manual, const ViewSpecifier *vs, SchedulerNode *src)
static enum AVPixelFormat choose_pixel_fmt(const AVCodecContext *avctx, enum AVPixelFormat target)
int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_idx, unsigned dec_idx)
int sch_add_sq_enc(Scheduler *sch, uint64_t buf_size_us, void *logctx)
Add an pre-encoding sync queue to the scheduler.
int sch_sq_add_enc(Scheduler *sch, unsigned sq_idx, unsigned enc_idx, int limiting, uint64_t max_frames)
void sch_mux_stream_buffering(Scheduler *sch, unsigned mux_idx, unsigned stream_idx, size_t data_threshold, int max_packets)
Configure limits on packet buffering performed before the muxer task is started.
int sch_add_enc(Scheduler *sch, SchThreadFunc func, void *ctx, int(*open_cb)(void *opaque, const AVFrame *frame))
Add an encoder to the scheduler.
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst)
int sch_add_mux(Scheduler *sch, SchThreadFunc func, int(*init)(void *), void *arg, int sdp_auto, unsigned thread_queue_size)
Add a muxer to the scheduler.
int sch_add_mux_stream(Scheduler *sch, unsigned mux_idx)
Add a muxed stream for a previously added muxer.
#define SCH_MSTREAM(file, stream)
static const char * subtitle_codec_name
static int64_t start_time
static unsigned int nb_streams
static FILE * fopen_utf8(const char *path, const char *mode)
static const uint8_t frame_size[4]
static char * getenv_utf8(const char *varname)
static void freeenv_utf8(char *var)
#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_INT
Underlying C type is int.
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
#define AV_CODEC_FLAG2_FIXED_FRAME_SIZE
Force audio encoders to use a fixed frame size.
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_CODEC_PROP_BITMAP_SUB
Subtitle codec is bitmap based Decoded AVSubtitle data can be read from the AVSubtitleRect->pict fiel...
#define AV_CODEC_PROP_ENHANCEMENT
Video codec contains enhancement information meant to be applied to other existing frames,...
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
#define AV_CODEC_PROP_TEXT_SUB
Subtitle codec is text based.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out, int *out_num)
Retrieve a list of all supported values for a given configuration type.
@ AVDISCARD_ALL
discard all
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
@ AV_CODEC_CONFIG_SAMPLE_FORMAT
AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE.
@ AV_CODEC_CONFIG_ALPHA_MODE
AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED.
@ AV_CODEC_CONFIG_FRAME_RATE
AVRational, terminated by {0, 0}.
@ AV_CODEC_CONFIG_COLOR_SPACE
AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED.
@ AV_CODEC_CONFIG_COLOR_RANGE
AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED.
@ AV_CODEC_CONFIG_SAMPLE_RATE
int, terminated by 0
@ AV_CODEC_CONFIG_CHANNEL_LAYOUT
AVChannelLayout, terminated by {0}.
AVPacketSideData * av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
Allocate a new packet side data.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
AVProgram * av_new_program(AVFormatContext *ac, int id)
AVStreamGroup * avformat_stream_group_create(AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
Add a new empty stream group to a media file.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
Guess the codec ID based upon muxer and filename.
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
int av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
Get the codec tag for the given codec id.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AV_BPRINT_SIZE_UNLIMITED
Buffer will be reallocated as necessary, with an amortized linear cost.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
#define AV_BPRINT_SIZE_AUTOMATIC
Use the exact size available in the AVBPrint structure itself.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Init a print buffer.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
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.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVIAMFLayer * av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element)
Allocate a layer and add it to a given AVIAMFAudioElement.
AVIAMFSubmixLayout * av_iamf_submix_add_layout(AVIAMFSubmix *submix)
Allocate a submix layout and add it to a given AVIAMFSubmix.
AVIAMFSubmix * av_iamf_mix_presentation_add_submix(AVIAMFMixPresentation *mix_presentation)
Allocate a submix and add it to a given AVIAMFMixPresentation.
AVIAMFSubmixElement * av_iamf_submix_add_element(AVIAMFSubmix *submix)
Allocate a submix element and add it to a given AVIAMFSubmix.
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified idx.
AVIAMFParamDefinition * av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type, unsigned int nb_subblocks, size_t *out_size)
Allocates memory for AVIAMFParamDefinition, plus an array of nb_subblocks amount of subblocks of the ...
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
#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_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
void * av_calloc(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes,...
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.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
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 AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
AVStereo3DType
List of possible 3D Types.
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, const char key_val_sep, const char pairs_sep)
Serialize object's options.
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags)
Check if given option is set to its default value.
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN
Serialize options in possible children of the given object.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
const VDPAUPixFmtMap * map
static int mix(int c0, int c1)
Immersive Audio Model and Formats API header.
@ AV_CLASS_CATEGORY_MUXER
#define MKTAG(a, b, c, d)
#define FFDIFFSIGN(x, y)
Comparator.
static const alias aliases[20]
Memory handling functions.
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int av_parse_ratio(AVRational *q, const char *str, int max, int log_offset, void *log_ctx)
Parse str and store the parsed ratio in q.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVPixelFormat
Pixel format.
static const ElemCat * elements[ELEMENT_COUNT]
#define FF_ARRAY_ELEMS(a)
Buffer to print data progressively.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
int64_t id
unique ID to identify the chapter
int64_t end
chapter start/end time in time_base units
AVRational time_base
time base in which the start/end timestamps are specified
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...
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
uint16_t * chroma_intra_matrix
custom intra quantization matrix
int width
picture width / height.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
enum AVColorRange color_range
MPEG vs JPEG YUV range.
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
int rc_override_count
ratecontrol override, see RcOverride
uint16_t * inter_matrix
custom inter quantization matrix Must be allocated with the av_malloc() family of functions,...
const struct AVCodec * codec
enum AVColorSpace colorspace
YUV colorspace type.
int sample_rate
samples per second
uint16_t * intra_matrix
custom intra quantization matrix Must be allocated with the av_malloc() family of functions,...
int flags
AV_CODEC_FLAG_*.
enum AVAlphaMode alpha_mode
Indicates how the alpha channel of the video is represented.
This struct describes the properties of a single codec described by an AVCodecID.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
int nb_coded_side_data
Amount of entries in coded_side_data.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
AVRational sample_aspect_ratio
The aspect ratio (width/height) which a single pixel should have when displayed.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
const char * name
Name of the codec implementation.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
AVIOContext * pb
I/O context.
AVDictionary * metadata
Metadata that applies to the whole file.
int flags
Flags modifying the (de)muxer behaviour.
const struct AVOutputFormat * oformat
The output container format.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
char * url
input or output URL.
unsigned int nb_chapters
Number of chapters in AVChapter array.
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
A layer defining a Channel Layout in the Audio Element.
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Parameters as defined in section 3.6.1 of IAMF.
unsigned int nb_subblocks
Number of subblocks in the array.
Submix element as defined in section 3.7 of IAMF.
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
unsigned int audio_element_id
The id of the Audio Element this submix element references.
Submix layout as defined in section 3.7.6 of IAMF.
Submix layout as defined in section 3.7 of IAMF.
unsigned int nb_elements
Number of elements in the submix.
AVIAMFSubmixElement ** elements
Array of submix elements.
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
enum AVPacketSideDataType type
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
New fields can be added to the end with minor version bumps.
Rational number (pair of numerator and denominator).
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
int width
Width of the final image for presentation.
int height
Height of the final image for presentation.
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
struct AVIAMFMixPresentation * iamf_mix_presentation
struct AVStreamGroupTileGrid * tile_grid
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
unsigned int index
Group index in AVFormatContext.
struct AVIAMFAudioElement * iamf_audio_element
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
int64_t id
Group type-specific group ID.
AVStream ** streams
A list of streams in the group.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t duration
Decoding: duration of the stream, in stream time base.
int id
Format-specific stream ID.
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int event_flags
Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
AVRational r_frame_rate
Real base framerate of the stream.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
EncStatsComponent * components
AVCodecParameters * par_in
Codec parameters for packets submitted to the muxer (i.e.
int copy_initial_nonkeyframes
AVRational stream_duration_tb
AVRational max_frame_rate
AVDictionary * enc_opts_used
AVDictionary * codec_opts
AVDictionary * format_opts
SpecifierOptList rc_overrides
SpecifierOptList enc_stats_pre
SpecifierOptList metadata_map
SpecifierOptList frame_pix_fmts
SpecifierOptList intra_matrices
SpecifierOptList enc_stats_post_fmt
SpecifierOptList codec_tags
SpecifierOptList stream_groups
SpecifierOptList enc_stats_post
SpecifierOptList codec_names
SpecifierOptList mux_stats
SpecifierOptList disposition
SpecifierOptList audio_channels
SpecifierOptList inter_matrices
SpecifierOptList stereo3ds
SpecifierOptList mux_stats_fmt
SpecifierOptList muxing_queue_data_threshold
SpecifierOptList copy_prior_start
SpecifierOptList time_bases
SpecifierOptList frame_rates
SpecifierOptList forced_key_frames
float shortest_buf_duration
SpecifierOptList keep_metadata
SpecifierOptList enc_stats_pre_fmt
SpecifierOptList force_fps
SpecifierOptList max_frame_rates
SpecifierOptList fps_mode
SpecifierOptList copy_initial_nonkeyframes
SpecifierOptList enc_reinit_opts
SpecifierOptList max_muxing_queue_size
SpecifierOptList bits_per_raw_sample
const char ** attachments
SpecifierOptList passlogfiles
SpecifierOptList enc_time_bases
SpecifierOptList audio_sample_rate
SpecifierOptList sample_fmts
SpecifierOptList frame_aspect_ratios
SpecifierOptList autoscale
SpecifierOptList max_frames
SpecifierOptList metadata
SpecifierOptList bitstream_filters
SpecifierOptList chroma_intra_matrices
SpecifierOptList fix_sub_duration_heartbeat
SpecifierOptList frame_sizes
SpecifierOptList audio_ch_layouts
int64_t start_time
start time in microseconds == AV_TIME_BASE units
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
struct FilterGraph * graph
StreamSpecifier stream_spec
union SpecifierOpt::@356325016025214271156003270003007057215065005026 u
void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx, uint64_t frames)
Limit the number of output frames for stream with index stream_idx to max_frames.
int sq_add_stream(SyncQueue *sq, int limiting)
Add a new stream to the sync queue.
SyncQueue * sq_alloc(enum SyncQueueType type, int64_t buf_size_us, void *logctx)
Allocate a sync queue of the given type.
#define av_malloc_array(a, b)
#define av_realloc_f(p, o, n)