FFmpeg key structural bodies

Source: Internet
Author: User

FFMPEG Key Structures:
Reprint http://blog.csdn.net/leixiaohua1020/article/details/14214577
2016.2.26

Avframe (located in the AVCODEC.H) structure is typically used to store raw data.
===============================================================================
Here are a few of the main variables (consider the case of decoding here):
uint8_t *data[av_num_data_pointers]: Decoded raw data (Yuv,rgb for video, PCM for audio)
The size of the "row" of data in int linesize[av_num_data_pointers]:data. Note: Not necessarily equal to the width of the image, generally greater than the width of the image.
int width, Height: Video frame width and height (1920x1080,1280x720 ... )
int nb_samples: One avframe of audio may contain multiple audio frames, where the tag contains several
int format: Decoded raw data type (Yuv420,yuv422,rgb24 ... )
int Key_frame: Whether it is a keyframe
Enum Avpicturetype Pict_type: Frame type (i,b,p ... )
Avrational Sample_aspect_ratio: Aspect ratio (16:9,4:3 ...)
int64_t pts: Displaying timestamps
int Coded_picture_number: Encode frame number
int Display_picture_number: Display frame number
int8_t *QSCALE_TABLE:QP Table
uint8_t *mbskip_table: Skip macro Block table
int16_t (*motion_val[2]) [2]: Motion vector table
uint32_t *MB_TYPE: Macro block Type table
Short *DCT_COEFF:DCT coefficient, this one has not been extracted
int8_t *ref_index[2]: Motion Estimation reference frame list (it seems that this relatively new standard will involve multiple reference frames)
int Interlaced_frame: Whether it is an interlaced scan
uint8_t MOTION_SUBSAMPLE_LOG2: The number of motion vectors sampled in a macro block, take log

Avformatcontext (located in avformat.h) is a data structure that runs through the constant, and many functions use it as a parameter.
It is the structure of ffmpeg encapsulation (Flv,mp4,rmvb,avi) function.
===============================================================================
Here are a few of the main variables (consider the case of decoding here):
struct Avinputformat *iformat: Encapsulation format for input data
Aviocontext *PB: Caching of input data
unsigned int nb_streams: The number of video audio streams
Avstream **streams: Video audio streaming
Char filename[1024]: file name
int64_t Duration: Duration (in microseconds us, converted to seconds, divided by 1000000)
int bit_rate: Bit rate (unit bps, converted to kbps needs to be divided by 1000)
Avdictionary *metadata: Meta data

Many of the parameters in Avcodeccontext (located in avcodec.h) are used when encoding
===============================================================================
Here are some key variables to look at (just consider decoding here).
Enum Avmediatype Codec_type: Type of codec (video, audio ...) )
struct AVCODEC *codec: Decoder avcodec Used (H.264,MPEG2 ... )
int bit_rate: Average bit rate
uint8_t *extradata; int Extradata_size: Additional information for a specific encoder (for example, storage Sps,pps, etc. for a. h decoder)
Avrational time_base: Depending on the parameter, the PTS can be converted to the actual time in seconds s
int width, Height: If it's a video, it represents width and height.
int refs: The number of reference frames for motion estimation (there will be multiple frames in H. MPEG2, this kind of general will not be)
int sample_rate: Sample rate (audio)
int channels: Number of channels (audio)
Enum Avsampleformat sample_fmt: Sampling format
int profile: Type (inside H. I, other coding standards should also have)
int level: (and profile difference not too much)

Aviocontext (located at avio.h) is the structure of ffmpeg management input and output data.
===============================================================================
The following variables are more important in Aviocontext:
unsigned char *buffer: Cache start Location
int buffer_size: Cache size (default 32768)
unsigned char *buf_ptr: Where the current pointer is read
unsigned char *buf_end: where the cache ends
void *opaque:urlcontext Structural Body

Avcodec (located at avcodec.h) is the structure that stores codec information.
===============================================================================
Here are some of the most important variables:
const CHAR *name: The name of the codec, relatively short
const CHAR *long_name: Codec name, full length, longer
Enum Avmediatype Type: Indicates the type, whether it is video, audio, or subtitles
Enum Avcodecid Id:id, not repeating
Const avrational *supported_framerates: Supported frame rate (video only)
const enum Avpixelformat *PIX_FMTS: Supported pixel format (video only)
const INT *SUPPORTED_SAMPLERATES: Supported sample rate (audio only)
const enum Avsampleformat *SAMPLE_FMTS: Supported sampling format (audio only)
Const uint64_t *channel_layouts: Number of channels supported (audio only)
int priv_data_size: size of private data

Avstream (located in avformat.h) is the structure that stores each video/audio stream information.
===============================================================================
The important variables are as follows:
int index: Identifies the video/audio stream
Avcodeccontext *codec: Avcodeccontext that points to the video/audio stream (they are one by one corresponding relationships)
Avrational time_base: Timing. This value can be used to convert Pts,dts into real time. FFmpeg also has this field in other structures,
But according to my experience, only the Time_base in Avstream is available. Pts*time_base= Real time.
int64_t Duration: The video/audio stream length
Avdictionary *metadata: Meta data information
Avrational Avg_frame_rate: Frame rate (Note: This is very important for video)
Avpacket Attached_pic: The accompanying picture. For example, some of the album art included with MP3,AAC audio files.

Avpacket (located in avcodec.h) is a structure that stores information about compressed encoded data.
===============================================================================
The important variables are the following:
uint8_t *data: Compresses the encoded data.
For example, for H. Data for 1 Avpacket usually corresponds to a nal.
Note: Here is just the correspondence, not the exact same. There is a slight difference between them: using the FFmpeg class library to isolate the H. D stream in a multimedia file
Therefore, when using ffmpeg for AV processing, it is often possible to write the resulting avpacket data directly into a file, resulting in audio-visual stream files.
The size of the int size:data
int64_t pts: Displaying timestamps
int64_t DTS: Decoding timestamps
int Stream_index: Identifies the video/audio stream to which the avpacket belongs.

FFmpeg key structural bodies

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.