Modules | |
Demuxing | |
Demuxers read a media file and split it into chunks of data (packets). | |
Muxing | |
I/O Read/Write | |
Demuxers | |
External library wrappers | |
I/O Protocols | |
Core functions | |
Functions for querying libavformat capabilities, allocating core structures, etc. | |
Utility functions | |
Miscellaneous utility functions related to both muxing and demuxing (or neither). | |
Files | |
file | avformat.h |
Main libavformat public API header. | |
file | version.h |
Libavformat version macros. |
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 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: