Go to the documentation of this file.
   24 #include "config_components.h" 
   83     { 
"frag_interleave", 
"Interleave samples within fragments (max number of consecutive samples, lower is tighter interleaving, but with more overhead)", offsetof(
MOVMuxContext, frag_interleave), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM },
 
   89     { 
"movflags", 
"MOV muxer flags", offsetof(
MOVMuxContext, 
flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 
"movflags" },
 
   93       { 
"delay_moov", 
"Delay writing the initial moov until the first fragment is cut, or until the first fragment flush", 0, 
AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_DELAY_MOOV}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 
"movflags" },
 
  103       { 
"moov_size", 
"maximum moov size so it can be placed at the begin", offsetof(
MOVMuxContext, reserved_moov_size), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 0 },
 
  112       { 
"write_colr", 
"Write colr atom even if the color info is unspecified (Experimental, may be renamed or changed, do not use from scripts)", 0, 
AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 
"movflags" },
 
  114       { 
"hybrid_fragmented", 
"For recoverability, write a fragmented file that is converted to non-fragmented at the end.", 0, 
AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_HYBRID_FRAGMENTED}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 
"movflags" },
 
  124     { 
"write_prft", 
"Write producer reference time box with specified time source", offsetof(
MOVMuxContext, write_prft), 
AV_OPT_TYPE_INT, {.i64 = 
MOV_PRFT_NONE}, 0, 
MOV_PRFT_NB-1, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 
"prft"},
 
  132     .
class_name = 
"mov/mp4/tgp/psp/tg2/ipod/ismv/f4v muxer",
 
  199     for (
i = 0; 
i < track->
entry; 
i++) {
 
  214     int i, j, entries = 0, tst = -1, oldtst = -1;
 
  221     for (
i = 0; 
i < track->
entry; 
i++) {
 
  223         if (oldtst != -1 && tst != oldtst)
 
  228     if (equalChunks && track->
entry) {
 
  230         sSize = 
FFMAX(1, sSize); 
 
  236         for (
i = 0; 
i < track->
entry; 
i++) {
 
  249     int index = 0, oldval = -1, 
i;
 
  258     for (
i = 0; 
i < track->
entry; 
i++) {
 
  286     for (
i = 0; 
i < track->
entry; 
i++) {
 
  303     uint8_t leading, dependent, reference, redundancy;
 
  308     for (
i = 0; 
i < track->
entry; 
i++) {
 
  317         avio_w8(pb, (leading << 6)   | (dependent << 4) |
 
  318                     (reference << 2) | redundancy);
 
  328     uint8_t *dyn_buf = 
NULL;
 
  406                "Cannot write moov atom before AC3 packets." 
  407                " Set the delay_moov flag to fix this.\n");
 
  411     if (
info->substream[0].bsid > 8) {
 
  413                "RealAudio AC-3/DolbyNet with bsid %d is not defined by the " 
  414                "ISOBMFF specification in ETSI TS 102 366!\n",
 
  415                info->substream[0].bsid);
 
  419     if (
info->ac3_bit_rate_code < 0) {
 
  421                "No valid AC3 bit rate code for data rate of %d!\n",
 
  479     if (!
info->ec3_done) {
 
  534             while (cumul_size != 
pkt->
size) {
 
  544                 info->substream[parent].num_dep_sub++;
 
  560                     info->substream[parent].chan_loc |= (
get_bits(&gbc, 16) >> 5) & 0x1f;
 
  578     if (!
info->num_blocks) {
 
  589         if (
info->num_blocks != 6)
 
  593         info->num_blocks = 0;
 
  612                "Cannot write moov atom before EAC3 packets parsed.\n");
 
  617     size = 2 + ((34 * (
info->num_ind_sub + 1) + 7) >> 3);
 
  626     for (
i = 0; 
i <= 
info->num_ind_sub; 
i++) {
 
  636         if (!
info->substream[
i].num_dep_sub) {
 
  716     if (!bit_rates.avg_bit_rate) {
 
  725         if (props && props->avg_bitrate) {
 
  726             bit_rates.avg_bit_rate = props->avg_bitrate;
 
  729         } 
else if (props && props->max_bitrate) {
 
  730             bit_rates.avg_bit_rate = props->max_bitrate;
 
  736                                    bit_rates.avg_bit_rate);
 
  741         if (!props->avg_bitrate)
 
  742             bit_rates.avg_bit_rate = props->avg_bitrate;
 
  743         bit_rates.max_bit_rate = 
FFMAX(bit_rates.max_bit_rate,
 
  745         bit_rates.buffer_size = props->buffer_size / 8;
 
  755     int decoder_specific_info_len = track->
vos_len ? 5 + track->
vos_len : 0;
 
  762     put_descr(pb, 0x03, 3 + 5+13 + decoder_specific_info_len + 5+1);
 
  767     put_descr(pb, 0x04, 13 + decoder_specific_info_len);
 
  904                "Cannot write moov atom before TrueHD packets." 
  905                " Set the delay_moov flag to fix this.\n");
 
  910     if (length < 20 || length > track->
vos_len)
 
  929     int ambisonic_order, ambi_channels, non_diegetic_channels;
 
  950     if (ambisonic_order < 0)
 
  953     ambi_channels = (ambisonic_order + 1LL) * (ambisonic_order + 1LL);
 
  954     non_diegetic_channels = ch_layout.
nb_channels - ambi_channels;
 
  955     if (non_diegetic_channels &&
 
  956         (non_diegetic_channels != 2 ||
 
  967     avio_w8(pb, (!!non_diegetic_channels) << 7); 
 
  972     for (
i = 0; 
i < ambi_channels; 
i++)
 
  984     uint32_t layout_tag, bitmap, *channel_desc;
 
  992                                         &bitmap, &channel_desc);
 
  997                                       "lack of channel information\n");
 
 1006         channel_desc = 
av_malloc(
sizeof(*channel_desc));
 
 1025     for (
int i = 0; 
i < num_desc; 
i++) {
 
 1085     int unescaped_size, seq_found = 0;
 
 1086     int level = 0, interlace = 0;
 
 1095         packet_seq = packet_entry = 1;
 
 1097                "moov atom written before any packets, unable to write correct " 
 1098                "dvc1 atom. Set the delay_moov flag to fix this.\n");
 
 1105     for (next = start; next < end; start = next) {
 
 1109         size = next - start - 4;
 
 1166     uint8_t buf[7] = { 0 };
 
 1221     if (cluster_idx >= track->
entry)
 
 1224     if (cluster_idx + 1 == track->
entry)
 
 1227         next_dts = track->
cluster[cluster_idx + 1].
dts;
 
 1239     int i, first_duration;
 
 1249     for (
i = 1; 
i < track->
entry; 
i++) {
 
 1253     return first_duration;
 
 1280     uint8_t *speaker_pos = 
NULL;
 
 1290                 speaker_pos, 
layout->nb_channels);
 
 1292             char buf[128] = {0};
 
 1347     uint32_t 
tag = track->
tag;
 
 1417         if (track->
tag == 
MKTAG(
'i',
'a',
'm',
'f'))
 
 1454     else if (track->
tag == 
MKTAG(
'm',
'p',
'4',
'a'))
 
 1457     else if (track->
tag == 
MKTAG(
'i',
'a',
'm',
'f'))
 
 1458         ret = mov_write_iacb_tag(mov->
fc, pb, track);
 
 1482     } 
else if (track->
vos_len > 0)
 
 1559     if (track->
tag == 
MKTAG(
'h',
'v',
'c',
'1'))
 
 1573     if (track->
tag == 
MKTAG(
'h',
'v',
'c',
'1'))
 
 1593     if (track->
tag == 
MKTAG(
'e',
'v',
'c',
'1'))
 
 1611     if (track->
tag == 
MKTAG(
'v',
'v',
'c',
'1'))
 
 1623     int display_width = track->
par->
width;
 
 1651     if (track->
tag == 
MKTAG(
'A',
'V',
'd',
'h')) {
 
 1727     } 
else if (track->
par->
height == 1080) { 
 
 1742     if (rational_framerate.
den != 0)
 
 1743         rate = 
av_q2d(rational_framerate);
 
 1760                 if      (rate == 24) 
tag = 
MKTAG(
'x',
'd',
'v',
'4');
 
 1761                 else if (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'v',
'5');
 
 1762                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'v',
'1');
 
 1763                 else if (rate == 50) 
tag = 
MKTAG(
'x',
'd',
'v',
'a');
 
 1764                 else if (rate == 60) 
tag = 
MKTAG(
'x',
'd',
'v',
'9');
 
 1768                 if      (rate == 24) 
tag = 
MKTAG(
'x',
'd',
'v',
'6');
 
 1769                 else if (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'v',
'7');
 
 1770                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'v',
'8');
 
 1772                 if      (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'v',
'3');
 
 1773                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'v',
'2');
 
 1777                 if      (rate == 24) 
tag = 
MKTAG(
'x',
'd',
'v',
'd');
 
 1778                 else if (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'v',
'e');
 
 1779                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'v',
'f');
 
 1781                 if      (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'v',
'c');
 
 1782                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'v',
'b');
 
 1788                 if      (rate == 24) 
tag = 
MKTAG(
'x',
'd',
'5',
'4');
 
 1789                 else if (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'5',
'5');
 
 1790                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'5',
'1');
 
 1791                 else if (rate == 50) 
tag = 
MKTAG(
'x',
'd',
'5',
'a');
 
 1792                 else if (rate == 60) 
tag = 
MKTAG(
'x',
'd',
'5',
'9');
 
 1796                 if      (rate == 24) 
tag = 
MKTAG(
'x',
'd',
'5',
'd');
 
 1797                 else if (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'5',
'e');
 
 1798                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'5',
'f');
 
 1800                 if      (rate == 25) 
tag = 
MKTAG(
'x',
'd',
'5',
'c');
 
 1801                 else if (rate == 30) 
tag = 
MKTAG(
'x',
'd',
'5',
'b');
 
 1822                 if      (rate == 24) 
tag = 
MKTAG(
'a',
'i',
'5',
'p');
 
 1823                 else if (rate == 25) 
tag = 
MKTAG(
'a',
'i',
'5',
'q');
 
 1824                 else if (rate == 30) 
tag = 
MKTAG(
'a',
'i',
'5',
'p');
 
 1825                 else if (rate == 50) 
tag = 
MKTAG(
'a',
'i',
'5',
'q');
 
 1826                 else if (rate == 60) 
tag = 
MKTAG(
'a',
'i',
'5',
'p');
 
 1830                 if      (rate == 24) 
tag = 
MKTAG(
'a',
'i',
'5',
'3');
 
 1831                 else if (rate == 25) 
tag = 
MKTAG(
'a',
'i',
'5',
'2');
 
 1832                 else if (rate == 30) 
tag = 
MKTAG(
'a',
'i',
'5',
'3');
 
 1834                 if      (rate == 50) 
tag = 
MKTAG(
'a',
'i',
'5',
'5');
 
 1835                 else if (rate == 60) 
tag = 
MKTAG(
'a',
'i',
'5',
'6');
 
 1841                 if      (rate == 24) 
tag = 
MKTAG(
'a',
'i',
'1',
'p');
 
 1842                 else if (rate == 25) 
tag = 
MKTAG(
'a',
'i',
'1',
'q');
 
 1843                 else if (rate == 30) 
tag = 
MKTAG(
'a',
'i',
'1',
'p');
 
 1844                 else if (rate == 50) 
tag = 
MKTAG(
'a',
'i',
'1',
'q');
 
 1845                 else if (rate == 60) 
tag = 
MKTAG(
'a',
'i',
'1',
'p');
 
 1849                 if      (rate == 24) 
tag = 
MKTAG(
'a',
'i',
'1',
'3');
 
 1850                 else if (rate == 25) 
tag = 
MKTAG(
'a',
'i',
'1',
'2');
 
 1851                 else if (rate == 30) 
tag = 
MKTAG(
'a',
'i',
'1',
'3');
 
 1853                 if      (rate == 25) 
tag = 
MKTAG(
'a',
'i',
'1',
'5');
 
 1854                 else if (rate == 50) 
tag = 
MKTAG(
'a',
'i',
'1',
'5');
 
 1855                 else if (rate == 60) 
tag = 
MKTAG(
'a',
'i',
'1',
'6');
 
 1877 static const struct {
 
 1925     if (
tag == 
MKTAG(
'r',
'a',
'w',
' ') &&
 
 1929         av_log(
s, 
AV_LOG_ERROR, 
"%s rawvideo cannot be written to mov, output file will be unreadable\n",
 
 1968                            "the file may be unplayable!\n");
 
 1975                     tag = 
MKTAG(
'm', 
's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff));
 
 1977                            "the file may be unplayable!\n");
 
 2002     for (
i = 0; tags && tags[
i]; 
i++) {
 
 2007                 return codec_tags->
tag;
 
 2024                    "Quicktime/Ipod might not play the file\n");
 
 2050     0x0000, 0x0100, 0x0201, 0x0206, 0x0209, 0x020e
 
 2055     unsigned mov_field_order = 0;
 
 2057         mov_field_order = 
fiel_data[field_order];
 
 2095                    "Unknown codec tag '%s' utilized for TTML stream with " 
 2096                    "index %d (track id %d)!\n",
 
 2115     if (stereo_3d->
flags != 0) {
 
 2120     switch (stereo_3d->
type) {
 
 2143     int64_t sv3d_pos, svhd_pos, proj_pos;
 
 2255     switch (stereo3d->
view) {
 
 2263         view |= (1 << 0) | (1 << 1);
 
 2306     if (spherical_mapping &&
 
 2313         spherical_mapping = 
NULL;
 
 2326     if (!spherical_mapping && !stereo3d)
 
 2333     if (spherical_mapping)
 
 2361                               uint32_t top, uint32_t bottom,
 
 2362                               uint32_t 
left, uint32_t right)
 
 2364     uint32_t cropped_width  = track->
par->
width - 
left - right;
 
 2365     uint32_t cropped_height = track->
height - top - bottom;
 
 2409         gama = (uint32_t)
lrint((
double)(1<<16) * gamma);
 
 2440             return 12 + sd->
size;
 
 2493     const int chroma_den = 50000;
 
 2494     const int luma_den = 10000;
 
 2524     const int illuminance_den = 10000;
 
 2525     const int ambient_den = 50000;
 
 2568         } 
else if(track->
par->
width == 1440) {
 
 2587     uint8_t ccstValue = (0 << 7) |  
 
 2604     avio_write(pb, 
"urn:mpeg:mpegB:cicp:systems:auxiliary:alpha\0", 44);
 
 2613     char compressor_name[32] = { 0 };
 
 2633     if (uncompressed_ycbcr) {
 
 2659     avio_w8(pb, strlen(compressor_name));
 
 2680         for (
i = 0; 
i < pal_size; 
i++) {
 
 2682             uint16_t 
r = (
rgb >> 16) & 0xff;
 
 2683             uint16_t 
g = (
rgb >> 8)  & 0xff;
 
 2684             uint16_t 
b = 
rgb         & 0xff;
 
 2693     if (track->
tag == 
MKTAG(
'm',
'p',
'4',
'v'))
 
 2733     } 
else if (track->
vos_len > 0)
 
 2780         if (spherical_mapping)
 
 2801         if (stereo3d || spherical_mapping)
 
 2825     if (sd && sd->
size >= 
sizeof(uint32_t) * 4) {
 
 2832             (top + bottom) >= track->
height) {
 
 2836         if (top || bottom || 
left || right)
 
 2838     } 
else if (uncompressed_ycbcr)
 
 2885     uint64_t str_size =strlen(reel_name);
 
 2888     if (str_size >= UINT16_MAX){
 
 2918     if (nb_frames > 255) {
 
 2994     uint32_t entries = 0;
 
 3001     ctts_entries[0].
count = 1;
 
 3003     for (
i = 1; 
i < track->
entry; 
i++) {
 
 3005             ctts_entries[entries].
count++; 
 
 3009             ctts_entries[entries].
count = 1;
 
 3013     atom_size = 16 + (entries * 8);
 
 3022     for (
i = 0; 
i < entries; 
i++) {
 
 3034     uint32_t entries = -1;
 
 3039         stts_entries = 
av_malloc(
sizeof(*stts_entries)); 
 
 3051         for (
i = 0; 
i < track->
entry; 
i++) {
 
 3054                 stts_entries[entries].
count++; 
 
 3058                 stts_entries[entries].
count = 1;
 
 3063     atom_size = 16 + (entries * 8);
 
 3068     for (
i = 0; 
i < entries; 
i++) {
 
 3095         int16_t roll_distance;
 
 3096         int group_description_index;
 
 3099     struct sgpd_entry *sgpd_entries = 
NULL;
 
 3119         for (
i = 0; 
i < track->
entry; 
i++) {
 
 3120             int roll_samples_remaining = roll_samples;
 
 3122             for (j = 
i - 1; j >= 0; j--) {
 
 3125                 if (roll_samples_remaining <= 0)
 
 3131             if (roll_samples_remaining > 0)
 
 3136             if (
i && 
distance == sgpd_entries[entries].roll_distance) {
 
 3137                 sgpd_entries[entries].count++;
 
 3140                 sgpd_entries[entries].count = 1;
 
 3141                 sgpd_entries[entries].roll_distance = 
distance;
 
 3142                 sgpd_entries[entries].group_description_index = 
distance ? ++group : 0;
 
 3148         sgpd_entries[entries].roll_distance = 1;
 
 3149         sgpd_entries[entries].group_description_index = ++group;
 
 3165     for (
i = 0; 
i < entries; 
i++) {
 
 3166         if (sgpd_entries[
i].group_description_index) {
 
 3167             avio_wb16(pb, -sgpd_entries[
i].roll_distance); 
 
 3177     for (
i = 0; 
i < entries; 
i++) {
 
 3179         avio_wb32(pb, sgpd_entries[
i].group_description_index); 
 
 3253     const char *font = 
"Lucida Grande";
 
 3293     if (track->
tag != 
MKTAG(
'c',
'6',
'0',
'8')) {
 
 3345     return track->
tag == 
MKTAG(
'c',
'7',
'0',
'8') ||
 
 3346            track->
tag == 
MKTAG(
'c',
'6',
'0',
'8');
 
 3352     const char *hdlr, *descr = 
NULL, *hdlr_type = 
NULL;
 
 3358     descr     = 
"DataHandler";
 
 3361         hdlr = (track->
mode == 
MODE_MOV) ? 
"mhlr" : 
"\0\0\0\0";
 
 3364                 hdlr_type = (track == &mov->
tracks[0]) ? 
"pict" : 
"auxv";
 
 3365                 descr     = 
"PictureHandler";
 
 3368                 descr     = 
"VideoHandler";
 
 3372             descr     = 
"SoundHandler";
 
 3376                 descr = 
"ClosedCaptionHandler";
 
 3378                 if (track->
tag == 
MKTAG(
't',
'x',
'3',
'g')) {
 
 3380                 } 
else if (track->
tag == 
MKTAG(
'm',
'p',
'4',
's')) {
 
 3387                 descr = 
"SubtitleHandler";
 
 3391             descr     = 
"HintHandler";
 
 3394             descr = 
"TimeCodeHandler";
 
 3397             descr = 
"GoPro MET"; 
 
 3400                    "Unknown hdlr_type for %s, writing dummy values\n",
 
 3425     descr_len = strlen(descr);
 
 3518     avio_wb32(pb, 
s->streams[stream_index]->codecpar->width); 
 
 3519     avio_wb32(pb, 
s->streams[stream_index]->codecpar->height); 
 
 3624     } 
else if (track->
tag == 
MKTAG(
'r',
't',
'p',
' ')) {
 
 3626     } 
else if (track->
tag == 
MKTAG(
't',
'm',
'c',
'd')) {
 
 3631     } 
else if (track->
tag == 
MKTAG(
'g',
'p',
'm',
'd')) {
 
 3717     else if (!track->
entry)
 
 3726                "FATAL error, file duration too long for timebase, this file will not be\n" 
 3727                "playable with QuickTime. Choose a different timebase with " 
 3728                "-video_track_timescale or a different container format\n");
 
 3754                          int16_t d, int16_t tx, int16_t ty)
 
 3777     uint32_t *display_matrix = 
NULL;
 
 3796         if (sd && sd->
size == 9 * 
sizeof(*display_matrix))
 
 3797             display_matrix = (uint32_t *)sd->
data;
 
 3820     else if (!track->
entry)
 
 3837     if (display_matrix) {
 
 3838         for (
i = 0; 
i < 9; 
i++)
 
 3848             track_width_1616 = track->
par->
width * 0x10000ULL;
 
 3853             if (!track_width_1616 ||
 
 3855                 track_width_1616 > UINT32_MAX)
 
 3856                 track_width_1616 = track->
par->
width * 0x10000ULL;
 
 3858         if (track_width_1616 > UINT32_MAX) {
 
 3860             track_width_1616 = 0;
 
 3863         if (track->
height > 0xFFFF) {
 
 3917     int entry_size, entry_count, 
size;
 
 3926                    "EDTS using dts:%"PRId64
" cts:%d instead of dts:%"PRId64
" cts:%"PRId64
" tid:%d\n",
 
 3928                    start_dts, start_ct, track->
track_id);
 
 3947     version |= delay < INT32_MAX ? 0 : 1;
 
 3949     entry_size = (
version == 1) ? 20 : 12;
 
 3950     entry_count = 1 + (delay > 0);
 
 3951     size = 24 + entry_count * entry_size;
 
 3982         start_ct  = -
FFMIN(start_dts, 0);
 
 4040     char buf[1000] = 
"";
 
 4059                                     const char *
tag, 
const char *str)
 
 4084     avio_write(pb, (
const unsigned char *)scheme_uri,
 
 4085                strlen(scheme_uri));
 
 4105         for (
int j = 0; 
map.value_maps[j].disposition; j++) {
 
 4154     int entry_backup = track->
entry;
 
 4174                    "Not writing any edit list even though one would have been required\n");
 
 4187     if (track->
tag == 
MKTAG(
'r',
't',
'p',
' '))
 
 4201     track->
entry = entry_backup;
 
 4208     int i, has_audio = 0, has_video = 0;
 
 4218     if (audio_profile < 0)
 
 4219         audio_profile = 0xFF - has_audio;
 
 4220     if (video_profile < 0)
 
 4221         video_profile = 0xFF - has_video;
 
 4261     int max_track_id = 1, 
i;
 
 4273             if (max_track_len < max_track_len_temp)
 
 4274                 max_track_len = max_track_len_temp;
 
 4275             if (max_track_id < mov->tracks[
i].track_id)
 
 4342     size_t data_len = strlen(
data);
 
 4344         int size = 16 + data_len;
 
 4357         return data_len + 4;
 
 4362                                 const char *
value, 
int lang, 
int long_style)
 
 4376                                             const char *
tag, 
int *lang)
 
 4390         len2 = strlen(t2->
key);
 
 4401                                      const char *
name, 
const char *
tag,
 
 4415     int size = 0, tmpo = t ? atoi(t->
value) : 0;
 
 4434     double latitude, longitude, altitude;
 
 4435     int32_t latitude_fix, longitude_fix, altitude_fix;
 
 4437     const char *ptr, *place = 
"";
 
 4439     static const char *astronomical_body = 
"earth";
 
 4444     latitude = 
strtod(ptr, &end);
 
 4450     longitude = 
strtod(ptr, &end);
 
 4456     altitude = 
strtod(ptr, &end);
 
 4461     latitude_fix  = (
int32_t) ((1 << 16) * latitude);
 
 4462     longitude_fix = (
int32_t) ((1 << 16) * longitude);
 
 4463     altitude_fix  = (
int32_t) ((1 << 16) * altitude);
 
 4474     avio_write(pb, astronomical_body, strlen(astronomical_body) + 1);
 
 4485                                        disc ? 
"disc" : 
"track",
 
 4487     int size = 0, track = t ? atoi(t->
value) : 0;
 
 4490         char *slash = strchr(t->
value, 
'/');
 
 4492             tracks = atoi(slash + 1);
 
 4509                                    const char *
name, 
const char *
tag,
 
 4516     if (
len != 1 && 
len != 4)
 
 4521     num = atoi(t->
value);
 
 4632         size_t key_len = strlen(t->
key);
 
 4700                                       const char *
name, 
const char *
key)
 
 4732     return (((str[0] - 0x60) & 0x1F) << 10) +
 
 4733            (((str[1] - 0x60) & 0x1F) <<  5) +
 
 4734            (( str[2] - 0x60) & 0x1F);
 
 4738                                   const char *
tag, 
const char *str)
 
 4747     if (!strcmp(
tag, 
"yrrc"))
 
 4752         if (!strcmp(
tag, 
"albm") &&
 
 4762     int i, nb_chapters = 
FFMIN(
s->nb_chapters, 255);
 
 4770     for (
i = 0; 
i < nb_chapters; 
i++) {
 
 4844                                    const char *str, 
const char *lang, 
int type)
 
 4898     uint64_t chunkSize = chunk->
size;
 
 4911             chunkSize = chunk->
size;
 
 4937         int next_generated_track_id = 0;
 
 4940             if (st->
id > next_generated_track_id)
 
 4941                 next_generated_track_id = st->
id;
 
 4951         int last_track_id = 0;
 
 4959                                        : 
FFMAX(
i, last_track_id)) + 1;
 
 4995         if (track->
tag == 
MKTAG(
'r',
't',
'p',
' ')) {
 
 5002             if (sd && sd->
size == 
sizeof(
int)) {
 
 5003                 int *fallback = (
int *)sd->
data;
 
 5004                 if (*fallback >= 0 && *fallback < mov->nb_tracks) {
 
 5060     avio_printf(pb, 
"<param name=\"%s\" value=\"%s\" valuetype=\"data\"/>\n", 
name, buf);
 
 5068     static const AVUUID uuid = {
 
 5069         0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 
 5070         0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 
 5078     avio_printf(pb, 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
 
 5079     avio_printf(pb, 
"<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\">\n");
 
 5082         avio_printf(pb, 
"<meta name=\"creator\" content=\"%s\" />\n",
 
 5096         char track_name_buf[32] = { 0 };
 
 5120             av_strlcatf(track_name_buf, 
sizeof(track_name_buf),
 
 5121                         "_%s", lang->
value);
 
 5125             av_strlcat(track_name_buf, 
"_cc", 
sizeof(track_name_buf));
 
 5127             av_strlcat(track_name_buf, 
"_ad", 
sizeof(track_name_buf));
 
 5208     if (!track->
entry) {
 
 5255         if (track->
entry > 1)
 
 5327     static const uint8_t uuid[] = {
 
 5328         0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
 
 5329         0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
 
 5348     int size = 8 + 16 + 4 + 1 + 16*n;
 
 5349     static const uint8_t uuid[] = {
 
 5350         0xd4, 0x80, 0x7e, 0xf2, 0xca, 0x39, 0x46, 0x95,
 
 5351         0x8e, 0x54, 0x26, 0xcb, 0x9e, 0x46, 0xa7, 0x9f
 
 5364     for (
i = 0; 
i < n; 
i++) {
 
 5369     if (n < mov->ism_lookahead) {
 
 5400         if ((tracks >= 0 && 
i != tracks) || !track->
entry)
 
 5422         if (
info->time < 0) {
 
 5426         info->tfrf_offset = 0;
 
 5437         if ((tracks >= 0 && 
i != tracks) || !track->
entry)
 
 5470     for (
i = 1; 
i < track->
entry; 
i++) {
 
 5485                 if (!
info->tfrf_offset)
 
 5498                                        int tracks, 
int moof_size)
 
 5510         if (tracks >= 0 && 
i != tracks)
 
 5521                               MOVTrack *track, 
int ref_size, 
int total_sidx_size)
 
 5525     unsigned starts_with_SAP;
 
 5537         if (presentation_time < 0) {
 
 5539             presentation_time = 0;
 
 5547         if (presentation_time > 0)
 
 5563     for (
i = 0; 
i < entries; 
i++) {
 
 5564         if (!track->
entry) {
 
 5570             starts_with_SAP = 1;
 
 5572         avio_wb32(pb, (0 << 31) | (ref_size & 0x7fffffff)); 
 
 5574         avio_wb32(pb, (starts_with_SAP << 31) | (0 << 28) | 0); 
 
 5578     offset = 
pos + total_sidx_size - end_pos;
 
 5586                                int tracks, 
int ref_size)
 
 5604             if (tracks >= 0 && 
i != tracks)
 
 5609             if (!track->
entry && ref_size > 0)
 
 5630     first_track = &(mov->
tracks[0]);
 
 5632     if (!first_track->
entry) {
 
 5776                                         int has_h264, 
int has_video, 
int write_minor)
 
 5785         minor =     has_h264 ?   0x100 :   0x200;
 
 5791         minor =     has_h264 ? 0x20000 : 0x10000;
 
 5820     int has_h264 = 0, has_av1 = 0, has_video = 0, has_dolby = 0, has_id3 = 0;
 
 5824     for (
int i = 0; 
i < 
s->nb_stream_groups; 
i++) {
 
 5870         const int depth = pix_fmt_desc->
comp[0].
depth;
 
 5880         if (depth == 8 || depth == 10) {
 
 5947     int audio_kbitrate = audio_par->
bit_rate / 1000;
 
 5948     int video_kbitrate = 
FFMIN(video_par->
bit_rate / 1000, 800 - audio_kbitrate);
 
 5950     if (frame_rate < 0 || frame_rate > INT32_MAX) {
 
 5951         av_log(
s, 
AV_LOG_ERROR, 
"Frame rate %f outside supported range\n", frame_rate / (
double)0x10000);
 
 6016         int video_streams_nb = 0, audio_streams_nb = 0, other_streams_nb = 0;
 
 6029         if (video_streams_nb != 1 || audio_streams_nb != 1 || other_streams_nb) {
 
 6041     int i, closed_gop = 0;
 
 6046             closed_gop = 
pkt->
data[
i + 4] >> 6 & 0x01;
 
 6047         } 
else if (
c == 0x100) { 
 
 6049             if (!temp_ref || closed_gop) 
 
 6062     int seq = 0, 
entry = 0;
 
 6065     for (next = start; next < end; start = next) {
 
 6127     if (length < 8 || length > 
pkt->
size)
 
 6179         if (!had_packets && squashed_packet->
duration == 0) {
 
 6212                        "Failed to write squashed packet for %s stream with " 
 6213                        "index %d and track id %d. Error: %s\n",
 
 6236             for (
i = 0; 
i < track->
entry; 
i++) {
 
 6258     int i, first_track = -1;
 
 6259     int64_t mdat_size = 0, mdat_start = 0;
 
 6261     int has_video = 0, starts_with_key = 0, first_video_track = 1;
 
 6298         if (track->
entry <= 1)
 
 6316                    "Estimating the duration of the last packet in a " 
 6317                    "fragment, consider setting the duration field in " 
 6318                    "AVPacket instead.\n");
 
 6326         int buf_size, moov_size;
 
 6332         if (i < mov->nb_tracks && !force)
 
 6391             if (first_video_track) {
 
 6394                 first_video_track = 0;
 
 6401         if (first_track < 0)
 
 6414         int buf_size, write_moof = 1, moof_tracks = -1;
 
 6423             write_moof = 
i == first_track;
 
 6516     unsigned int samples_in_chunk = 0;
 
 6519     uint8_t *reformatted_data = 
NULL;
 
 6563         static const uint16_t packed_size[16] =
 
 6564             {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 1};
 
 6567         while (
len < 
size && samples_in_chunk < 100) {
 
 6571         if (samples_in_chunk > 1) {
 
 6572             av_log(
s, 
AV_LOG_ERROR, 
"fatal error, input is not a single packet, implement a AVParser for it\n");
 
 6581         samples_in_chunk = 1;
 
 6583     if (samples_in_chunk < 1) {
 
 6625                    "use the audio bitstream filter 'aac_adtstoasc' to fix it " 
 6626                    "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
 
 6724                 int nal_size_length = (par->
extradata[4] & 0x3) + 1;
 
 6727                 int nal_size_length = (par->
extradata[21] & 0x3) + 1;
 
 6812                    "Track %d starts with a nonzero dts %"PRId64
", while the moov " 
 6813                    "already has been written. Set the delay_moov flag to handle " 
 6871                                  reformatted_data ? reformatted_data + 
offset 
 6877     if (
pkt->
data != reformatted_data)
 
 6918             memcpy(par->
extradata, side, side_size);
 
 6976     uint8_t 
data[2] = {0};
 
 7043     const char *scheme_id_uri = 
"https://aomedia.org/emsg/ID3";
 
 7044     const char *
value = 
"";
 
 7061     avio_write(pb, scheme_id_uri, strlen(scheme_id_uri) + 1);
 
 7087         int ret = mov_build_iamf_packet(
s, trk, 
pkt);
 
 7092                                     "for stream #%d\n", trk->
st->
index);
 
 7162                        "Packets without a valid presentation timestamp are " 
 7163                        "not supported with packet squashing!\n");
 
 7180             int reshuffle_ret, 
ret;
 
 7183                 int expected_stride = ((trk->
par->
width * bpc + 15) >> 4)*2;
 
 7185                 if (reshuffle_ret < 0)
 
 7186                     return reshuffle_ret;
 
 7204             if (reshuffle_ret) {
 
 7221     static const uint8_t stub_header[] = {
 
 7223         0x00, 0x00, 0x00, 0x01, 
 
 7225         0x00, 0x00, 0x00, 0x00, 
 
 7227         0x00, 0x00, 0x00, 0x00, 
 
 7228         0x00, 0x00, 0x00, 0x00, 
 
 7230         0x00, 0x00, 0x00, 0x00, 
 
 7233         0x00, 0x00, 0x00, 0x00, 
 
 7235         0x00, 0x00, 0x00, 0x0D, 
 
 7249     track->
tag = 
MKTAG(
't',
'e',
'x',
't');
 
 7258     memcpy(track->
par->
extradata, stub_header, 
sizeof(stub_header));
 
 7263     for (
i = 0; 
i < 
s->nb_chapters; 
i++) {
 
 7272             static const char encd[12] = {
 
 7273                 0x00, 0x00, 0x00, 0x0C,
 
 7275                 0x00, 0x00, 0x01, 0x00 };
 
 7285             memcpy(
pkt->
data + 
len + 2, encd, 
sizeof(encd));
 
 7318     track->
tag       = 
MKTAG(
't',
'm',
'c',
'd');
 
 7393             if (!enabled[
i] && 
first[
i] >= 0)
 
 7404     for (
int i = 0; 
i < 
s->nb_streams; 
i++)
 
 7405         s->streams[
i]->priv_data = 
NULL;
 
 7417         if (track->
tag == 
MKTAG(
'r',
't',
'p',
' '))
 
 7456     r = (
rgb >> 16) & 0xFF;
 
 7457     g = (
rgb >>  8) & 0xFF;
 
 7464     return (y << 16) | (
cr << 8) | 
cb;
 
 7471     int have_palette = 0, have_size = 0;
 
 7472     uint32_t palette[16];
 
 7475     while (cur && *cur) {
 
 7476         if (strncmp(
"palette:", cur, 8) == 0) {
 
 7478             count = sscanf(cur + 8,
 
 7479                 "%06"PRIx32
", %06"PRIx32
", %06"PRIx32
", %06"PRIx32
", " 
 7480                 "%06"PRIx32
", %06"PRIx32
", %06"PRIx32
", %06"PRIx32
", " 
 7481                 "%06"PRIx32
", %06"PRIx32
", %06"PRIx32
", %06"PRIx32
", " 
 7482                 "%06"PRIx32
", %06"PRIx32
", %06"PRIx32
", %06"PRIx32
"",
 
 7483                 &palette[ 0], &palette[ 1], &palette[ 2], &palette[ 3],
 
 7484                 &palette[ 4], &palette[ 5], &palette[ 6], &palette[ 7],
 
 7485                 &palette[ 8], &palette[ 9], &palette[10], &palette[11],
 
 7486                 &palette[12], &palette[13], &palette[14], &palette[15]);
 
 7488             for (
i = 0; 
i < count; 
i++) {
 
 7492         } 
else if (!strncmp(
"size:", cur, 5)) {
 
 7496         if (have_palette && have_size)
 
 7498         cur += strcspn(cur, 
"\n\r");
 
 7499         cur += strspn(cur, 
"\n\r");
 
 7505         for (
i = 0; 
i < 16; 
i++) {
 
 7523     int first_iamf_idx = INT_MAX, last_iamf_idx = 0;
 
 7524     int nb_audio_elements = 0, nb_mix_presentations = 0;
 
 7527     for (
int i = 0; 
i < 
s->nb_stream_groups; 
i++) {
 
 7531             nb_audio_elements++;
 
 7533             nb_mix_presentations++;
 
 7536     if (!nb_audio_elements && !nb_mix_presentations)
 
 7539     if (nb_audio_elements < 1 || nb_audio_elements > 2 || nb_mix_presentations < 1) {
 
 7541                                 "one IAMF_MIX_PRESENTATION stream groups to write a IMAF track\n");
 
 7550     for (
int i = 0; 
i < 
s->nb_stream_groups; 
i++) {
 
 7571     track = &mov->
tracks[first_iamf_idx];
 
 7575     track->
tag = 
MKTAG(
'i',
'a',
'm',
'f');
 
 7577     for (
int i = 0; 
i < 
s->nb_stream_groups; 
i++) {
 
 7605 #define IS_MODE(muxer, config) (CONFIG_ ## config ## _MUXER && !strcmp(#muxer, s->oformat->name)) 
 7673         av_log(
s, 
AV_LOG_WARNING, 
"No meaningful edit list will be written when using empty_moov without delay_moov\n");
 
 7689                "Sample interleaving in fragments is mutually exclusive with " 
 7690                "omit_tfhd_offset and separate_moof\n");
 
 7706         if (
s->nb_streams > 2) {
 
 7715         if (
s->nb_streams > 1) {
 
 7719                 av_log(
s, 
AV_LOG_ERROR, 
"Second stream for AVIF (alpha) output must have exactly one plane\n");
 
 7727     for (
i = 0; 
i < 
s->nb_stream_groups; 
i++) {
 
 7738                                         "IAMF Audio Element\n", j);
 
 7750     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
 7770         for (
i = 0; 
i < 
s->nb_streams; 
i++)
 
 7785         for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
 7799             for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
 7803                            "so timecode metadata are now ignored\n");
 
 7841     ret = mov_init_iamf_track(
s);
 
 7846     for (
int j = 0, 
i = 0; j < 
s->nb_streams; j++) {
 
 7857     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
 7877                    "codec not currently supported in container\n",
 
 7889             if (track->
tag == 
MKTAG(
'm',
'x',
'3',
'p') || track->
tag == 
MKTAG(
'm',
'x',
'3',
'n') ||
 
 7890                 track->
tag == 
MKTAG(
'm',
'x',
'4',
'p') || track->
tag == 
MKTAG(
'm',
'x',
'4',
'n') ||
 
 7891                 track->
tag == 
MKTAG(
'm',
'x',
'5',
'p') || track->
tag == 
MKTAG(
'm',
'x',
'5',
'n')) {
 
 7896                 track->
height = track->
tag >> 24 == 
'n' ? 486 : 576;
 
 7901                     av_log(
s, 
AV_LOG_WARNING, 
"Warning: some tools, like mp4split, assume a timescale of 10000000 for ISMV.\n");
 
 7913                        "WARNING codec timebase is very high. If duration is too long,\n" 
 7914                        "file may not be playable by quicktime. Specify a shorter timebase\n" 
 7915                        "or choose different container.\n");
 
 7918                 track->
tag == 
MKTAG(
'r',
'a',
'w',
' ')) {
 
 7974                     av_log(
s, 
AV_LOG_ERROR, 
"track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n",
 
 7992                            "%s in MP4 support is experimental, add " 
 7993                            "'-strict %d' if you want to use it.\n",
 
 8014                            "Fragmentation is not currently supported for " 
 8015                            "TTML in MP4/ISMV (track synchronization between " 
 8016                            "subtitles and other media is not yet implemented)!\n");
 
 8024                            "ISMV style TTML support with the 'dfxp' tag in " 
 8025                            "non-ISMV formats is not officially supported. Add " 
 8026                            "'-strict unofficial' if you want to use it.\n");
 
 8066     int ret, hint_track = 0, tmcd_track = 0, nb_tracks = mov->
nb_streams;
 
 8072         hint_track = nb_tracks;
 
 8080         tmcd_track = nb_tracks;
 
 8130                 trackj->
tag != track->
tag 
 8168         mov->
time += 0x7C25B080; 
 
 8186                                                               "timecode", 
NULL, 0);
 
 8257     int i, moov_size, moov_size2;
 
 8273     if (moov_size2 != moov_size)
 
 8403             av_log(
s, 
AV_LOG_INFO, 
"Starting second pass: moving the moov atom to the beginning of the file\n");
 
 8469 #if CONFIG_AVIF_MUXER 
 8474     int64_t pos_backup, extent_offsets[2];
 
 8476     int buf_size, moov_size;
 
 8514         if (extent_offsets[
i] != (uint32_t)extent_offsets[
i]) {
 
 8527 #if CONFIG_TGP_MUXER || CONFIG_TG2_MUXER 
 8538 static const AVCodecTag *
const codec_3gp_tags_list[] = { codec_3gp_tags, 
NULL };
 
 8597 #if CONFIG_MP4_MUXER || CONFIG_PSP_MUXER 
 8627 #if CONFIG_AVIF_MUXER 
 8629 static const AVOption avif_options[] = {
 
 8631     { 
"loop", 
"Number of times to loop animated AVIF: 0 - infinite loop", offsetof(
MOVMuxContext, avif_loop_count), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, .unit = 0 },
 
 8634 static const AVCodecTag codec_avif_tags[] = {
 
 8638 static const AVCodecTag *
const codec_avif_tags_list[] = { codec_avif_tags, 
NULL };
 
 8640 static const AVClass mov_avif_muxer_class = {
 
 8643     .option     = avif_options,
 
 8648 #if CONFIG_MOV_MUXER 
 8652     .p.extensions      = 
"mov",
 
 8655     .p.video_codec     = CONFIG_LIBX264_ENCODER ?
 
 8675 #if CONFIG_TGP_MUXER 
 8679     .p.extensions      = 
"3gp",
 
 8693     .p.codec_tag       = codec_3gp_tags_list,
 
 8699 #if CONFIG_MP4_MUXER 
 8703     .p.mime_type       = 
"video/mp4",
 
 8704     .p.extensions      = 
"mp4",
 
 8707     .p.video_codec     = CONFIG_LIBX264_ENCODER ?
 
 8719     .p.codec_tag       = mp4_codec_tags_list,
 
 8725 #if CONFIG_PSP_MUXER 
 8729     .p.extensions      = 
"mp4,psp",
 
 8732     .p.video_codec     = CONFIG_LIBX264_ENCODER ?
 
 8744     .p.codec_tag       = mp4_codec_tags_list,
 
 8750 #if CONFIG_TG2_MUXER 
 8754     .p.extensions      = 
"3g2",
 
 8768     .p.codec_tag       = codec_3gp_tags_list,
 
 8774 #if CONFIG_IPOD_MUXER 
 8778     .p.mime_type       = 
"video/mp4",
 
 8779     .p.extensions      = 
"m4v,m4a,m4b",
 
 8799 #if CONFIG_ISMV_MUXER 
 8803     .p.mime_type       = 
"video/mp4",
 
 8804     .p.extensions      = 
"ismv,isma",
 
 8825 #if CONFIG_F4V_MUXER 
 8829     .p.mime_type       = 
"application/f4v",
 
 8830     .p.extensions      = 
"f4v",
 
 8850 #if CONFIG_AVIF_MUXER 
 8854     .p.mime_type       = 
"image/avif",
 
 8855     .p.extensions      = 
"avif",
 
 8861     .write_trailer     = avif_write_trailer,
 
 8868     .p.codec_tag       = codec_avif_tags_list,
 
 8869     .p.priv_class      = &mov_avif_muxer_class,
 
  
static void get_pts_range(MOVMuxContext *mov, MOVTrack *track, int64_t *start, int64_t *end)
static const AVCodecTag codec_ism_tags[]
int height
active picture (w/o VBI) height for D-10/IMX
static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int64_t moof_offset, int moof_size)
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_ROUND_UP
Round toward +infinity.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static int mov_write_udta_sdp(AVIOContext *pb, MOVTrack *track)
#define FF_MOV_FLAG_GLOBAL_SIDX
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define MOV_TFHD_DEFAULT_FLAGS
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVPixelFormat
Pixel format.
static int mov_get_dnxhd_codec_tag(AVFormatContext *s, MOVTrack *track)
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
@ AV_CODEC_ID_ADPCM_IMA_QT
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
MOVIentry * cluster_written
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_write_eyes_tag(AVFormatContext *s, AVIOContext *pb, const AVStereo3D *stereo3d)
#define MOV_TRUN_SAMPLE_FLAGS
static int mov_write_vmhd_tag(AVIOContext *pb)
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
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 mov_write_track_kinds(AVIOContext *pb, AVStream *st)
unsigned int squash_fragment_samples_to_one
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
#define FF_MOV_FLAG_FRAG_KEYFRAME
static int mov_write_wfex_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
#define MOV_TKHD_FLAG_ENABLED
static int mov_write_mfra_tag(AVIOContext *pb, MOVMuxContext *mov)
enum AVMediaType codec_type
General type of the encoded data.
enum AVSphericalProjection projection
Projection type.
static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_add_tfra_entries(AVIOContext *pb, MOVMuxContext *mov, int tracks, int size)
uint32_t bound_bottom
Distance from the bottom edge.
static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str)
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
uint8_t AVUUID[AV_UUID_LEN]
static int put_bytes_output(const PutBitContext *s)
#define FF_MOV_FLAG_HYBRID_FRAGMENTED
static double cb(void *priv, double x, double y)
uint32_t buffer_size
Size of the decoding buffer for the elementary stream in bytes.
const AVCodecTag ff_mp4_obj_type[]
MOVEncryptionScheme encryption_scheme
#define FF_MOV_FLAG_WRITE_COLR
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
This struct describes the properties of an encoded stream.
static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int moof_size, int first, int end)
static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
Ambient viewing environment metadata as defined by H.274.
static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
enum AVColorSpace color_space
double strtod(const char *, char **)
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVStream *st)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define FF_MOV_FLAG_SKIP_TRAILER
static int mov_write_gama_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track, double gamma)
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
#define IS_MODE(muxer, config)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
static int mov_write_ms_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int mov_auto_flush_fragment(AVFormatContext *s, int force)
static int mov_pcm_le_gt16(enum AVCodecID codec_id)
int ff_vvc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext.
int min_fragment_duration
int avif_extent_length[2]
unsigned MaxCLL
Max content light level (cd/m^2).
int ff_isom_write_vvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.
char * encryption_scheme_str
#define FF_MOV_FLAG_FRAG_CUSTOM
static int mov_write_enda_tag(AVIOContext *pb)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
AVStream ** streams
A list of all streams in the file.
int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout)
Return the order if the layout is n-th order standard-order ambisonic.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
struct eac3_info::@397 substream[1]
@ AVCOL_RANGE_JPEG
Full range content.
int strict_std_compliance
Allow non-standard and experimental extension.
static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
int64_t wallclock
A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, AVStream *st)
int depth
Number of bits in the component.
static int mov_init(AVFormatContext *s)
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
#define MOV_FRAG_INFO_ALLOC_INCREMENT
@ AV_PKT_DATA_FALLBACK_TRACK
This side data contains an integer value representing the stream index of a "fallback" track.
static void enable_tracks(AVFormatContext *s)
static int mov_write_ccst_tag(AVIOContext *pb)
int ff_isom_write_lhvc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes L-HEVC extradata (parameter sets with nuh_layer_id > 0, as a LHEVCDecoderConfigurationRecord) ...
static int mov_write_mdta_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_write_raw_metadata_tag(AVFormatContext *s, AVIOContext *pb, const char *name, const char *key)
AVRational avg_frame_rate
Average framerate.
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
uint32_t flags
flags such as drop frame, +24 hours support, ...
#define AV_PIX_FMT_YUV420P10
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
static int co64_required(const MOVTrack *track)
static int mov_write_aux_tag(AVIOContext *pb, const char *aux_type)
unsigned int ff_toupper4(unsigned int x)
int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds)
Parse creation_time in AVFormatContext metadata if exists and warn if the parsing fails.
#define AV_LOG_VERBOSE
Detailed information.
const AVCodecTag ff_codec_wav_tags[]
static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_write_header(AVFormatContext *s)
static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMapping *spherical_mapping)
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
static int mov_write_loci_tag(AVFormatContext *s, AVIOContext *pb)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static int get_sidx_size(AVFormatContext *s)
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
#define FF_MOV_FLAG_WRITE_GAMA
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
static int mov_write_d263_tag(AVIOContext *pb)
#define AV_PKT_FLAG_DISPOSABLE
Flag is used to indicate packets that contain frames that can be discarded by the decoder.
static const uint16_t fiel_data[]
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
int ff_mov_get_channel_layout_tag(const AVCodecParameters *par, uint32_t *layout, uint32_t *bitmap, uint32_t **pchannel_desc)
Get the channel layout tag for the specified codec id and channel layout.
int nb_channels
Number of channels in this layout.
@ AV_SPHERICAL_EQUIRECTANGULAR
Video represents a sphere mapped on a flat surface using equirectangular projection.
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
#define MOV_SAMPLE_DEPENDENCY_UNKNOWN
static int is_clcp_track(MOVTrack *track)
static const AVCodecTag codec_cover_image_tags[]
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
@ AV_STEREO3D_VIEW_UNSPEC
Content is unspecified.
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
static int ascii_to_wc(AVIOContext *pb, const uint8_t *b)
#define FF_RTP_FLAG_OPTS(ctx, fieldname)
static int mov_write_chnl_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
#define OPUS_SEEK_PREROLL_MS
static int mov_write_tfdt_tag(AVIOContext *pb, MOVTrack *track)
MOVFragmentInfo * frag_info
static int mov_write_wave_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static const av_always_inline uint8_t * find_next_marker(const uint8_t *src, const uint8_t *end)
Find VC-1 marker in buffer.
@ AV_CODEC_ID_MPEGH_3D_AUDIO
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
static void skip_bits(GetBitContext *s, int n)
enum AVColorPrimaries color_primaries
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
static int mov_write_trex_tag(AVIOContext *pb, MOVTrack *track)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define FF_MOV_FLAG_FRAG_EVERY_FRAME
static int mov_write_dvc1_tag(AVIOContext *pb, MOVTrack *track)
static void put_descr(AVIOContext *pb, int tag, unsigned int size)
static void mov_write_vexu_proj_tag(AVFormatContext *s, AVIOContext *pb, const AVSphericalMapping *spherical_mapping)
static int mov_write_pcmc_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
@ AV_OPT_TYPE_BINARY
Underlying C type is a uint8_t* that is either NULL or points to an array allocated with the av_mallo...
static int64_t calc_samples_pts_duration(MOVMuxContext *mov, MOVTrack *track)
#define FF_MOV_FLAG_DEFAULT_BASE_MOOF
static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
static int defined_frame_rate(AVFormatContext *s, AVStream *st)
#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC
static int mov_write_gpmd_tag(AVIOContext *pb, const MOVTrack *track)
int bits_per_raw_sample
This is the number of valid bits in each output sample.
static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, const char *name, const char *tag, int long_style)
int ffio_open_null_buf(AVIOContext **s)
Open a write-only fake memory stream.
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
static int mov_write_mvex_tag(AVIOContext *pb, MOVMuxContext *mov)
static int mov_write_dref_tag(AVIOContext *pb)
int start
timecode frame start (first base frame number)
static int mov_write_mdhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
static int mov_write_evcc_tag(AVIOContext *pb, MOVTrack *track)
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
@ EAC3_FRAME_TYPE_DEPENDENT
#define MOV_TRUN_SAMPLE_DURATION
static double val(void *priv, double ch)
static unsigned compute_avg_bitrate(MOVTrack *track)
static unsigned int validate_codec_tag(const AVCodecTag *const *tags, unsigned int tag, int codec_id)
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
static int mov_setup_track_ids(MOVMuxContext *mov, AVFormatContext *s)
Assign track ids.
#define FF_MOV_FLAG_USE_MDTA
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
static int mov_finish_fragment(MOVMuxContext *mov, MOVTrack *track, int64_t ref_pos)
static int mov_write_iref_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_CH_LAYOUT_STEREO
static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
AVProducerReferenceTime prft
#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES
#define MOV_TRUN_DATA_OFFSET
static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
void ff_mov_cenc_free(MOVMuxCencContext *ctx)
Free a CENC context.
int ff_isom_write_evcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes EVC sample metadata to the provided AVIOContext.
static void mov_prune_frag_info(MOVMuxContext *mov, int tracks, int max)
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
enum AVColorTransferCharacteristic color_trc
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static int mov_write_tmpo_tag(AVIOContext *pb, AVFormatContext *s)
static int mov_write_trak_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, AVStream *st)
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
enum AVPixelFormat pix_fmt
@ FLAC_METADATA_TYPE_STREAMINFO
uint32_t palette[AVPALETTE_COUNT]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_MOV_FLAG_FRAG_DISCONT
static int mov_write_trailer(AVFormatContext *s)
#define FF_ARRAY_ELEMS(a)
#define AV_PROFILE_UNKNOWN
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int mov_write_emsg_tag(AVIOContext *pb, AVStream *st, AVPacket *pkt)
PacketList squashed_packet_queue
int frame_size
Audio only.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
static int mov_write_lhvc_tag(AVIOContext *pb, MOVTrack *track)
int chapter_track
qt chapter track number
#define FF_MOV_FLAG_FRAGMENT
int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx)
#define MOV_TFHD_DEFAULT_BASE_IS_MOOF
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
#define MOV_TFHD_DEFAULT_DURATION
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int flags
Flags modifying the (de)muxer behaviour.
AVRational sample_aspect_ratio
Video only.
#define FF_MOV_FLAG_DELAY_MOOV
static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
uint32_t bound_top
Distance from the top edge.
int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, int *size, int *offset)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and return the result in a data bu...
#define MOV_TRUN_FIRST_SAMPLE_FLAGS
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int nb_meta_tmcd
number of new created tmcd track based on metadata (aka not data copy)
static int utf8len(const uint8_t *b)
static int mov_write_tfra_tag(AVIOContext *pb, MOVTrack *track)
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
#define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ EAC3_FRAME_TYPE_INDEPENDENT
static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s, int disc)
void ff_isom_put_dvcc_dvvc(void *logctx, uint8_t out[ISOM_DVCC_DVVC_SIZE], const AVDOVIDecoderConfigurationRecord *dovi)
#define FF_MOV_FLAG_PREFER_ICC
int ff_nal_parse_units(AVIOContext *pb, const uint8_t *buf_in, int size)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int mov_write_ipco_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_iloc_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
void ffio_write_leb(AVIOContext *s, unsigned val)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static const uint8_t channel_map[8][8]
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int nb_coded_side_data
Amount of entries in coded_side_data.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
static int mov_write_tcmi_tag(AVIOContext *pb, MOVTrack *track)
static void build_chunks(MOVTrack *trk)
static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
This structure describes the bitrate properties of an encoded bitstream.
int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size)
Make shift_size amount of space at read_start by shifting data in the output at read_start until the ...
static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc)
static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
Additional information about the frame packing.
#define FF_MOV_FLAG_RTP_HINT
static int mov_write_mfhd_tag(AVIOContext *pb, MOVMuxContext *mov)
static void mov_write_psp_udta_tag(AVIOContext *pb, const char *str, const char *lang, int type)
static int mov_write_vpcc_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb, const uint8_t *data, int len, AVCodecParameters *par)
Writes VP codec configuration to the provided AVIOContext.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
int use_stream_ids_as_track_ids
void avpriv_packet_list_free(PacketList *pkt_buf)
Wipe the list and unref all the packets in it.
static const AVClass mov_isobmff_muxer_class
static struct mpeg4_bit_rate_values calculate_mpeg4_bit_rates(MOVTrack *track)
static const AVOption options[]
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int compute_moov_size(AVFormatContext *s)
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int src_track
the track that this hint (or tmcd) track describes
static int mov_write_pitm_tag(AVIOContext *pb, int item_id)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static int mov_pcm_be_gt16(enum AVCodecID codec_id)
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
uint8_t nb_components
The number of components each pixel has, (1-4)
static int mov_check_timecode_track(AVFormatContext *s, AVTimecode *tc, AVStream *src_st, const char *tcstr)
static const AVCodecTag codec_f4v_tags[]
static int mov_create_timecode_track(AVFormatContext *s, int index, int src_index, AVTimecode tc)
static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track)
This function writes extradata "as is".
static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
int avpriv_packet_list_put(PacketList *packet_buffer, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
@ AVIO_DATA_MARKER_TRAILER
Trailer data, which doesn't contain actual content, but only for finalizing the output file.
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static int get_moov_size(AVFormatContext *s)
static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, uint8_t *dst)
int ff_mov_cenc_avc_write_nal_units(AVFormatContext *s, MOVMuxCencContext *ctx, int nal_length_size, AVIOContext *pb, const uint8_t *buf_in, int size)
Write AVC NAL units that are in MP4 format, the nal size and type are written in the clear while the ...
Rational number (pair of numerator and denominator).
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted HEVC NAL units to a data buffer.
static int rtp_hinting_needed(const AVStream *st)
static int check_pkt(AVFormatContext *s, MOVTrack *trk, AVPacket *pkt)
int ffio_close_null_buf(AVIOContext *s)
Close a null buffer.
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
static int mov_write_squashed_packets(AVFormatContext *s)
#define ROUNDED_DIV(a, b)
@ AV_CODEC_ID_DVD_SUBTITLE
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
static unsigned int get_bits1(GetBitContext *s)
static int mov_write_moof_tag_internal(AVIOContext *pb, MOVMuxContext *mov, int tracks, int moof_size)
static int mov_write_clap_tag(AVIOContext *pb, MOVTrack *track, uint32_t top, uint32_t bottom, uint32_t left, uint32_t right)
int last_sample_is_subtitle_end
static int get_cluster_duration(MOVTrack *track, int cluster_idx)
#define FLAC_STREAMINFO_SIZE
static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
#define MOV_SAMPLE_DEPENDENCY_NO
int ff_iamf_add_mix_presentation(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx)
int missing_duration_warned
static int mov_write_track_metadata(AVIOContext *pb, AVStream *st, const char *tag, const char *str)
void ff_mov_close_hinting(MOVTrack *track)
void avio_w8(AVIOContext *s, int b)
static int mov_write_amve_tag(AVIOContext *pb, MOVTrack *track)
int ff_mov_get_channel_positions_from_layout(const AVChannelLayout *layout, uint8_t *position, int position_num)
Get ISO/IEC 23001-8 OutputChannelPosition from AVChannelLayout.
const AVCodecTag ff_codec_movvideo_tags[]
#define AV_PIX_FMT_YUV422P10
static int mov_get_lpcm_flags(enum AVCodecID codec_id)
Compute flags for 'lpcm' tag.
void ffio_fill(AVIOContext *s, int b, int64_t count)
int ff_mov_cenc_init(MOVMuxCencContext *ctx, uint8_t *encryption_key, int use_subsamples, int bitexact)
Initialize a CENC context.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static int mov_write_nmhd_tag(AVIOContext *pb)
This structure supplies correlation between a packet timestamp and a wall clock production time.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
AVChannelLayout ch_layout
Audio only.
static unsigned int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
static int mov_write_minf_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
static int mov_write_SA3D_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static void param_write_int(AVIOContext *pb, const char *name, int value)
#define FF_MOV_FLAG_DISABLE_CHPL
static int mov_write_ctts_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style)
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
#define MOV_TFHD_BASE_DATA_OFFSET
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AVCOL_RANGE_UNSPECIFIED
static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
const AVCodecTag ff_codec_movaudio_tags[]
#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
static int mov_write_subtitle_end_packet(AVFormatContext *s, int stream_index, int64_t dts)
int sample_rate
Audio only.
static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
static int compute_sidx_size(AVFormatContext *s)
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
static const struct @396 mov_pix_fmt_tags[]
static void find_compressor(char *compressor_name, int len, MOVTrack *track)
int64_t nb_frames
number of frames in this stream if known or 0
AVCodecID
Identify the syntax and semantics of the bitstream.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
int extradata_size
Size of the extradata content in bytes.
#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO
@ EAC3_FRAME_TYPE_AC3_CONVERT
int ff_mov_get_channel_config_from_layout(const AVChannelLayout *layout, int *config)
Get ISO/IEC 23001-8 ChannelConfiguration from AVChannelLayout.
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
@ AV_ROUND_DOWN
Round toward -infinity.
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
@ AV_SPHERICAL_HALF_EQUIRECTANGULAR
Video frame displays as a 180 degree equirectangular projection.
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s, MOVTrack *track, AVPacket *pkt)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
struct MOVTrack::@398 vc1_info
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list, unsigned fourcc)
static const AVCodecTag codec_ipod_tags[]
#define FF_OFMT_FLAG_ALLOW_FLUSH
This flag indicates that the muxer stores data internally and supports flushing it.
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
An AVChannelLayout holds information about the channel layout of audio data.
uint32_t bound_right
Distance from the right edge.
static int mov_write_dpxe_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_vvcc_tag(AVIOContext *pb, MOVTrack *track)
#define FF_MOV_FLAG_FASTSTART
uint32_t avg_bit_rate
Average rate in bits/second over the entire presentation.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int ff_vvc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to a data buffer.
static int mov_write_eac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static void mov_write_hfov_tag(AVFormatContext *s, AVIOContext *pb, const AVStereo3D *stereo3d)
uint32_t default_sample_flags
int ff_nal_parse_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
static int mov_write_vexu_tag(AVFormatContext *s, AVIOContext *pb, const AVStereo3D *stereo3d, const AVSphericalMapping *spherical_mapping)
int ff_mov_cenc_write_packet(MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size)
Write a fully encrypted packet.
int64_t avif_extent_pos[2]
static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
int need_rewrite_extradata
static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov)
double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc)
Determine a suitable 'gamma' value to match the supplied AVColorTransferCharacteristic.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static const AVCodecTag codec_mp4_tags[]
int ff_iamf_write_parameter_blocks(const IAMFContext *iamf, AVIOContext *pb, const AVPacket *pkt, void *log_ctx)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static AVDictionaryEntry * get_metadata_lang(AVFormatContext *s, const char *tag, int *lang)
#define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
Tell ff_put_wav_header() to use WAVEFORMATEX even for PCM codecs.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
static void write_matrix(AVIOContext *pb, int16_t a, int16_t b, int16_t c, int16_t d, int16_t tx, int16_t ty)
static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track, AVStream *st)
int64_t reserved_header_pos
static int mov_write_gmhd_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_stsd_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_dmlp_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
int ff_mov_iso639_to_lang(const char lang[4], int mp4)
static int64_t calc_pts_duration(MOVMuxContext *mov, MOVTrack *track)
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, int write_seq_header)
Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided AVIOContext.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
#define FF_COMPLIANCE_NORMAL
uint32_t padding
Number of pixels to pad from the edge of each cube face.
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
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
static int mov_get_evc_codec_tag(AVFormatContext *s, MOVTrack *track)
@ AV_PRIMARY_EYE_NONE
Neither eye.
void avio_wl32(AVIOContext *s, unsigned int val)
static int mov_write_subtitle_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
@ AV_PKT_DATA_PRFT
Producer Reference Time data corresponding to the AVProducerReferenceTime struct, usually exported by...
static int mov_write_track_kind(AVIOContext *pb, const char *scheme_uri, const char *value)
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 offset
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
void ff_mov_cenc_write_stbl_atoms(MOVMuxCencContext *ctx, AVIOContext *pb)
Write the cenc atoms that should reside inside stbl.
static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
unsigned int chunkNum
Chunk number if the current entry is a chunk start otherwise 0.
AVStream ** streams
A list of streams in the group.
static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
#define FF_MOV_FLAG_OMIT_TFHD_OFFSET
#define MOV_DISPOSABLE_SAMPLE
static int shift_data(AVFormatContext *s)
static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf)
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
static int mov_write_iinf_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
#define AV_LOG_INFO
Standard information.
static void mov_free(AVFormatContext *s)
#define FF_MOV_FLAG_SKIP_SIDX
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, int track_index, int sample, uint8_t *sample_data, int sample_size)
@ AV_SPHERICAL_RECTILINEAR
Video frame displays on a flat, rectangular 2D surface.
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
static int mov_write_covr(AVIOContext *pb, AVFormatContext *s)
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 ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes HEVC extradata (parameter sets and declarative SEI NAL units with nuh_layer_id == 0,...
int hint_track
the track that hints this track, -1 if no hint track is set
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
static int mov_write_iprp_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static int mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
static int mov_write_dinf_tag(AVIOContext *pb)
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
int32_t roll
Rotation around the forward vector [-180, 180].
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
#define FF_MOV_FLAG_EMPTY_MOOV
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
static av_always_inline av_const double round(double x)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
@ AV_SPHERICAL_FISHEYE
Fisheye projection (Apple).
static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
#define AV_TIME_BASE
Internal time base represented as integer.
int block_align
Audio only.
#define av_malloc_array(a, b)
static int mov_get_mpeg2_xdcam_codec_tag(AVFormatContext *s, MOVTrack *track)
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style)
int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
Retrieves the palette from a packet, either from side data, or appended to the video data in the pack...
int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf, size_t size)
#define xf(width, name, var, range_min, range_max, subs,...)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
int video_track_timescale
static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
#define MOV_TIMECODE_FLAG_DROPFRAME
static void mov_parse_truehd_frame(AVPacket *pkt, MOVTrack *trk)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int max_fragment_duration
AVFormatContext * rtp_ctx
the format context for the hinting rtp muxer
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
enum AVColorRange color_range
Video only.
#define MOV_TFHD_DEFAULT_SIZE
static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
static int mov_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
#define MOV_SAMPLE_DEPENDENCY_YES
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
void * av_calloc(size_t nmemb, size_t size)
struct IAMFContext * iamf
enum AVFieldOrder field_order
Video only.
static int64_t update_size(AVIOContext *pb, int64_t pos)
int ff_iamf_write_audio_frame(const IAMFContext *iamf, AVIOContext *pb, unsigned audio_substream_id, const AVPacket *pkt)
int ff_iamf_write_descriptors(const IAMFContext *iamf, AVIOContext *pb, void *log_ctx)
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int64_t moof_offset)
static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks, int64_t mdat_size)
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
int id
Format-specific stream ID.
static int mov_get_h264_codec_tag(AVFormatContext *s, MOVTrack *track)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb, const char *name, const char *tag, int len)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int mov_write_pixi_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s, int stream_index)
static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf)
int ff_mov_cenc_write_sinf_tag(MOVTrack *track, AVIOContext *pb, uint8_t *kid)
Write the sinf atom, contained inside stsd.
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,...
int32_t pitch
Rotation around the right vector [-90, 90].
int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write the resulting bitstream ...
#define MOV_TKHD_FLAG_IN_MOVIE
enum AVStereo3DType type
How views are packed within the video.
static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_uuid_tag_ipod(AVIOContext *pb)
Write uuid atom.
struct AVAESCTR * aes_ctr
#define AV_INPUT_BUFFER_PADDING_SIZE
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int mov_flush_fragment(AVFormatContext *s, int force)
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
static int mov_write_sthd_tag(AVIOContext *pb)
int index
stream index in AVFormatContext
#define MOV_INDEX_CLUSTER_SIZE
const AVCodecTag ff_codec_bmp_tags[]
#define FF_MOV_FLAG_SEPARATE_MOOF
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
#define AV_PROFILE_AAC_HE_V2
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
int reserved_moov_size
0 for disabled, -1 for automatic, size otherwise
#define ISOM_DVCC_DVVC_SIZE
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
static int is_cover_image(const AVStream *st)
static uint32_t rgb_to_yuv(uint32_t rgb)
static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
static void mov_write_ftyp_tag_internal(AVIOContext *pb, AVFormatContext *s, int has_h264, int has_video, int write_minor)
static int mov_write_prft_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks)
static int mov_write_fiel_tag(AVIOContext *pb, MOVTrack *track, int field_order)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
@ AVIO_DATA_MARKER_HEADER
Header data; this needs to be present for the stream to be decodeable.
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible.
static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)
static int mov_write_sidx_tags(AVIOContext *pb, MOVMuxContext *mov, int tracks, int ref_size)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL AV_RB8
static int ref[MAX_W *MAX_W]
static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int mov_flush_fragment_interleaving(AVFormatContext *s, MOVTrack *track)
static int mov_write_btrt_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track)
static int mov_mdhd_mvhd_tkhd_version(MOVMuxContext *mov, MOVTrack *track, int64_t duration)
const AVCodecTag ff_codec_movsubtitle_tags[]
static int mov_write_mdia_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
void avio_wb64(AVIOContext *s, uint64_t val)
#define MOV_TRACK_ENABLED
static int mov_write_ispe_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s, int stream_index)
int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters *par, int expected_stride)
Reshuffles the lines to use the user specified stride.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static int mov_write_sdtp_tag(AVIOContext *pb, MOVTrack *track)
enum AVStreamGroupParamsType type
Group type.
static void param_write_hex(AVIOContext *pb, const char *name, const uint8_t *value, int len)
static int mov_write_av1c_tag(AVIOContext *pb, MOVTrack *track)
uint32_t bound_left
Distance from the left edge.
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
#define avpriv_request_sample(...)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
void avio_wb24(AVIOContext *s, unsigned int val)
const VDPAUPixFmtMap * map
#define AV_CHANNEL_LAYOUT_MONO
uint32_t max_bit_rate
Maximum rate in bits/second over any window of one second.
static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDecoderConfigurationRecord *dovi)
static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track)
enum AVStereo3DView view
Determines which views are packed.
#define AV_PROFILE_AAC_HE
static int mov_write_chan_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static int mov_write_st3d_tag(AVFormatContext *s, AVIOContext *pb, AVStereo3D *stereo_3d)
unsigned cluster_capacity
static uint16_t language_code(const char *str)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static int mov_write_ipma_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s)
static int get_samples_per_packet(MOVTrack *track)
static int mov_write_smhd_tag(AVIOContext *pb)
unsigned MaxFALL
Max average light level per frame (cd/m^2).
This structure stores compressed data.
static double cr(void *priv, double x, double y)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_CODEC_ID_ADPCM_IMA_WAV
static int mov_write_source_reference_tag(AVIOContext *pb, MOVTrack *track, const char *reel_name)
static void mov_parse_vc1_frame(AVPacket *pkt, MOVTrack *trk)
#define MOV_TFHD_DURATION_IS_EMPTY
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
#define MOV_TRUN_SAMPLE_SIZE
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
static float distance(float x, float y, int band)
static int mov_write_dops_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
static int mov_write_squashed_packet(AVFormatContext *s, MOVTrack *track)
void avio_wb16(AVIOContext *s, unsigned int val)
#define flags(name, subs,...)
static int mov_write_hmhd_tag(AVIOContext *pb)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static const SheerTable rgb[2]
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.
static void param_write_string(AVIOContext *pb, const char *name, const char *value)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
static int mov_write_mdcv_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_enda_tag_be(AVIOContext *pb)
static int64_t rescale_rational(AVRational q, int b)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const struct MP4TrackKindMapping ff_mov_track_kind_table[]
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
#define MKTAG(a, b, c, d)
static int mov_write_tfrf_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int entry)
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx)
Parse timecode representation (hh:mm:ss[:;.
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
int ff_mov_cenc_avc_parse_nal_units(MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size)
Parse AVC NAL units from annex B format, the nal size and type are written in the clear while the bod...
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
unsigned frag_info_capacity
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
int tref_id
trackID of the referenced track
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
#define MOV_TRUN_SAMPLE_CTS
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
#define MOV_ISMV_TTML_TAG
static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)
#define AV_PROFILE_AAC_USAC
static unsigned int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
This structure describes how to handle spherical videos, outlining information about projection,...
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack *track)
#define MOV_PARTIAL_SYNC_SAMPLE
int32_t yaw
Rotation around the up vector [-180, 180].
static int mov_write_clli_tag(AVIOContext *pb, MOVTrack *track)
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.
int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
Writes Annex B formatted HEVC NAL units to the provided AVIOContext.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
#define av_fourcc2str(fourcc)
static int mov_write_dfla_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_sidx_tag(AVIOContext *pb, MOVTrack *track, int ref_size, int total_sidx_size)
@ AVIO_DATA_MARKER_FLUSH_POINT
A point in the output bytestream where the underlying AVIOContext might flush the buffer depending on...
unsigned int samples_in_chunk