Go to the documentation of this file.
51 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
54 const char *opt_name,
int flag)
73 const char *codec_name =
NULL;
82 if (codec_name && strcmp(codec_name,
"copy")) {
85 "Encoder '%s' specified, but only '-codec copy' supported "
86 "for %s streams\n", codec_name, type_str);
97 "Default encoder for format %s (codec %s) is "
98 "probably disabled. Please choose an encoder manually.\n",
102 }
else if (strcmp(codec_name,
"copy")) {
106 ost->par_in->codec_id = (*enc)->
id;
129 char *env_avconv_datadir =
getenv_utf8(
"AVCONV_DATADIR");
131 const char *
base[3] = { env_avconv_datadir,
140 snprintf(filename,
sizeof(filename),
"%s%s/%s-%s.avpreset",
base[
i],
141 i != 1 ?
"" :
"/.avconv", codec_name, preset_name);
145 snprintf(filename,
sizeof(filename),
"%s%s/%s.avpreset",
base[
i],
146 i != 1 ?
"" :
"/.avconv", preset_name);
207 const char **pstr,
char delim)
209 const char *str = *pstr;
223 for (idx = 0; *str; idx++, str++) {
224 if (str[0] ==
'\\' && str[1])
226 else if (*str == delim)
246 const char *path,
const char *fmt_spec)
248 static const struct {
252 unsigned post_only:1;
253 unsigned need_input_data:1;
274 const char *next = fmt_spec;
298 c->str_len = val_len;
312 "Empty formatting directive in: %s\n", fmt_spec);
318 "Missing closing brace in: %s\n", fmt_spec);
331 if (!strcmp(
val, fmt_specs[
i].str)) {
332 if ((pre && fmt_specs[
i].post_only) || (!pre && fmt_specs[
i].pre_only)) {
334 "Format directive '%s' may only be used %s-encoding\n",
335 val, pre ?
"post" :
"pre");
340 c->type = fmt_specs[
i].type;
342 if (fmt_specs[
i].need_input_data && !
ost->ist) {
344 "Format directive '%s' is unavailable, because "
345 "this output stream has no associated input stream\n",
419 #if FFMPEG_OPT_FILTER_SCRIPT
420 const char *filters_script =
NULL;
433 "%s '%s' was specified, but codec copy was selected. "
434 "Filtering and streamcopy cannot be used together.\n",
436 filters ?
"Filtergraph" :
"Filtergraph script",
454 "%s '%s' was specified for a stream fed from a complex "
455 "filtergraph. Simple and complex filtering cannot be used "
456 "together for the same stream.\n",
458 filters ?
"Filtergraph" :
"Filtergraph script",
469 #if FFMPEG_OPT_FILTER_SCRIPT
470 if (filters_script &&
filters) {
489 for (
int i = 0;;
i++) {
496 "Syntax error in matrix \"%s\" at coeff %d\n", str,
i);
519 int has_alpha =
desc ?
desc->nb_components % 2 == 0 : 0;
524 0, (
const void **) &p,
NULL);
536 "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
558 0, (
const void **) &fmts,
NULL);
569 int len = strlen(name_canonical);
571 if (strcmp(
name, name_canonical) &&
572 (!strcmp(name_canonical +
len - 2,
"le") ||
573 !strcmp(name_canonical +
len - 2,
"be"))) {
577 snprintf(name_other,
sizeof(name_other),
"%s%ce",
578 name, name_canonical[
len - 2] ==
'l' ?
'b' :
'l');
601 const char *frame_rate =
NULL, *max_frame_rate =
NULL, *frame_aspect_ratio =
NULL;
618 if (frame_rate && max_frame_rate) {
624 if (frame_aspect_ratio) {
627 q.
num <= 0 || q.
den <= 0) {
631 ost->frame_aspect_ratio = q;
636 const char *p =
NULL, *fps_mode =
NULL;
638 const char *frame_pix_fmt =
NULL;
639 const char *intra_matrix =
NULL, *inter_matrix =
NULL;
640 const char *chroma_intra_matrix =
NULL;
654 if (frame_pix_fmt && *frame_pix_fmt ==
'+') {
656 if (!*++frame_pix_fmt)
657 frame_pix_fmt =
NULL;
675 if (chroma_intra_matrix) {
692 for (
i = 0; p;
i++) {
694 int e = sscanf(p,
"%d,%d,%d", &start, &end, &q);
731 if (
ost->logfile_prefix &&
737 char logfilename[1024];
741 for (
int idx = 0; idx <=
ost->file->
index; idx++)
744 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
745 ost->logfile_prefix ?
ost->logfile_prefix :
746 DEFAULT_PASS_LOGFILENAME_PREFIX,
748 if (!strcmp(
ost->enc_ctx->codec->name,
"libx264") || !strcmp(
ost->enc_ctx->codec->name,
"libvvenc")) {
755 char *logbuffer =
file_read(logfilename);
768 "Cannot write log file '%s' for pass-1 encoding: %s\n",
769 logfilename, strerror(errno));
780 ost->top_field_first = -1;
782 if (
ost->top_field_first >= 0)
798 if ((
ost->frame_rate.num ||
ost->max_frame_rate.num) &&
802 "together a non-CFR -vsync/-fps_mode. This is contradictory.\n");
807 if (
ost->frame_rate.num ||
ost->max_frame_rate.num) {
828 #if FFMPEG_OPT_VSYNC_DROP
848 const char *sample_fmt =
NULL;
890 int input_props = 0, output_props = 0;
902 if (input_descriptor)
904 if (output_descriptor)
906 if (input_props && output_props && input_props != output_props) {
908 "Subtitle encoding currently only possible from text to text "
909 "or bitmap to bitmap\n");
921 int keep_pix_fmt,
int autoscale,
int threads_manual,
930 .enc = enc_ctx->
codec,
934 .width = enc_ctx->
width,
935 .height = enc_ctx->
height,
938 .vsync_method = vsync_method,
961 (
const void **) &
opts.formats,
NULL);
965 if (!
ost->force_fps) {
968 (
const void **) &
opts.frame_rates,
NULL);
974 (
const void **) &
opts.color_spaces,
NULL);
979 (
const void **) &
opts.color_ranges,
NULL);
985 (
const void **) &
opts.formats,
NULL);
990 (
const void **) &
opts.sample_rates,
NULL);
995 (
const void **) &
opts.ch_layouts,
NULL);
1000 if (threads_manual) {
1007 ost->filter = ofilter;
1050 "Error setting up codec context options.\n");
1057 "Error getting reference codec parameters.\n");
1063 unsigned int codec_tag_tmp;
1120 if (
ost->frame_aspect_ratio.num) {
1125 "with stream copy may produce invalid files\n");
1152 int ret = 0, keep_pix_fmt = 0, autoscale = 1;
1153 int threads_manual = 0;
1156 const char *bsfs =
NULL, *time_base =
NULL, *codec_tag =
NULL;
1170 if (ist || ofilter) {
1193 st->
id = strtol(e->
value, &p, 0);
1194 if (!e->
value[0] || *p) {
1210 ost->par_in->codec_type =
type;
1239 "Streamcopy requested for output stream fed "
1240 "from a complex filtergraph. Filtering and streamcopy "
1241 "cannot be used together.\n");
1268 const char *enc_stats_pre =
NULL, *enc_stats_post =
NULL, *mux_stats =
NULL;
1272 oc, st,
ost->enc_ctx->codec, &encoder_opts,
1290 if (!buf[0] || buf[0] ==
'#')
1292 if (!(
arg = strchr(buf,
'='))) {
1299 }
while (!
s->eof_reached);
1305 "Preset %s specified, but could not be opened.\n",
preset);
1310 if (enc_stats_pre &&
1312 const char *
format =
"{fidx} {sidx} {n} {t}";
1322 if (enc_stats_post &&
1324 const char *
format =
"{fidx} {sidx} {n} {t}";
1336 const char *
format =
"{fidx} {sidx} {n} {t}";
1348 "-enc_time_base not supported for subtitles, ignoring\n");
1349 else if (enc_time_base) {
1352 if (!strcmp(enc_time_base,
"demux")) {
1354 }
else if (!strcmp(enc_time_base,
"filter")) {
1358 if (
ret < 0 || q.
den <= 0
1367 #if FFMPEG_OPT_ENC_TIME_BASE_NUM
1370 " use -enc_time_base demux\n");
1391 if (!threads_manual)
1392 ost->enc_ctx->thread_count = 0;
1395 NULL, &encoder_opts,
1404 }
else if (
ost->enc_ctx) {
1412 q.
num <= 0 || q.
den <= 0) {
1425 av_log(
ost,
AV_LOG_WARNING,
"Applying unspecific -frames to non video streams, maybe you meant -vframes ?\n");
1433 if (bsfs && *bsfs) {
1443 uint32_t
tag = strtol(codec_tag, &next, 0);
1445 uint8_t buf[4] = { 0 };
1446 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
1450 ost->par_in->codec_tag =
tag;
1452 ost->enc_ctx->codec_tag =
tag;
1456 if (
ost->enc_ctx && qscale >= 0) {
1462 int max_muxing_queue_size = 128;
1463 int muxing_queue_data_threshold = 50 * 1024 * 1024;
1466 &max_muxing_queue_size);
1468 oc, st, &muxing_queue_data_threshold);
1471 max_muxing_queue_size, muxing_queue_data_threshold);
1475 &
ost->bits_per_raw_sample);
1478 oc, st, &
ost->fix_sub_duration_heartbeat);
1502 keep_pix_fmt, autoscale, threads_manual, vs);
1505 }
else if (
ost->ist) {
1507 if (sched_idx < 0) {
1509 "Error binding an input stream\n");
1533 if (
ost->ist && !
ost->enc) {
1571 int file_best_score = 0;
1586 if (score > file_best_score) {
1589 file_best_score = score;
1590 file_best_ist = ist;
1593 if (file_best_ist) {
1594 if((qcr ==
MKTAG(
'A',
'P',
'I',
'C')) ||
1597 if (file_best_score > best_score) {
1598 best_score = file_best_score;
1599 best_ist = file_best_ist;
1622 int file_best_score = 0;
1634 if (score > file_best_score) {
1635 file_best_score = score;
1636 file_best_ist = ist;
1639 if (file_best_ist) {
1641 if (file_best_score > best_score) {
1642 best_score = file_best_score;
1643 best_ist = file_best_ist;
1670 int input_props = 0, output_props = 0;
1675 if (input_descriptor)
1677 if (output_descriptor)
1680 input_props & output_props ||
1682 input_descriptor && output_descriptor &&
1683 (!input_descriptor->
props ||
1684 !output_descriptor->
props)) {
1705 ist->st->codecpar->codec_id ==
codec_id) {
1723 if (
map->linklabel) {
1732 if (linklabel && !strcmp(linklabel,
map->linklabel)) {
1741 "in any defined filter graph, or was already used elsewhere.\n",
map->linklabel);
1746 "mapped complex filtergraph %d, output [%s]\n", fg->
index,
map->linklabel);
1758 map->file_index,
map->stream_index);
1773 "Cannot map stream #%d:%d - unsupported type.\n",
1774 map->file_index,
map->stream_index);
1777 "If you want unsupported types ignored instead "
1778 "of failing, please use the -ignore_unknown option\n"
1779 "If you want them copied, please use -copy_unknown\n");
1787 "View specifier given for mapping a %s input stream\n",
1807 uint8_t *attachment;
1808 char *attachment_filename;
1840 else if (err !=
len) {
1857 if (!attachment_filename) {
1869 ost->attachment_filename = attachment_filename;
1870 ost->par_in->extradata = attachment;
1871 ost->par_in->extradata_size =
len;
1908 auto_disable |= 1 << ofilter->
type;
1911 "output of complex filtergraph %d.", fg->
index);
1928 if (!map_func[
i] || auto_disable & (1 <<
i))
1930 ret = map_func[
i](mux, o);
1952 if (!
src->ost.fix_sub_duration_heartbeat)
1955 for (
unsigned j = 0; j < oc->
nb_streams; j++) {
1959 !
dst->ost.enc || !
dst->ost.ist || !
dst->ost.ist->fix_sub_duration)
2005 int64_t buf_size_us,
int shortest)
2008 int nb_av_enc = 0, nb_audio_fs = 0, nb_interleaved = 0;
2009 int limit_frames = 0, limit_frames_av_enc = 0;
2011 #define IS_AV_ENC(ost, type) \
2012 (ost->enc_ctx && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))
2013 #define IS_INTERLEAVED(type) (type != AVMEDIA_TYPE_ATTACHMENT)
2022 nb_interleaved += IS_INTERLEAVED(
type);
2023 nb_av_enc += IS_AV_ENC(
ost,
type);
2031 if (!((nb_interleaved > 1 && shortest) ||
2032 (nb_interleaved > 0 && limit_frames) ||
2047 if ((shortest && nb_av_enc > 1) || limit_frames_av_enc || nb_audio_fs) {
2072 if (nb_interleaved > nb_av_enc) {
2086 if (!IS_INTERLEAVED(
type))
2100 #undef IS_INTERLEAVED
2125 int demixing = 0, recon_gain = 0;
2129 ptr += strspn(ptr,
" \n\t\r");
2134 else if (
av_strstart(token,
"recon_gain=", &token))
2152 }
else if (demixing || recon_gain) {
2187 char *submix_str =
NULL;
2194 const char *subtoken;
2195 char *subptr =
NULL;
2198 ptr += strspn(ptr,
" \n\t\r");
2200 av_log(mux,
AV_LOG_ERROR,
"No submix in mix presentation specification \"%s\"\n", token);
2222 subtoken =
av_strtok(submix_str,
"|", &subptr);
2225 int element = 0,
layout = 0;
2228 subptr += strspn(subptr,
" \n\t\r");
2231 else if (
av_strstart(subtoken,
"layout=", &subtoken))
2243 char *endptr =
NULL;
2247 idx = strtoll(e->
value, &endptr, 0);
2251 "submix element specification \"%s\"\n", subtoken);
2256 if (!submix_element) {
2272 if (!submix_layout) {
2297 av_log(mux,
AV_LOG_ERROR,
"No audio elements in submix specification \"%s\"\n", token);
2329 #define SERIALIZE(parent, child) do { \
2330 ret = of_serialize_options(mux, parent->child, bp); \
2335 #define SERIALIZE_LOOP_SUBBLOCK(obj) do { \
2336 for (int k = 0; k < obj->nb_subblocks; k++) { \
2337 ret = of_serialize_options(mux, \
2338 av_iamf_param_definition_get_subblock(obj, k), bp); \
2344 #define SERIALIZE_LOOP(parent, child, suffix, separator) do { \
2345 for (int j = 0; j < parent->nb_## child ## suffix; j++) { \
2346 av_bprintf(bp, separator#child "="); \
2347 SERIALIZE(parent, child ## suffix[j]); \
2365 int ret, file_idx, stream_idx;
2368 file_idx = strtol(
map, &ptr, 0);
2374 stream_idx = strtol(*ptr ==
'=' ? ptr + 1 : ptr, &ptr, 0);
2398 SERIALIZE(audio_element, demixing_info);
2401 SERIALIZE_LOOP_SUBBLOCK(demixing_info);
2406 SERIALIZE(audio_element, recon_gain_info);
2409 SERIALIZE_LOOP_SUBBLOCK(recon_gain_info);
2411 SERIALIZE_LOOP(audio_element, layer,
s,
",");
2417 for (
int i = 0;
i <
mix->nb_submixes;
i++) {
2422 SERIALIZE(
mix, submixes[
i]);
2425 SERIALIZE_LOOP_SUBBLOCK(output_mix_config);
2441 SERIALIZE_LOOP_SUBBLOCK(element_mix_config);
2446 SERIALIZE_LOOP(submix,
layout,
s,
"|");
2463 char *mapped_string =
NULL;
2480 const AVClass *pclass = &
class;
2509 ptr = mapped_string;
2538 if (*endptr || idx < 0 || idx >= oc->
nb_streams) {
2583 if (!strcmp(e->
key,
"st") || !strcmp(e->
key,
"stg"))
2605 char *str, *ptr =
NULL;
2615 ptr += strspn(ptr,
" \n\t\r");
2635 int ret, progid =
i + 1;
2672 if (!strcmp(e->
key,
"st"))
2697 char *
type,
int *
index,
const char **stream_spec)
2705 if (*(++
arg) && *
arg !=
':') {
2709 *stream_spec = *
arg ==
':' ?
arg + 1 :
"";
2713 if (*(++
arg) ==
':')
2732 const char *stream_spec;
2795 for (
int i = 0;
i <
is->nb_chapters;
i++) {
2804 if (in_ch->
end < ts_off)
2806 if (rt != INT64_MAX && in_ch->
start > rt + ts_off)
2813 out_ch->id = in_ch->
id;
2815 out_ch->start =
FFMAX(0, in_ch->
start - ts_off);
2816 out_ch->end =
FFMIN(rt, in_ch->
end - ts_off);
2827 const char *outspec,
const char *inspec,
2828 int *metadata_global_manual,
int *metadata_streams_manual,
2829 int *metadata_chapters_manual)
2835 char type_in, type_out;
2836 const char *istream_spec =
NULL, *ostream_spec =
NULL;
2837 int idx_in = 0, idx_out = 0;
2845 if (type_in ==
'g' || type_out ==
'g' || (!*outspec && !ic))
2846 *metadata_global_manual = 1;
2847 if (type_in ==
's' || type_out ==
's' || (!*outspec && !ic))
2848 *metadata_streams_manual = 1;
2849 if (type_in ==
'c' || type_out ==
'c' || (!*outspec && !ic))
2850 *metadata_chapters_manual = 1;
2856 #define METADATA_CHECK_INDEX(index, nb_elems, desc)\
2857 if ((index) < 0 || (index) >= (nb_elems)) {\
2858 av_log(mux, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
2860 return AVERROR(EINVAL);\
2863 #define SET_DICT(type, meta, context, index)\
2866 meta = &context->metadata;\
2869 METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
2870 meta = &context->chapters[index]->metadata;\
2873 METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
2874 meta = &context->programs[index]->metadata;\
2878 default: av_assert0(0);\
2881 SET_DICT(type_in, meta_in, ic, idx_in);
2882 SET_DICT(type_out, meta_out, oc, idx_out);
2885 if (type_in ==
's') {
2894 av_log(mux,
AV_LOG_FATAL,
"Stream specifier %s does not match any streams.\n", istream_spec);
2899 if (type_out ==
's') {
2918 int metadata_global_manual = 0;
2919 int metadata_streams_manual = 0;
2920 int metadata_chapters_manual = 0;
2930 "processing metadata maps\n", in_file_index);
2936 &metadata_global_manual, &metadata_streams_manual,
2937 &metadata_chapters_manual);
2944 if (chapters_input_file == INT_MAX) {
2946 chapters_input_file = -1;
2949 chapters_input_file =
i;
2954 chapters_input_file);
2958 if (chapters_input_file >= 0)
2960 !metadata_chapters_manual);
2973 if (!metadata_streams_manual)
2996 int have_manual = 0;
2999 const char **dispositions;
3013 have_manual |= !!dispositions[
i];
3019 have_default[
ost->type + 1] = 1;
3027 const char *disp = dispositions[
i];
3049 have_default[
type + 1] = 1;
3074 const Muxer *mux,
const char *spec)
3080 for (p = spec; *p; p++)
3089 for (
i = 0;
i < n;
i++) {
3090 char *next = strchr(p,
',');
3095 if (strstr(p,
"chapters") == p) {
3100 if (nb_ch > INT_MAX -
size) {
3113 "Invalid chapter time offset: %s\n", p + 8);
3119 for (j = 0; j < nb_ch; j++) {
3155 const char *forced_keyframes =
NULL;
3158 mux->
fc,
ost->st, &forced_keyframes);
3161 ost->enc_ctx && forced_keyframes))
3164 if (!strncmp(forced_keyframes,
"expr:", 5)) {
3169 "Invalid force_key_frames expression '%s'\n", forced_keyframes + 5);
3172 ost->kf.expr_const_values[
FKF_N] = 0;
3179 }
else if (!strcmp(forced_keyframes,
"source")) {
3181 #if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
3182 }
else if (!strcmp(forced_keyframes,
"source_no_drop")) {
3184 "-force_key_frames is deprecated, use just 'source'\n");
3199 const Muxer *mux = obj;
3242 if (stop_time != INT64_MAX && recording_time != INT64_MAX) {
3243 stop_time = INT64_MAX;
3247 if (stop_time != INT64_MAX && recording_time == INT64_MAX) {
3263 if (!strcmp(filename,
"-"))
3278 if (recording_time != INT64_MAX)
3312 "Output filename '%s' does not contain a numeric pattern like "
3313 "'%%d', which is required by output format '%s'.\n",
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
static int choose_encoder(const OptionsContext *o, AVFormatContext *s, OutputStream *ost, const AVCodec **enc)
static FILE * fopen_utf8(const char *path, const char *mode)
static int map_manual(Muxer *mux, const OptionsContext *o, const StreamMap *map)
AVIAMFSubmixElement ** elements
Array of submix elements.
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
int copy_initial_nonkeyframes
union AVStreamGroup::@363 params
Group type-specific parameters.
#define AV_LOG_WARNING
Something somehow does not look correct.
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
#define AV_BPRINT_SIZE_UNLIMITED
AVPixelFormat
Pixel format.
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
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 ost_get_filters(const OptionsContext *o, AVFormatContext *oc, OutputStream *ost, char **dst)
int64_t id
Group type-specific group ID.
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
struct FilterGraph * graph
SpecifierOptList force_fps
SpecifierOptList forced_key_frames
static int mix(int c0, int c1)
static MuxStream * ms_from_ost(OutputStream *ost)
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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
static int of_serialize_options(Muxer *mux, void *obj, AVBPrint *bp)
enum AVMediaType codec_type
General type of the encoded data.
enum AVColorSpace colorspace
YUV colorspace type.
int check_avoptions(AVDictionary *m)
static const ElemCat * elements[ELEMENT_COUNT]
int sample_rate
samples per second
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
The official guide to swscale for confused that is
unsigned int nb_chapters
Number of chapters in AVChapter array.
This struct describes the properties of an encoded stream.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int enc_open(void *opaque, const AVFrame *frame)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
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.
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.
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
@ AV_CODEC_CONFIG_SAMPLE_RATE
int, terminated by 0
static int of_parse_iamf_audio_element_layers(Muxer *mux, AVStreamGroup *stg, char *ptr)
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
#define SCH_DSTREAM(file, stream)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define FFMPEG_OPT_ENC_TIME_BASE_NUM
SpecifierOptList bits_per_raw_sample
uint16_t * intra_matrix
custom intra quantization matrix Must be allocated with the av_malloc() family of functions,...
SpecifierOptList audio_ch_layouts
InputStream * ist_iter(InputStream *prev)
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
int64_t start_time
start time in microseconds == AV_TIME_BASE units
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
AVStream ** streams
A list of all streams in the file.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
static const char * subtitle_codec_name
@ AV_CODEC_CONFIG_COLOR_RANGE
AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED.
SpecifierOptList passlogfiles
static enum AVPixelFormat choose_pixel_fmt(const AVCodecContext *avctx, enum AVPixelFormat target)
AVRational avg_frame_rate
Average framerate.
#define AV_LOG_VERBOSE
Detailed information.
static void freeenv_utf8(char *var)
Parameters as defined in section 3.6.1 of IAMF.
static int64_t get_stream_group_index_from_id(Muxer *mux, int64_t id)
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
enum AVChannelOrder order
Channel order used in this layout.
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
static int parse_forced_key_frames(void *log, KeyframeForceCtx *kf, const Muxer *mux, const char *spec)
int nb_channels
Number of channels in this layout.
static int enc_stats_init(OutputStream *ost, EncStats *es, int pre, const char *path, const char *fmt_spec)
static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, InputStream *ist, OutputFilter *ofilter, const ViewSpecifier *vs, OutputStream **post)
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int parse_matrix_coeffs(void *logctx, uint16_t *dest, const char *str)
SpecifierOptList frame_pix_fmts
static int set_dispositions(Muxer *mux, const OptionsContext *o)
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.
AVRational stream_duration_tb
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
static int ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, const OptionsContext *o, char *filters, AVRational enc_tb, enum VideoSyncMethod vsync_method, int keep_pix_fmt, int autoscale, int threads_manual, const ViewSpecifier *vs)
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
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.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
static int map_auto_subtitle(Muxer *mux, const OptionsContext *o)
SpecifierOptList max_frame_rates
#define AV_OPT_SERIALIZE_SEARCH_CHILDREN
Serialize options in possible children of the given object.
AVIAMFSubmix * av_iamf_mix_presentation_add_submix(AVIAMFMixPresentation *mix_presentation)
Allocate a submix and add it to a given AVIAMFMixPresentation.
const struct AVCodec * codec
static int of_parse_group_token(Muxer *mux, const char *token, char *ptr)
AVChannelLayout ch_layout
Audio channel layout.
static Muxer * mux_alloc(void)
void opt_match_per_stream_int(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int *out)
SpecifierOptList enc_stats_pre_fmt
SpecifierOptList mux_stats_fmt
Submix layout as defined in section 3.7.6 of IAMF.
int sch_add_mux_stream(Scheduler *sch, unsigned mux_idx)
Add a muxed stream for a previously added muxer.
static int copy_meta(Muxer *mux, const OptionsContext *o)
#define AV_BPRINT_SIZE_AUTOMATIC
int flags
AV_CODEC_FLAG_*.
static double val(void *priv, double ch)
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
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
AVProgram * av_new_program(AVFormatContext *ac, int id)
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
int64_t duration
Decoding: duration of the stream, in stream time base.
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.
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS
Serialize options that are not set to default values only.
static EncStatsFile * enc_stats_files
static int new_stream_video(Muxer *mux, const OptionsContext *o, OutputStream *ost, int *keep_pix_fmt, enum VideoSyncMethod *vsync_method)
#define FFDIFFSIGN(x, y)
Comparator.
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
void opt_match_per_stream_int64(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int64_t *out)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
#define FF_ARRAY_ELEMS(a)
AVDictionary * codec_opts
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,...
SpecifierOptList metadata
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
int init_simple_filtergraph(InputStream *ist, OutputStream *ost, char *graph_desc, Scheduler *sch, unsigned sch_idx_enc, const OutputFilterOptions *opts)
AVIAMFSubmixLayout * av_iamf_submix_add_layout(AVIAMFSubmix *submix)
Allocate a submix layout and add it to a given AVIAMFSubmix.
static const AVClass output_stream_class
EncStatsComponent * components
static int of_parse_iamf_submixes(Muxer *mux, AVStreamGroup *stg, char *ptr)
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int assert_file_overwrite(const char *filename)
int64_t end
chapter start/end time in time_base units
This struct describes the properties of a single codec described by an AVCodecID.
static MuxStream * mux_stream_alloc(Muxer *mux, enum AVMediaType type)
@ AV_CODEC_CONFIG_SAMPLE_FORMAT
AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE.
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.
SpecifierOptList intra_matrices
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
SpecifierOptList stream_groups
static int enc_stats_get_file(AVIOContext **io, const char *path)
static int of_add_groups(Muxer *mux, const OptionsContext *o)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int flags
Flags modifying the (de)muxer behaviour.
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
AVRational sample_aspect_ratio
Video only.
static const AVClass output_file_class
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified.
@ VIEW_SPECIFIER_TYPE_NONE
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
SpecifierOptList autoscale
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 char * get_line(AVIOContext *s, AVBPrint *bprint)
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const char * output_stream_item_name(void *obj)
static int of_add_metadata(OutputFile *of, AVFormatContext *oc, const OptionsContext *o)
#define AVIO_FLAG_WRITE
write-only
SpecifierOptList sample_fmts
unsigned int index
Group index in AVFormatContext.
int ignore_unknown_streams
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int encoder_thread(void *arg)
int nb_coded_side_data
Amount of entries in coded_side_data.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
int sq_add_stream(SyncQueue *sq, int limiting)
Add a new stream to the sync queue.
@ AVDISCARD_ALL
discard all
#define av_realloc_f(p, o, n)
AVDictionary * format_opts
static int new_stream_subtitle(Muxer *mux, const OptionsContext *o, OutputStream *ost)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avcodec_parameters_to_context(AVCodecContext *codec, const struct AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
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.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
@ AV_CODEC_CONFIG_FRAME_RATE
AVRational, terminated by {0, 0}.
SpecifierOptList audio_channels
static int map_auto_video(Muxer *mux, const OptionsContext *o)
static int nb_enc_stats_files
int sch_add_enc(Scheduler *sch, SchThreadFunc func, void *ctx, int(*open_cb)(void *opaque, const AVFrame *frame))
SpecifierOptList fix_sub_duration_heartbeat
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Rational number (pair of numerator and denominator).
@ OFILTER_FLAG_AUDIO_24BIT
SpecifierOptList copy_prior_start
enum AVPacketSideDataType type
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.
const char * av_default_item_name(void *ptr)
Return the context name.
static int streamcopy_init(const Muxer *mux, OutputStream *ost, AVDictionary **encoder_opts)
AVIOContext * pb
I/O context.
#define AV_CODEC_PROP_BITMAP_SUB
Subtitle codec is bitmap based Decoded AVSubtitle data can be read from the AVSubtitleRect->pict fiel...
A layer defining a Channel Layout in the Audio Element.
static char * getenv_utf8(const char *varname)
SpecifierOptList frame_aspect_ratios
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
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.
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.
SpecifierOptList max_frames
AVChannelLayout ch_layout
Audio only.
#define FFMPEG_OPT_FILTER_SCRIPT
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)
#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
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
AVCodecID
Identify the syntax and semantics of the bitstream.
unsigned int audio_element_id
The id of the Audio Element this submix element references.
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
Submix layout as defined in section 3.7 of IAMF.
char * file_read(const char *filename)
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int of_add_programs(Muxer *mux, const OptionsContext *o)
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.
@ AV_CODEC_CONFIG_CHANNEL_LAYOUT
AVChannelLayout, terminated by {0}.
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
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.
SpecifierOptList enc_stats_post_fmt
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
SpecifierOptList enc_stats_pre
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
OutputFile ** output_files
#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.
enum AVSampleFormat sample_fmt
audio sample format
#define AV_NOPTS_VALUE
Undefined timestamp value.
struct AVIAMFAudioElement * iamf_audio_element
int event_flags
Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_us, int shortest)
uint16_t * chroma_intra_matrix
custom intra quantization matrix
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
SpecifierOptList disposition
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.
void of_enc_stats_close(void)
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
int avio_r8(AVIOContext *s)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
AVIAMFSubmixElement * av_iamf_submix_add_element(AVIAMFSubmix *submix)
Allocate a submix element and add it to a given AVIAMFSubmix.
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
void opt_match_per_stream_dbl(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, double *out)
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
AVStream ** streams
A list of streams in the group.
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.
struct AVIAMFMixPresentation * iamf_mix_presentation
SpecifierOptList chroma_intra_matrices
int mux_check_init(void *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 layout
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
static int map_auto_data(Muxer *mux, const OptionsContext *o)
#define i(width, name, range_min, range_max)
SpecifierOptList frame_rates
int64_t id
unique ID to identify the chapter
SpecifierOptList codec_names
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost, unsigned sched_idx_enc, const OutputFilterOptions *opts)
static enum AVPixelFormat pix_fmt_parse(OutputStream *ost, const char *name)
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
#define AV_TIME_BASE
Internal time base represented as integer.
SpecifierOptList fps_mode
int block_align
Audio only.
float shortest_buf_duration
#define av_malloc_array(a, b)
#define SCH_DEC_OUT(decoder, out_idx)
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
SpecifierOptList mux_stats
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
SpecifierOptList muxing_queue_data_threshold
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
New fields can be added to the end with minor version bumps.
SpecifierOptList enc_stats_post
const char * name
Name of the codec implementation.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
FilterGraph ** filtergraphs
const AVIOInterruptCB int_cb
static int fmt_in_list(const int *formats, int format)
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void * av_calloc(size_t nmemb, size_t size)
unsigned int nb_subblocks
Number of subblocks in the array.
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst)
int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out)
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
SpecifierOptList metadata_map
int id
Format-specific stream ID.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const struct AVOutputFormat * oformat
The output container format.
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,...
static const char * output_file_item_name(void *obj)
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
#define AV_CODEC_PROP_TEXT_SUB
Subtitle codec is text based.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
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.
int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used, void *logctx, int decode)
#define AV_INPUT_BUFFER_PADDING_SIZE
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.
#define SCH_MSTREAM(file, stream)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
SpecifierOptList max_muxing_queue_size
static int of_add_attachments(Muxer *mux, const OptionsContext *o)
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.
main external API structure.
SpecifierOptList inter_matrices
int index
stream index in AVFormatContext
@ AV_CLASS_CATEGORY_MUXER
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.
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
SpecifierOptList audio_sample_rate
int ist_output_add(InputStream *ist, OutputStream *ost)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
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.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
SpecifierOptList frame_sizes
AVRational r_frame_rate
Real base framerate of the stream.
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
enum VideoSyncMethod video_sync_method
#define GROW_ARRAY(array, nb_elems)
AVIAMFLayer * av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element)
Allocate a layer and add it to a given AVIAMFAudioElement.
static int map_auto_audio(Muxer *mux, const OptionsContext *o)
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.
SpecifierOptList codec_tags
unsigned int nb_elements
Number of elements in the submix.
SpecifierOptList filter_scripts
#define AVIO_FLAG_READ
read-only
char * av_strdup(const char *s)
Duplicate a string.
SpecifierOptList time_bases
#define AVERROR_ENCODER_NOT_FOUND
Encoder not found.
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...
static int unescape(char **pdst, size_t *dst_len, const char **pstr, char delim)
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
int sch_sq_add_enc(Scheduler *sch, unsigned sq_idx, unsigned enc_idx, int limiting, uint64_t max_frames)
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
enum AVStreamGroupParamsType type
Group type.
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 AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
SpecifierOptList rc_overrides
int avcodec_parameters_from_context(struct AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
static int new_stream_audio(Muxer *mux, const OptionsContext *o, OutputStream *ost)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_idx, unsigned dec_idx)
const VDPAUPixFmtMap * map
AVStreamGroup * avformat_stream_group_create(AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
Add a new empty stream group to a media file.
static int of_map_group(Muxer *mux, AVDictionary **dict, AVBPrint *bp, const char *map)
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
static int compare_int64(const void *a, const void *b)
SpecifierOptList copy_initial_nonkeyframes
const char ** attachments
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
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 av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
@ OFILTER_FLAG_DISABLE_CONVERT
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
uint16_t * inter_matrix
custom inter quantization matrix Must be allocated with the av_malloc() family of functions,...
AVDictionary * enc_opts_used
int rc_override_count
ratecontrol override, see RcOverride
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
int width
picture width / height.
int muxer_thread(void *arg)
int enc_alloc(Encoder **penc, const AVCodec *codec, Scheduler *sch, unsigned sch_idx)
Submix element as defined in section 3.7 of IAMF.
static int check_opt_bitexact(void *ctx, const AVDictionary *opts, const char *opt_name, int flag)
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
const char *const forced_keyframes_const_names[]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
static int process_forced_keyframes(Muxer *mux, const OptionsContext *o)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
SyncQueue * sq_alloc(enum SyncQueueType type, int64_t buf_size_us, void *logctx)
Allocate a sync queue of the given type.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
void opt_match_per_stream_str(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, const char **out)
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.
AVRational time_base
time base in which the start/end timestamps are specified
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
int of_stream_init(OutputFile *of, OutputStream *ost)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
SpecifierOptList bitstream_filters
static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *os, int copy_metadata)
SpecifierOptList enc_time_bases
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.
static int create_streams(Muxer *mux, const OptionsContext *o)
SpecifierOptList top_field_first
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.
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
int sch_add_sq_enc(Scheduler *sch, uint64_t buf_size_us, void *logctx)
Add an pre-encoding sync queue to the scheduler.
@ AV_CODEC_CONFIG_COLOR_SPACE
AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED.