Category:FFMPEG学习笔记
Article From:https://www.cnblogs.com/CoderTian/p/9061976.html

1.FFmpegBasic composition

FFmpegThe basic components of the framework include modules such as AVFormat, AVCodec, AVFilter, AVDevice, AVUtils and so on, as shown in the following figure.

 

  • libavformat:It is used for the generation and analysis of various audio and video encapsulation formats, including obtaining the information required for decoding to generate the decoding context structure and reading audio and video frames; the format resolution protocol of audio and video provides an independent audio or video stream source for the libavcodec analysis of code streams.
  • libavcodec:For all types of sound / image codec. The library is the core of audio and video codec, which implements the functions of most decoders visible on the market. The libavcodec library is included or applied by other large decoders, such as ffdshow, Mplayer and so on.
  • libavdevice : Hardware collection, acceleration, display. Operating audio and video capture or output devices commonly used in computers: ALSA, AUDIO_BEOS, JACK, OSS, 1394, VFW.
  • libavfilter:filter(FileIO、 FPS、 DrawText) Audio and video filters are developed, such as aspect ratio clipping, formatting, non formatting, stretching.
  • libavutil:Contains some public library of utility functions, including arithmetic operation.
  • libavresample:Audio and video sealing and decoding format presupposition and so on.
  • libswscale:(The original video format conversion is used for video scene scaling, color mapping conversion, image color space or format conversion, such as rgb565, rgb888 and so on and YUV420.
  • libswresample:The original audio format transcoding.
  • libpostproc:(A simple algorithm for synchronization and time computation is used for post processing; post processing of audio and video applications, such as the deblocking effect of images.
  • ffmpeg:A tool provided by the project can be used for format conversion, decoding or instant encoding of TV cards.
  • ffsever:A HTTP multimedia instant broadcast streaming server.
  • ffplay:It is a simple player, using ffmpeg library to parse and decode, and display it through SDL.

2.FFmpegData structure in it

  • AVFormatContext The encapsulation format context structure is also a global structure, which preserves the relevant information of the video file encapsulation format.

    • iformat:AVInputFormat of the input video
    • nb_streams :The number of AVStream inputs for the input video
    • streams :AVStream [] array of input video
    • duration :The length of the input video (in microseconds)
    • bit_rate :Rate of input video
  • AVInputFormat Each package format (for example, FLV, MKV, MP4, AVI) corresponds to a structure.

    • name:Encapsulation format name
    • long_name:The long name of the encapsulation format
    • extensions:The extension name of the encapsulation format
    • id:Encapsulation format ID
    • Some package format processing interface functions
    • FFmpegData structure analysis
  • AVStream Each video (audio) stream in a video file corresponds to a structure.

    • id:Serial number
    • codec:The corresponding AVCodecContext
    • time_base:The time base of the stream
    • r_frame_rate:The frame rate of the stream
  • AVCodecContextThe encoder context structure preserves the video (audio) codec related information.

    • codec:Codec AVCodec
    • width, height:The height of the image (only for video)
    • pix_fmt:Pixel format (for video only)
    • sample_rate:Sampling rate (for audio only)
    • channels:Number of channels (for audio only)
    • sample_fmt:Sampling format (for audio only)
  • AVCodec Each video (audio) codec (for example, the H.264 decoder) corresponds to a structure.

    • name:Codec name
    • long_name:Codec long name
    • type:codec type
    • id:Codec ID
    • Some codec interface functions
  • AVPacket Store a frame of compressed coded data.

    • pts:presentation time stamp
    • dts :Decoding time stamp
    • data :Compressed coded data
    • size :Compressed coded data size
    • stream_index :AVStream
  • AVFrameThe pixel (sampling) data is stored after a frame decode.

    • data:Decoded image pixel data (audio sampling data).
    • linesize:For video, the size of a row of pixels in the image is the size of the audio frame for the audio.
    • width, height:The width of the image is high (only for video).
    • key_frame:Whether it is a key frame (only for video).
    • pict_type:Frame type (only for video). For example, I, P, B.

Reference: https://blog.csdn.net/leixiaohua1020/article/details/11693997

 

Leave a Reply

Your email address will not be published. Required fields are marked *