Go to the documentation of this file.
   54 #define AVI_INDEX_CLUSTER_SIZE 16384 
   55 #define AVI_MASTER_INDEX_PREFIX_SIZE    (8+2+1+1+4+8+4+4) 
   56 #define AVI_MASTER_INDEX_ENTRY_SIZE     16   
   57 #define AVI_MASTER_INDEX_SIZE_DEFAULT   256  
  111     AVIStream *avist = 
s->streams[stream_index]->priv_data;
 
  159                                   const char *riff_tag, 
const char *list_tag)
 
  166     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  202     int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
 
  207     for (
n = 0; 
n < 
s->nb_streams; 
n++) {
 
  211         par = 
s->streams[
n]->codecpar;
 
  238     unsigned char tag[5];
 
  263     int bitrate, 
n, 
i, nb_frames, au_byterate, au_ssize, au_scale;
 
  264     int64_t max_stream_duration = 0;
 
  267     int64_t list1, list2, strh, strf;
 
  277     for (
n = 0; 
n < 
s->nb_streams; 
n++) {
 
  279         if (!
s->streams[
n]->priv_data)
 
  293     for (
n = 0; 
n < 
s->nb_streams; 
n++) {
 
  299             max_stream_duration = 
FFMAX(stream_duration, max_stream_duration);
 
  309         double duration_est, filesize_est;
 
  312         else if (max_stream_duration > 0)
 
  313             duration_est = (double)max_stream_duration / 
AV_TIME_BASE;
 
  315             duration_est = 10 * 60 * 60; 
 
  316         filesize_est = duration_est * (
bitrate / 8) * 1.10; 
 
  319         av_log(
s, 
AV_LOG_DEBUG, 
"duration_est:%0.3f, filesize_est:%0.1fGiB, master_index_max_size:%d\n",
 
  355     for (
i = 0; 
i < 
n; 
i++) {
 
  400             && au_byterate > 1000LL*au_scale) {
 
  406             au_scale = au_byterate = 0;
 
  460                     av_log(
s, 
AV_LOG_ERROR, 
"%s rawvideo cannot be written to avi, output file will be unreadable\n",
 
  478                     "Invalid or not supported codec type '%s' found in the input\n",
 
  492                     char* str = 
av_asprintf(
"Subtitle - %s-xx;02", langstr);
 
  539                     start_line = (
i == 0) ? 0 : 1;
 
  541                     start_line = (
i == 0) ? 1 : 0;
 
  567         for (
i = 0; 
i < 248; 
i += 4)
 
  577     padding = 
s->metadata_header_padding;
 
  584         for (
i = padding; 
i > 0; 
i -= 4)
 
  601     AVIStream *avist = 
s->streams[stream_index]->priv_data;
 
  603     int au_byterate, au_ssize, au_scale;
 
  617     if (
s->streams[stream_index]->codecpar->codec_type == 
AVMEDIA_TYPE_AUDIO && au_ssize > 0) {
 
  623         avio_wl32(pb, audio_segm_size / au_ssize);  
 
  635     char ix_tag[] = 
"ix00";
 
  640     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  655     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  680                           (ie->
flags & 0x10 ? 0 : 0x80000000));
 
  699         int empty, stream_id = -1;
 
  702         for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  703             avist        = 
s->streams[
i]->priv_data;
 
  709             for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  710                 avist = 
s->streams[
i]->priv_data;
 
  715                 if (empty || tie->pos < ie->
pos) {
 
  722                 avist = 
s->streams[stream_id]->priv_data;
 
  727                                   s->streams[stream_id]->codecpar->codec_type);
 
  745     AVIStream *avist    = 
s->streams[stream_index]->priv_data;
 
  759         empty_packet.
size         = 0;
 
  788         AVIStream *avist = 
s->streams[stream_index]->priv_data;
 
  794             int expected_stride = ((par->
width * bpc + 31) >> 5)*4;
 
  796             if (reshuffle_ret < 0)
 
  797                 return reshuffle_ret;
 
  813                     for (
i = 0; 
i < pal_size; 
i++) {
 
  822                     unsigned char tag[5];
 
  824                     tag[2] = 
'p'; 
tag[3] = 
'c';
 
  842                     for (
i = 0; 
i < pal_size; 
i++) {
 
  866     unsigned char tag[5];
 
  867     unsigned int flags = 0;
 
  872     AVIStream *avist    = 
s->streams[stream_index]->priv_data;
 
  920     int i, j, 
n, nb_frames;
 
  923     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  943             for (
n = nb_frames = 0; 
n < 
s->nb_streams; 
n++) {
 
  948                     if (nb_frames < avist->packet_count)
 
  967                "consider re-muxing with 'reserve_index_space' option value >= %d\n",
 
  971     for (
i = 0; 
i < 
s->nb_streams; 
i++) {
 
  986 #define OFFSET(x) offsetof(AVIContext, x) 
  987 #define ENC AV_OPT_FLAG_ENCODING_PARAM 
  989     { 
"reserve_index_space", 
"reserve space (in bytes) at the beginning of the file for each stream index", 
OFFSET(reserve_index_space), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, 
ENC },
 
  990     { 
"write_channel_mask", 
"write channel mask into wave format header", 
OFFSET(write_channel_mask), 
AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, 
ENC },
 
 1004     .mime_type      = 
"video/x-msvideo",
 
 1005     .extensions     = 
"avi",
 
  
int64_t strh_flags_offset
 
static const AVOption options[]
 
@ AV_LANG_ISO639_1
3-char terminological language codes as per ISO-IEC 639-2
 
static char * avi_stream2fourcc(char *tag, int index, enum AVMediaType type)
 
#define AV_LOG_WARNING
Something somehow does not look correct.
 
AVPixelFormat
Pixel format.
 
static av_cold int init(AVCodecContext *avctx)
 
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
 
enum AVMediaType codec_type
General type of the encoded data.
 
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
 
This struct describes the properties of an encoded stream.
 
static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, const char *riff_tag, const char *list_tag)
 
#define AVI_MASTER_INDEX_SIZE_DEFAULT
 
#define MKTAG(a, b, c, d)
 
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
 
char * av_asprintf(const char *fmt,...)
 
static AVIIentry * avi_get_ientry(const AVIIndex *idx, int ent_id)
 
const AVCodecTag ff_codec_wav_tags[]
 
void avio_wl64(AVIOContext *s, uint64_t val)
 
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
 
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
 
static int avi_write_counters(AVFormatContext *s, int riff_id)
 
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
 
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
 
int64_t audio_strm_offset
 
uint32_t palette[AVPALETTE_COUNT]
 
void avio_wl16(AVIOContext *s, unsigned int val)
 
static const AVClass avi_muxer_class
 
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
 
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 avi_add_ientry(AVFormatContext *s, int stream_index, char *tag, unsigned int flags, unsigned int size)
 
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
 
int64_t duration
Decoding: duration of the stream, in stream time base.
 
static int avi_write_trailer(AVFormatContext *s)
 
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
 
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
uint32_t old_palette[AVPALETTE_COUNT]
 
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
 
static int avi_write_header(AVFormatContext *s)
 
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 
static av_cold int avi_init(struct AVFormatContext *s)
 
#define AVI_MASTER_INDEX_PREFIX_SIZE
 
#define av_assert0(cond)
assert() equivalent, that is always enabled.
 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
 
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
 
static enum AVPixelFormat pix_fmt
 
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
 
static int avi_write_idx1(AVFormatContext *s)
 
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
 
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the then the processing requires a frame on this link and the filter is expected to make efforts in that direction The status of input links is stored by the fifo and status_out fields
 
AVOutputFormat ff_avi_muxer
 
#define av_realloc_f(p, o, n)
 
AVCodecParameters * codecpar
Codec parameters associated with this stream.
 
#define LIBAVUTIL_VERSION_INT
 
#define AVISF_VIDEO_PALCHANGES
 
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.
 
static void update_odml_entry(AVFormatContext *s, int stream_index, int64_t ix, int size)
 
static int write_trailer(AVFormatContext *s1)
 
#define AVI_MAX_RIFF_SIZE
 
Rational number (pair of numerator and denominator).
 
const char * av_default_item_name(void *ptr)
Return the context name.
 
#define AVI_MAX_STREAM_COUNT
 
void avio_w8(AVIOContext *s, int b)
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
 
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
 
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
 
const char * ff_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
Convert a language code to a target codespace.
 
#define AV_NOPTS_VALUE
Undefined timestamp value.
 
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
 
#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK
Tell ff_put_wav_header() to write an empty channel mask.
 
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
 
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)
 
void avio_wl32(AVIOContext *s, unsigned int val)
 
int flags
A combination of AV_PKT_FLAG values.
 
void ff_end_tag(AVIOContext *pb, int64_t start)
 
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
 
static int avi_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
 
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
 
#define i(width, name, range_min, range_max)
 
#define AVI_MASTER_INDEX_ENTRY_SIZE
 
#define AV_TIME_BASE
Internal time base represented as integer.
 
int block_align
Audio only.
 
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
 
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
 
#define AVI_INDEX_CLUSTER_SIZE
 
enum AVFieldOrder field_order
Video only.
 
int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
Check presence of H264 startcode.
 
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
 
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
 
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
 
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
 
static void write_odml_master(AVFormatContext *s, int stream_index)
 
int master_odml_riff_id_base
 
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata)
 
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
 
const AVCodecTag ff_codec_bmp_tags[]
 
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
 
const PixelFormatTag avpriv_pix_fmt_bps_avi[]
 
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
 
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
 
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
 
int bits_per_coded_sample
The number of bits per sample in the codedwords.
 
#define avpriv_request_sample(...)
 
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
 
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
 
This structure stores compressed data.
 
#define AVIF_ISINTERLEAVED
 
#define flags(name, subs,...)
 
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
 
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
 
static void write_header(FFV1Context *f)
 
int64_t audio_strm_length
 
static int write_skip_frames(AVFormatContext *s, int stream_index, int64_t dts)
 
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
 
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 master_index_max_size
 
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
 
static int avi_write_ix(AVFormatContext *s)