ffmpeg.libavformat.avformat

@defgroup libavf I/O and Muxing/Demuxing Library @{

Libavformat (lavf) is a library for dealing with various media container formats. Its main two purposes are demuxing - i.e. splitting a media file into component streams, and the reverse process of muxing - writing supplied data in a specified container format. It also has an @ref lavf_io "I/O module" which supports a number of protocols for accessing the data (e.g. file, tcp, http and others). Before using lavf, you need to call av_register_all() to register all compiled muxers, demuxers and protocols. Unless you are absolutely sure you won't use libavformat's network capabilities, you should also call avformat_network_init().

A supported input format is described by an AVInputFormat struct, conversely an output format is described by AVOutputFormat. You can iterate over all registered input/output formats using the av_iformat_next() / av_oformat_next() functions. The protocols layer is not part of the public API, so you can only get the names of supported protocols with the avio_enum_protocols() function.

Main lavf structure used for both muxing and demuxing is AVFormatContext, which exports all information about the file being read or written. As with most Libavformat structures, its size is not part of public ABI, so it cannot be allocated on stack or directly with av_malloc(). To create an AVFormatContext, use avformat_alloc_context() (some functions, like avformat_open_input() might do that for you).

Most importantly an AVFormatContext contains: @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat "output" format. It is either autodetected or set by user for input; always set by user for output. @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all elementary streams stored in the file. AVStreams are typically referred to using their index in this array. @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or set by user for input, always set by user for output (unless you are dealing with an AVFMT_NOFILE format).

@section lavf_options Passing options to (de)muxers Lavf allows to configure muxers and demuxers using the @ref avoptions mechanism. Generic (format-independent) libavformat options are provided by AVFormatContext, they can be examined from a user program by calling av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass from avformat_get_class()). Private (format-specific) options are provided by AVFormatContext.priv_data if and only if AVInputFormat.priv_class / AVOutputFormat.priv_class of the corresponding format struct is non-NULL. Further options may be provided by the @ref AVFormatContext.pb "I/O context", if its AVClass is non-NULL, and the protocols layer. See the discussion on nesting in @ref avoptions documentation to learn how to access those.

@defgroup lavf_decoding Demuxing @{ Demuxers read a media file and split it into chunks of data (@em packets). A @ref AVPacket "packet" contains one or more encoded frames which belongs to a single elementary stream. In the lavf API this process is represented by the avformat_open_input() function for opening a file, av_read_frame() for reading a single packet and finally avformat_close_input(), which does the cleanup.

@section lavf_decoding_open Opening a media file The minimum information required to open a file is its URL or filename, which is passed to avformat_open_input(), as in the following code: @code const char *url = "in.mp3"; AVFormatContext *s = NULL; int ret = avformat_open_input(&s, url, NULL, NULL); if (ret < 0) abort(); @endcode The above code attempts to allocate an AVFormatContext, open the specified file (autodetecting the format) and read the header, exporting the information stored there into s. Some formats do not have a header or do not store enough information there, so it is recommended that you call the avformat_find_stream_info() function which tries to read and decode a few frames to find missing information.

In some cases you might want to preallocate an AVFormatContext yourself with avformat_alloc_context() and do some tweaking on it before passing it to avformat_open_input(). One such case is when you want to use custom functions for reading input data instead of lavf internal I/O layer. To do that, create your own AVIOContext with avio_alloc_context(), passing your reading callbacks to it. Then set the @em pb field of your AVFormatContext to newly created AVIOContext.

Since the format of the opened file is in general not known until after avformat_open_input() has returned, it is not possible to set demuxer private options on a preallocated context. Instead, the options should be passed to avformat_open_input() wrapped in an AVDictionary: @code AVDictionary *options = NULL; av_dict_set(&options, "video_size", "640x480", 0); av_dict_set(&options, "pixel_format", "rgb24", 0);

if (avformat_open_input(&s, url, NULL, &options) < 0) abort(); av_dict_free(&options); @endcode This code passes the private options 'video_size' and 'pixel_format' to the demuxer. They would be necessary for e.g. the rawvideo demuxer, since it cannot know how to interpret raw video data otherwise. If the format turns out to be something different than raw video, those options will not be recognized by the demuxer and therefore will not be applied. Such unrecognized options are then returned in the options dictionary (recognized options are consumed). The calling program can handle such unrecognized options as it wishes, e.g. @code AVDictionaryEntry *e; if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); abort(); } @endcode

After you have finished reading the file, you must close it with avformat_close_input(). It will free everything associated with the file.

@section lavf_decoding_read Reading from an opened file Reading data from an opened AVFormatContext is done by repeatedly calling av_read_frame() on it. Each call, if successful, will return an AVPacket containing encoded data for one AVStream, identified by AVPacket.stream_index. This packet may be passed straight into the libavcodec decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or avcodec_decode_subtitle2() if the caller wishes to decode the data.

AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be set if known. They may also be unset (i.e. AV_NOPTS_VALUE for pts/dts, 0 for duration) if the stream does not provide them. The timing information will be in AVStream.time_base units, i.e. it has to be multiplied by the timebase to convert them to seconds.

If AVPacket.buf is set on the returned packet, then the packet is allocated dynamically and the user may keep it indefinitely. Otherwise, if AVPacket.buf is NULL, the packet data is backed by a static storage somewhere inside the demuxer and the packet is only valid until the next av_read_frame() call or closing the file. If the caller requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy of it. In both cases, the packet must be freed with av_free_packet() when it is no longer needed.

@section lavf_decoding_seek Seeking @}

@defgroup lavf_encoding Muxing @{ Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write it into files or other output bytestreams in the specified container format.

The main API functions for muxing are avformat_write_header() for writing the file header, av_write_frame() / av_interleaved_write_frame() for writing the packets and av_write_trailer() for finalizing the file.

At the beginning of the muxing process, the caller must first call avformat_alloc_context() to create a muxing context. The caller then sets up the muxer by filling the various fields in this context:

- The @ref AVFormatContext.oformat "oformat" field must be set to select the muxer that will be used. - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb "pb" field must be set to an opened IO context, either returned from avio_open2() or a custom one. - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must be created with the avformat_new_stream() function. The caller should fill the @ref AVStream.codec "stream codec context" information, such as the codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id "id" and other parameters (e.g. width / height, the pixel or sample format, etc.) as known. The @ref AVStream.time_base "stream timebase" should be set to the timebase that the caller desires to use for this stream (note that the timebase actually used by the muxer can be different, as will be described later). - The caller may fill in additional information, such as @ref AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" metadata, @ref AVFormatContext.chapters "chapters", @ref AVFormatContext.programs "programs", etc. as described in the AVFormatContext documentation. Whether such information will actually be stored in the output depends on what the container format and the muxer support.

When the muxing context is fully set up, the caller must call avformat_write_header() to initialize the muxer internals and write the file header. Whether anything actually is written to the IO context at this step depends on the muxer, but this function must always be called. Any muxer private options must be passed in the options parameter to this function.

The data is then sent to the muxer by repeatedly calling av_write_frame() or av_interleaved_write_frame() (consult those functions' documentation for discussion on the difference between them; only one of them may be used with a single muxing context, they should not be mixed). Do note that the timing information on the packets sent to the muxer must be in the corresponding AVStream's timebase. That timebase is set by the muxer (in the avformat_write_header() step) and may be different from the timebase requested by the caller.

Once all the data has been written, the caller must call av_write_trailer() to flush any buffered packets and finalize the output file, then close the IO context (if any) and finally free the muxing context with avformat_free_context(). @}

@defgroup lavf_io I/O Read/Write @{ @}

@defgroup lavf_codec Demuxers @{ @defgroup lavf_codec_native Native Demuxers @{ @} @defgroup lavf_codec_wrappers External library wrappers @{ @} @} @defgroup lavf_protos I/O Protocols @{ @} @defgroup lavf_internal Internal @{ @} @}

Members

Aliases

AVOpenCallback
alias AVOpenCallback = int function(AVFormatContext* s, AVIOContext** pb, const char* url, int flags, const AVIOInterruptCB* int_cb, AVDictionary** options)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_control_message
alias av_format_control_message = int function(AVFormatContext* s, int type, void* data, size_t data_size)

Callback used by devices to communicate with application.

Enums

AVDurationEstimationMethod
enum AVDurationEstimationMethod

The duration of a video can be estimated through various ways, and this enum can be used to know how the duration was estimated.

AVStreamParseType
enum AVStreamParseType

@}

Functions

av_add_index_entry
int av_add_index_entry(AVStream* st, int64_t pos, int64_t timestamp, int size, int distance, int flags)

Add an index entry into a sorted list. Update the entry if the list already contains it.

av_append_packet
int av_append_packet(AVIOContext* s, AVPacket* pkt, int size)

Read data and append it to the current content of the AVPacket. If pkt->size is 0 this is identical to av_get_packet. Note that this uses av_grow_packet and thus involves a realloc which is inefficient. Thus this function should only be used when there is no reasonable way to know (an upper bound of) the final size.

av_apply_bitstream_filters
int av_apply_bitstream_filters(AVCodecContext* codec, AVPacket* pkt, AVBitStreamFilterContext* bsfc)

Apply a list of bitstream filters to a packet.

av_codec_get_id
AVCodecID av_codec_get_id(AVCodecTag** tags, uint tag)

Get the AVCodecID for the given codec tag tag. If no codec id is found returns AV_CODEC_ID_NONE.

av_codec_get_tag
uint av_codec_get_tag(AVCodecTag** tags, AVCodecID id)

Get the codec tag for the given codec id id. If no codec tag is found returns 0.

av_codec_get_tag2
int av_codec_get_tag2(AVCodecTag** tags, AVCodecID id, uint* tag)

Get the codec tag for the given codec id.

av_demuxer_open
deprecated int av_demuxer_open(AVFormatContext* ic)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_dump_format
void av_dump_format(AVFormatContext* ic, int index, char* url, int is_output)

Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.

av_filename_number_test
int av_filename_number_test(char* filename)

Check whether filename actually is a numbered sequence generator.

av_find_best_stream
int av_find_best_stream(AVFormatContext* ic, AVMediaType media_type, int wanted_stream_nb, int related_stream, AVCodec** decoder_ret, int flags)

Find the "best" stream in the file. The best stream is determined according to various heuristics as the most likely to be what the user expects. If the decoder parameter is non-NULL, av_find_best_stream will find the default decoder for the stream's codec; streams for which no decoder can be found are ignored.

av_find_default_stream_index
int av_find_default_stream_index(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_find_input_format
AVInputFormat* av_find_input_format(char* short_name)

Find AVInputFormat based on the short name of the input format.

av_find_program_from_stream
AVProgram* av_find_program_from_stream(AVFormatContext* ic, AVProgram* last, int s)

Find the programs which belong to a given stream.

av_fmt_ctx_get_duration_estimation_method
AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(AVFormatContext* ctx)

Returns the method used to set ctx->duration.

av_format_get_audio_codec
AVCodec* av_format_get_audio_codec(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_control_message_cb
av_format_control_message av_format_get_control_message_cb(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_data_codec
AVCodec* av_format_get_data_codec(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_metadata_header_padding
int av_format_get_metadata_header_padding(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_opaque
void* av_format_get_opaque(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_open_cb
deprecated AVOpenCallback av_format_get_open_cb(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_probe_score
int av_format_get_probe_score(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_subtitle_codec
AVCodec* av_format_get_subtitle_codec(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_get_video_codec
AVCodec* av_format_get_video_codec(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_inject_global_side_data
void av_format_inject_global_side_data(AVFormatContext* s)

This function will cause global side data to be injected in the next packet of each stream as well as after any subsequent seek.

av_format_set_audio_codec
void av_format_set_audio_codec(AVFormatContext* s, AVCodec* c)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_control_message_cb
void av_format_set_control_message_cb(AVFormatContext* s, av_format_control_message callback)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_data_codec
void av_format_set_data_codec(AVFormatContext* s, AVCodec* c)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_metadata_header_padding
void av_format_set_metadata_header_padding(AVFormatContext* s, int c)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_opaque
void av_format_set_opaque(AVFormatContext* s, void* opaque)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_open_cb
deprecated void av_format_set_open_cb(AVFormatContext* s, AVOpenCallback callback)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_subtitle_codec
void av_format_set_subtitle_codec(AVFormatContext* s, AVCodec* c)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_format_set_video_codec
void av_format_set_video_codec(AVFormatContext* s, AVCodec* c)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_get_frame_filename
int av_get_frame_filename(char* buf, int buf_size, char* path, int number)

Return in 'buf' the path with '%d' replaced by a number.

av_get_output_timestamp
int av_get_output_timestamp(AVFormatContext* s, int stream, int64_t* dts, int64_t* wall)

Get timing information for the data currently output. The exact meaning of "currently output" depends on the format. It is mostly relevant for devices that have an internal buffer and/or work in real time. @param s media file handle @param stream stream in the media file @paramout dts DTS of the last packet output for the stream, in stream time_base units @paramout wall absolute time when that packet whas output, in microsecond @return 0 if OK, AVERROR(ENOSYS) if the format does not support it Note: some formats or devices may not allow to measure dts and wall atomically.

av_get_packet
int av_get_packet(AVIOContext* s, AVPacket* pkt, int size)

Allocate and read the payload of a packet and initialize its fields with default values.

av_guess_codec
AVCodecID av_guess_codec(AVOutputFormat* fmt, char* short_name, char* filename, char* mime_type, AVMediaType type)

Guess the codec ID based upon muxer and filename.

av_guess_format
AVOutputFormat* av_guess_format(char* short_name, char* filename, char* mime_type)

Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match.

av_guess_frame_rate
AVRational av_guess_frame_rate(AVFormatContext* ctx, AVStream* stream, AVFrame* frame)

Guess the frame rate, based on both the container and codec information.

av_guess_sample_aspect_ratio
AVRational av_guess_sample_aspect_ratio(AVFormatContext* format, AVStream* stream, AVFrame* frame)

Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.

av_hex_dump
void av_hex_dump(FILE* f, uint8_t* buf, int size)

Send a nice hexadecimal dump of a buffer to the specified file stream.

av_hex_dump_log
void av_hex_dump_log(void* avcl, int level, uint8_t* buf, int size)

Send a nice hexadecimal dump of a buffer to the log.

av_iformat_next
AVInputFormat* av_iformat_next(AVInputFormat* f)

If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registered input format after f or NULL if f is the last one.

av_index_search_timestamp
int av_index_search_timestamp(AVStream* st, int64_t timestamp, int flags)

Get the index for a specific timestamp.

av_interleaved_write_frame
int av_interleaved_write_frame(AVFormatContext* s, AVPacket* pkt)

Write a packet to an output media file ensuring correct interleaving.

av_interleaved_write_uncoded_frame
int av_interleaved_write_uncoded_frame(AVFormatContext* s, int stream_index, AVFrame* frame)

Write a uncoded frame to an output media file.

av_match_ext
int av_match_ext(char* filename, char* extensions)

Return a positive value if the given filename has one of the given extensions, 0 otherwise.

av_new_program
AVProgram* av_new_program(AVFormatContext* s, int id)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_oformat_next
AVOutputFormat* av_oformat_next(AVOutputFormat* f)

If f is NULL, returns the first registered output format, if f is non-NULL, returns the next registered output format after f or NULL if f is the last one.

av_pkt_dump2
void av_pkt_dump2(FILE* f, AVPacket* pkt, int dump_payload, AVStream* st)

Send a nice dump of a packet to the specified file stream.

av_pkt_dump_log2
void av_pkt_dump_log2(void* avcl, int level, AVPacket* pkt, int dump_payload, AVStream* st)

Send a nice dump of a packet to the log.

av_probe_input_buffer
int av_probe_input_buffer(AVIOContext* pb, AVInputFormat** fmt, char* filename, void* logctx, uint offset, uint max_probe_size)

Like av_probe_input_buffer2() but returns 0 on success

av_probe_input_buffer2
int av_probe_input_buffer2(AVIOContext* pb, AVInputFormat** fmt, char* filename, void* logctx, uint offset, uint max_probe_size)

Probe a bytestream to determine the input format. Each time a probe returns with a score that is too low, the probe buffer size is increased and another attempt is made. When the maximum probe size is reached, the input format with the highest score is returned.

av_probe_input_format
AVInputFormat* av_probe_input_format(AVProbeData* pd, int is_opened)

Guess the file format.

av_probe_input_format2
AVInputFormat* av_probe_input_format2(AVProbeData* pd, int is_opened, int* score_max)

Guess the file format.

av_probe_input_format3
AVInputFormat* av_probe_input_format3(AVProbeData* pd, int is_opened, int* score_ret)

Guess the file format.

av_program_add_stream_index
void av_program_add_stream_index(AVFormatContext* ac, int progid, uint idx)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_read_frame
int av_read_frame(AVFormatContext* s, AVPacket* pkt)

Return the next frame of a stream. This function returns what is stored in the file, and does not validate that what is there are valid frames for the decoder. It will split what is stored in the file into frames and return one for each call. It will not omit invalid data between valid frames so as to give the decoder the maximum information possible for decoding.

av_read_pause
int av_read_pause(AVFormatContext* s)

Pause a network-based stream (e.g. RTSP stream).

av_read_play
int av_read_play(AVFormatContext* s)

Start playing a network-based stream (e.g. RTSP stream) at the current position.

av_register_all
void av_register_all()

Initialize libavformat and register all the muxers, demuxers and protocols. If you do not call this function, then you can select exactly which formats you want to support.

av_register_input_format
void av_register_input_format(AVInputFormat* format)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_register_output_format
void av_register_output_format(AVOutputFormat* format)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_sdp_create
int av_sdp_create(AVFormatContext*[] ac, int n_files, char* buf, int size)

Generate an SDP for an RTP session.

av_seek_frame
int av_seek_frame(AVFormatContext* s, int stream_index, int64_t timestamp, int flags)

Seek to the keyframe at timestamp. 'timestamp' in 'stream_index'.

av_stream_get_end_pts
int64_t av_stream_get_end_pts(AVStream* st)

Returns the pts of the last muxed packet + its duration

av_stream_get_parser
AVCodecParserContext* av_stream_get_parser(AVStream* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_stream_get_r_frame_rate
AVRational av_stream_get_r_frame_rate(AVStream* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_stream_get_recommended_encoder_configuration
char* av_stream_get_recommended_encoder_configuration(AVStream* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_stream_get_side_data
uint8_t* av_stream_get_side_data(AVStream* stream, AVPacketSideDataType type, int* size)

Get side information from stream.

av_stream_new_side_data
uint8_t* av_stream_new_side_data(AVStream* stream, AVPacketSideDataType type, int size)

Allocate new information from stream.

av_stream_set_r_frame_rate
void av_stream_set_r_frame_rate(AVStream* s, AVRational r)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_stream_set_recommended_encoder_configuration
void av_stream_set_recommended_encoder_configuration(AVStream* s, char* configuration)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
av_url_split
void av_url_split(char* proto, int proto_size, char* authorization, int authorization_size, char* hostname, int hostname_size, int* port_ptr, char* path, int path_size, char* url)

Split a URL string into components.

av_write_frame
int av_write_frame(AVFormatContext* s, AVPacket* pkt)

Write a packet to an output media file.

av_write_trailer
int av_write_trailer(AVFormatContext* s)

Write the stream trailer to an output media file and free the file private data.

av_write_uncoded_frame
int av_write_uncoded_frame(AVFormatContext* s, int stream_index, AVFrame* frame)

Write a uncoded frame to an output media file.

av_write_uncoded_frame_query
int av_write_uncoded_frame_query(AVFormatContext* s, int stream_index)

Test whether a muxer supports uncoded frame.

avformat_alloc_context
AVFormatContext* avformat_alloc_context()

Allocate an AVFormatContext. avformat_free_context() can be used to free the context and everything allocated by the framework within it.

avformat_alloc_output_context2
int avformat_alloc_output_context2(AVFormatContext** ctx, AVOutputFormat* oformat, char* format_name, char* filename)

Allocate an AVFormatContext for an output format. avformat_free_context() can be used to free the context and everything allocated by the framework within it.

avformat_close_input
void avformat_close_input(AVFormatContext** s)

Close an opened input AVFormatContext. Free it and all its contents and set *s to NULL.

avformat_configuration
char* avformat_configuration()

Return the libavformat build-time configuration.

avformat_find_stream_info
int avformat_find_stream_info(AVFormatContext* ic, AVDictionary** options)

Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real framerate in case of MPEG-2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing.

avformat_flush
int avformat_flush(AVFormatContext* s)

Discard all internally buffered data. This can be useful when dealing with discontinuities in the byte stream. Generally works only with formats that can resync. This includes headerless formats like MPEG-TS/TS but should also work with NUT, Ogg and in a limited way AVI for example.

avformat_free_context
void avformat_free_context(AVFormatContext* s)

Free an AVFormatContext and all its streams. @param s context to free

avformat_get_class
AVClass* avformat_get_class()

Get the AVClass for AVFormatContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

avformat_get_mov_audio_tags
AVCodecTag* avformat_get_mov_audio_tags()

@return the table mapping MOV FourCCs for audio to AVCodecID.

avformat_get_mov_video_tags
AVCodecTag* avformat_get_mov_video_tags()

@return the table mapping MOV FourCCs for video to libavcodec AVCodecID.

avformat_get_riff_audio_tags
AVCodecTag* avformat_get_riff_audio_tags()

@return the table mapping RIFF FourCCs for audio to AVCodecID.

avformat_get_riff_video_tags
AVCodecTag* avformat_get_riff_video_tags()

@return the table mapping RIFF FourCCs for video to libavcodec AVCodecID.

avformat_license
char* avformat_license()

Return the libavformat license.

avformat_match_stream_specifier
int avformat_match_stream_specifier(AVFormatContext* s, AVStream* st, char* spec)

Check if the stream st contained in s is matched by the stream specifier spec.

avformat_network_deinit
int avformat_network_deinit()

Undo the initialization done by avformat_network_init.

avformat_network_init
int avformat_network_init()

Do global initialization of network components. This is optional, but recommended, since it avoids the overhead of implicitly doing the setup for each session.

avformat_new_stream
AVStream* avformat_new_stream(AVFormatContext* s, AVCodec* c)

Add a new stream to a media file.

avformat_open_input
int avformat_open_input(AVFormatContext** ps, char* filename, AVInputFormat* fmt, AVDictionary** options)

Open an input stream and read the header. The codecs are not opened. The stream must be closed with avformat_close_input().

avformat_query_codec
int avformat_query_codec(AVOutputFormat* ofmt, AVCodecID codec_id, int std_compliance)

Test if the given container can store a codec.

avformat_queue_attached_pictures
void avformat_queue_attached_pictures(AVFormatContext* s)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
avformat_seek_file
int avformat_seek_file(AVFormatContext* s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)

Seek to timestamp ts. Seeking will be done so that the point from which all active streams can be presented successfully will be closest to ts and within min/max_ts. Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.

avformat_version
uint avformat_version()

Return the LIBAVFORMAT_VERSION_INT constant.

avformat_write_header
int avformat_write_header(AVFormatContext* s, AVDictionary** options)

Allocate the stream private data and write the stream header to an output media file.

Manifest constants

AVFMTCTX_NOHEADER
enum AVFMTCTX_NOHEADER;

< signal that no header is present (streams are added dynamically)

AVFMT_ALLOW_FLUSH
enum AVFMT_ALLOW_FLUSH;

< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function.

AVFMT_AVOID_NEG_TS_AUTO
enum AVFMT_AVOID_NEG_TS_AUTO;

< Enabled when required by target format

AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE
enum AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE;

< Shift timestamps so they are non negative

AVFMT_AVOID_NEG_TS_MAKE_ZERO
enum AVFMT_AVOID_NEG_TS_MAKE_ZERO;

< Shift timestamps so that they start at 0

AVFMT_EVENT_FLAG_METADATA_UPDATED
enum AVFMT_EVENT_FLAG_METADATA_UPDATED;

< The call resulted in updated metadata.

AVFMT_FLAG_BITEXACT
enum AVFMT_FLAG_BITEXACT;

When muxing, try to avoid writing any random/volatile data to the output. This includes any random IDs, real-time timestamps/dates, muxer version, etc.

AVFMT_FLAG_CUSTOM_IO
enum AVFMT_FLAG_CUSTOM_IO;

< The caller has supplied a custom AVIOContext, don't avio_close() it.

AVFMT_FLAG_DISCARD_CORRUPT
enum AVFMT_FLAG_DISCARD_CORRUPT;

< Discard frames marked corrupted

AVFMT_FLAG_FLUSH_PACKETS
enum AVFMT_FLAG_FLUSH_PACKETS;

< Flush the AVIOContext every packet.

AVFMT_FLAG_GENPTS
enum AVFMT_FLAG_GENPTS;

< Generate missing pts even if it requires parsing future frames.

AVFMT_FLAG_IGNDTS
enum AVFMT_FLAG_IGNDTS;

< Ignore DTS on frames that contain both DTS & PTS

AVFMT_FLAG_IGNIDX
enum AVFMT_FLAG_IGNIDX;

< Ignore index.

AVFMT_FLAG_KEEP_SIDE_DATA
enum AVFMT_FLAG_KEEP_SIDE_DATA;

< Don't merge side data but keep it separate.

AVFMT_FLAG_MP4A_LATM
enum AVFMT_FLAG_MP4A_LATM;

< Enable RTP MP4A-LATM payload

AVFMT_FLAG_NOBUFFER
enum AVFMT_FLAG_NOBUFFER;

< Do not buffer frames when possible

AVFMT_FLAG_NOFILLIN
enum AVFMT_FLAG_NOFILLIN;

< Do not infer any values from other values, just return what is stored in the container

AVFMT_FLAG_NONBLOCK
enum AVFMT_FLAG_NONBLOCK;

< Do not block when reading packets from input.

AVFMT_FLAG_NOPARSE
enum AVFMT_FLAG_NOPARSE;

< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled

AVFMT_FLAG_PRIV_OPT
enum AVFMT_FLAG_PRIV_OPT;

< Enable use of private options by delaying codec open (this could be made default once all code is converted)

AVFMT_FLAG_SORT_DTS
enum AVFMT_FLAG_SORT_DTS;

< try to interleave outputted packets by dts (using this flag can slow demuxing down)

AVFMT_GENERIC_INDEX
enum AVFMT_GENERIC_INDEX;

< Use generic index building code.

AVFMT_GLOBALHEADER
enum AVFMT_GLOBALHEADER;

< Format wants global header.

AVFMT_NEEDNUMBER
enum AVFMT_NEEDNUMBER;

< Needs '%d' in filename.

AVFMT_NOBINSEARCH
enum AVFMT_NOBINSEARCH;

< Format does not allow to fallback to binary search via read_timestamp

AVFMT_NODIMENSIONS
enum AVFMT_NODIMENSIONS;

< Format does not need width/height

AVFMT_NOFILE
enum AVFMT_NOFILE;

Demuxer will use avio_open, no opened file should be provided by the caller.

AVFMT_NOGENSEARCH
enum AVFMT_NOGENSEARCH;

< Format does not allow to fallback to generic search

AVFMT_NOSTREAMS
enum AVFMT_NOSTREAMS;

< Format does not require any streams

AVFMT_NOTIMESTAMPS
enum AVFMT_NOTIMESTAMPS;

< Format does not need / have any timestamps.

AVFMT_NO_BYTE_SEEK
enum AVFMT_NO_BYTE_SEEK;

< Format does not allow seeking by bytes

AVFMT_RAWPICTURE
enum AVFMT_RAWPICTURE;

< Format wants AVPicture structure for raw picture data.

AVFMT_SEEK_TO_PTS
enum AVFMT_SEEK_TO_PTS;

< Seeking is based on PTS

AVFMT_SHOW_IDS
enum AVFMT_SHOW_IDS;

< Show format stream IDs numbers.

AVFMT_TS_DISCONT
enum AVFMT_TS_DISCONT;

< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps

AVFMT_TS_NEGATIVE
enum AVFMT_TS_NEGATIVE;

< Format does not require strictly increasing timestamps, but they must still be monotonic *//**< Format allows muxing negative timestamps. If not set the timestamp will be shifted in av_write_frame and av_interleaved_write_frame so they start from 0. The user or muxer can override this through AVFormatContext.avoid_negative_ts

AVFMT_TS_NONSTRICT
enum AVFMT_TS_NONSTRICT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVFMT_VARIABLE_FPS
enum AVFMT_VARIABLE_FPS;

< Format allows variable fps.

AVINDEX_KEYFRAME
enum AVINDEX_KEYFRAME;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVPROBE_PADDING_SIZE
enum AVPROBE_PADDING_SIZE;

< extra allocated bytes at the end of the probe buffer

AVPROBE_SCORE_EXTENSION
enum AVPROBE_SCORE_EXTENSION;

< score for file extension

AVPROBE_SCORE_MAX
enum AVPROBE_SCORE_MAX;

< maximum score

AVPROBE_SCORE_MIME
enum AVPROBE_SCORE_MIME;

< score for file mime type

AVPROBE_SCORE_RETRY
enum AVPROBE_SCORE_RETRY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVPROBE_SCORE_STREAM_RETRY
enum AVPROBE_SCORE_STREAM_RETRY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVSEEK_FLAG_ANY
enum AVSEEK_FLAG_ANY;

< seek to any frame, even non-keyframes

AVSEEK_FLAG_BACKWARD
enum AVSEEK_FLAG_BACKWARD;

* @} *////< seek backwar

AVSEEK_FLAG_BYTE
enum AVSEEK_FLAG_BYTE;

< seeking based on position in bytes

AVSEEK_FLAG_FRAME
enum AVSEEK_FLAG_FRAME;

< seeking based on frame number

AVSTREAM_EVENT_FLAG_METADATA_UPDATED
enum AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_ATTACHED_PIC
enum AV_DISPOSITION_ATTACHED_PIC;

The stream is stored in the file as an attached picture/"cover art" (e.g. APIC frame in ID3v2). The single packet associated with it will be returned among the first few packets read from the file unless seeking takes place. It can also be accessed at any time in AVStream.attached_pic.

AV_DISPOSITION_CAPTIONS
enum AV_DISPOSITION_CAPTIONS;

To specify text track kind (different from subtitles default).

AV_DISPOSITION_CLEAN_EFFECTS
enum AV_DISPOSITION_CLEAN_EFFECTS;

< stream without voice

AV_DISPOSITION_COMMENT
enum AV_DISPOSITION_COMMENT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_DEFAULT
enum AV_DISPOSITION_DEFAULT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_DESCRIPTIONS
enum AV_DISPOSITION_DESCRIPTIONS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_DUB
enum AV_DISPOSITION_DUB;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_FORCED
enum AV_DISPOSITION_FORCED;

Track should be used during playback by default. Useful for subtitle track that should be displayed even when user did not explicitly ask for subtitles.

AV_DISPOSITION_HEARING_IMPAIRED
enum AV_DISPOSITION_HEARING_IMPAIRED;

< stream for hearing impaired audiences

AV_DISPOSITION_KARAOKE
enum AV_DISPOSITION_KARAOKE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_LYRICS
enum AV_DISPOSITION_LYRICS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_METADATA
enum AV_DISPOSITION_METADATA;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_ORIGINAL
enum AV_DISPOSITION_ORIGINAL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_DISPOSITION_VISUAL_IMPAIRED
enum AV_DISPOSITION_VISUAL_IMPAIRED;

< stream for visual impaired audiences

AV_PROGRAM_RUNNING
enum AV_PROGRAM_RUNNING;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AV_PTS_WRAP_ADD_OFFSET
enum AV_PTS_WRAP_ADD_OFFSET;

< add the format specific offset on wrap detection

AV_PTS_WRAP_IGNORE
enum AV_PTS_WRAP_IGNORE;

* Options for behavior on timestamp wrap detection. *////< ignore the wra

AV_PTS_WRAP_SUB_OFFSET
enum AV_PTS_WRAP_SUB_OFFSET;

< subtract the format specific offset on wrap detection

FF_FDEBUG_TS
enum FF_FDEBUG_TS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
MAX_PROBE_PACKETS
enum MAX_PROBE_PACKETS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
MAX_REORDER_DELAY
enum MAX_REORDER_DELAY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
MAX_STD_TIMEBASES
enum MAX_STD_TIMEBASES;

@}

RAW_PACKET_BUFFER_SIZE
enum RAW_PACKET_BUFFER_SIZE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

AVChapter
struct AVChapter
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVCodecTag
struct AVCodecTag
AVFormatContext
struct AVFormatContext

Format I/O context. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVFormatContext) must not be used outside libav*, use avformat_alloc_context() to create an AVFormatContext.

AVFormatInternal
struct AVFormatInternal
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVFrac
struct AVFrac

The exact value of the fractional number is: 'val + num / den'. num is assumed to be 0 <= num < den.

AVIndexEntry
struct AVIndexEntry
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVInputFormat
struct AVInputFormat

@addtogroup lavf_decoding @{

AVOutputFormat
struct AVOutputFormat

@addtogroup lavf_encoding @{

AVPacketList
struct AVPacketList
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
AVProbeData
struct AVProbeData

This structure contains the data a format has to probe a file.

AVProgram
struct AVProgram

New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVProgram) must not be used outside libav*.

AVStream
struct AVStream

Stream structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVStream) must not be used outside libav*.

AVStreamInternal
struct AVStreamInternal
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Meta