Tutorial by Examples

libavformat usually takes in a file name and reads media directly from the filesystem. If you want to read from memory (such as streams), do the following: // Define your buffer size const int FILESTREAMBUFFERSZ = 8192; // A IStream - you choose where it comes from IStream* fileStreamData; ...
Opening a media file from the local file system. AVFormatContext *formatContext; // Open the file if(avformat_open_file(&formatContext, "path/to/file.ogg", NULL, NULL) < 0){ // Error opening file } // Do something with the file // Free resources avformat_close_inpu...
Formats contain one or more encoded and muxed streams. We usually read these in chunks, which are often called frames (though in certain cases, FFmpeg refers exclusively to decoded, raw media chunks as frames, and encoded chunks as packets, which may be confusing). To read a single frame from a form...
The API call avio_alloc_context, which sets up a custom IO context, takes in a pointer to a Read function. If you are reading from an IStream, you can use the following: /** * Reads from an IStream into FFmpeg. * * @param ptr A pointer to the user-defined IO data structure. * @param b...
The API call avio_alloc_context, which sets up a custom IO context, takes in a pointer to a Seek function. If you are reading from an IStream, you can use the following: /** * Seeks to a given position on an IStream. * * @param ptr A pointer to the user-defined IO data structure. * @pa...

Page 1 of 1