Audio and video processing FFMPeg development actual combat (2) - FFMPeg library modules Introduction

1, library files

FFMPeg (3.2) library a total of eight libraries:

avcodec.lib
avdevice.lib
avfilter.lib
avformat.lib
avutil.lib
postproc.lib
swresample.lib
swscale.lib

** various versions of the library, there may be different, there may be changes in the future. This example describes in FFMPeg (3.2).

** Linux at the library under the file name with the windows slightly different, such as: avcodec.lib -> libavcodec.a.

1.avutil.lib
utility core tool library, one of the most basic module, other modules will depend on the library to do some basic audio and video processing operations. It comprises a portable security string functions, random number generator, a data structure, additional mathematical functions, encryption, and multimedia-related functions.

2.avformat.lib
file format and protocol libraries, and encapsulates Protocol layer Demuxer, Muxer layer, such that the protocols and formats for developers is transparent. Audio, video and subtitle stream multiplexing and demultiplexing (multiplexing and demultiplexing) provides a common framework. It comprises a plurality of multiplexers multimedia container formats and the demultiplexer.

It also supports several input and output protocols to access media resources.

3.avcodec.lib
codec library, a Codec encapsulating layer, but some have their own codec is the License, FFmpe not added as default libx264, FDK-AAC, Lame ( mp3) like library, but FFmpeg is a frame, other third-party codec may be a way to add plug-in, provides a unified interface for developers. As encoding / decoding the frame, and comprises an audio, a plurality of video encoders and decoders, and subtitle stream, filters and a plurality of bit streams.

4.avfilter.lib
audio and video library filters, the module comprising a video processing audio effects and special effects, using the API FFmpeg codec process can be used efficiently to make the effect processing module as audio and video data.

5.avdevice.lib
input and output device library that provides a common framework for the device for gripping and rendering from many common multimedia input / output devices, and supports a plurality of input and output devices, including Video4Linux2, VfW, DShow and ALSA.

6.swresample.lib
audio resampling may be the number of channels of the digital audio information of the plurality of basic data format conversion, the sampling rate.

Format conversion: is a sampling type (e.g., sample from a 16-bit signed to unsigned 8-bit or floating-point sampling) process. When the packed layout (all samples belong to the same interleave buffer in different channels) to the layout (all samples belonging to the same channel or stored in a dedicated buffer "flat"), the converter further packed processing.

Resampling: audio rate is changed the process, for example from a high sampling rate 44100Hz to 8000Hz. The audio sampling rate is high to low conversion lossy process. There are several options and resampling algorithms available.

Re matrixing: the layout of the process is to change the channel, for example, from mono to stereo. When the input channels can not be mapped to the output stream, which is detrimental to the process, because it involves different gain factors and mixed. Enable various other audio transducer (e.g., stretching and filling) by the specific options

7.swscale.lib
The means for image scaling and color space and pixel format conversion, re-adjustment, can be converted YUV data to RGB data.

Re-adjust: a process to change the size of the video. There are several options and algorithms can be used to re-adjust. This is usually a lossy process.
Pixel format conversion: an image conversion process is an image format and color space, for example, from the plane YUV420P converted to RGB24. It also handles packed converted, i.e. from the packed layout (all pixels belonging to different planes of the same buffer in interleaved) into a planar layout (belonging to the same plane of all samples stored in dedicated buffer or "plane" in) the conversion. If the source and target different color space, which is usually detrimental to the process.

8.postproc.lib
This module is used for post-processing, when we use the filter, you need to open this module, filter will use some basic functions of this module.

2, commonly used functions

av_register_all (): All components registered
avformat_open_input (): Open the input video files
avformat_find_stream_info (): Get video file information
avcodec_find_decoder (): Find decoder
avcodec_open2 (): Open the decoder
av_read_frame (): a compressed data read from the input file
avcodec_decode_video2 (): decoding a compressed data frames
avcodec_close (): Close decoder
avformat_close_input (): Close an input video file

We demonstrate the use of each function in future combat.

3, each library function table

To be added.

Published 43 original articles · won praise 9 · views 2654

Guess you like

Origin blog.csdn.net/x879014419/article/details/105265170