FFMPEG COMPILATION AND CROPPING INSTRUCTION
The raw ffmpeg library contains the following:
-
libavformat
It is used for the generation and analysis of audio and video packaging formats, including functions such as obtaining information required for decoding to generate decoding context structure and reading audio and video frames;
It is an audio and video format analysis protocol that provides independent audio or video data rate sources for libavcodec to analyze the data rate.
-
libavcodec
It is a core that used for various types of audio/image encoding and decoding, and realized most of the decoder functions available on the market.
-
libavdevice
It is used for hardware acquisition, acceleration, and display. Operate audio and video capture or output devices commonly used in computers.
-
libavfilter
It is used for the development of audio and video filters, the development of audio and video filters, such as aspect ratio, cropping, formatting, and non-formatting scaling.
-
libavutil
It is a utility library to aid portable multimedia programming., such as arithmetic operations and character operations.
-
libavresample
Preset audio and video encoding and decoding formats, etc.
-
libswscale
It realizes original video format conversion, used for video scene scaling, color mapping conversion, image color or space or format conversion, such as conversion between rgb565 and yuv420, rgb888 and yuv420.
-
libswresample
It is used for transcoding the original audio format.
-
libpostproc
It is a simple algorithm for synchronization and time calculation, used for post effect production and audio or video application post-processing. Such as remove the image block artifact.
Before compiling the ffmpeg source code, we can choose whether to compile and generate the above library by configuring the compilation parameters. Generally speaking, libavformat
, libavcodec
, and libavutil
are essential to realize basic audio and video codec functions, We crop the size of the library file by enabling or disabling the components supported by ffmpeg, such as codec, demuxer, muxer, parser, protocol types, etc.
In the ffmpeg source code path, running ./configure --help
will prompt the meaning of each compilation parameter. The main concerns are as follows.
-
General configuration parameters
--prefix=DIR // Installation path --shlibdir=DIR // Dynamic library installation path --libdir=DIR // Static library installation path --enable-cross-compile // Enable cross compilation --arch=NAME // Supported hardware platform --target-os=OS // Target operating system --cross-prefix=NAME // Supported cross compiler --disable-gpl // No support for gpl --enable-nonfree // Allow non-free code --enable-error-resilience // Enable error resistance --disable-debug // Disable debug --enable-shared // Generate dynamic link library --enable-small // Optimize size instead of speed --disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-programs --disable-symver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages // These parameters mean not to compile ffmpeg applications, documentation, etc.
The following parameters are used for cropping:
--enable-avformat // Enable libavformat --enable-avcodec // Enable libavcodec --disable-avresample // Disable libavresample --disable-avfilter // Disable libavfilter --disable-avdevice // Disable libacdevice --disable-postproc // Disable libpostproc --disable-swscale // Disable libswscale --disable-swresample // Disable libswresample –disable-everything // Disable all the components –disable-encoder=NAME // Disable NAME encoder –enable-encoder=NAME // Enable NAME encoder –disable-encoders // Disable all the supported encoder –disable-decoder=NAME // Disable NAME decoder –enable-decoder=NAME // Enable NAME decoder –disable-decoders // Disable all the supported decoder –disable-hwaccel=NAME // Disable NAME hardware accelerator –enable-hwaccel=NAME // Enable NAME hardware accelerator –disable-hwaccels // Disable all the supported hardware accelerator –disable-muxer=NAME // Disable NAME muxer –enable-muxer=NAME // Enable NAME muxer –disable-muxers // Disable all the supported muxers –disable-demuxer=NAME // Disable NAME demuxer –enable-demuxer=NAME // Enable NAME demuxer –disable-demuxers // Disable all the supported demuxers –enable-parser=NAME // Disable NAME parser –disable-parser=NAME // Enable NAME parser –disable-parsers // Disable all the supported parsers –enable-bsf=NAME // Disable NAME bit filter –disable-bsf=NAME // Enable NAME bit filter –disable-bsfs disable // Disable all the supported bit filters –enable-protocol=NAME // Disable NAME protocol –disable-protocol=NAME // Enable NAME protocol –disable-protocols // Disable all the supported protocols –disable-indev=NAME // Disable NAME input device –disable-outdev=NAME // Disable NAME output device –disable-indevs // Disable all the supported input devices –disable-outdevs // Disable all the supported output devices –disable-devices // Disable all the supported input and output devices –disable-filter=NAME // Disable NAME filter –enable-filter=NAME // Enable NAME filter –disable-filters // Disable all the supported filter
Note: Run
./configure
in the source path to check the components supported by ffmpeg.During normal compilation, add the above-mentioned compilation configuration parameters in the end of
./configure
, and disable or enable related components according to the needs of the project to achieve the purpose of cropping ffmpeg.For example, if only supports video H264 and audio AAC decoding, MP4 file format, the following parameters can be used to crop:
./configure --prefix=host --shlibdir=host/dynamic --enable-cross-compile --arch=arm --target-os=linux --cross-prefix=arm-linux-gnueabihf- --disable-gpl --enable-nonfree --enable-error-resilience --disable-debug --enable-shared --enable-small --disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-programs --disable-symver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-avformat --enable-avcodec --disable-avresample --disable-avfilter --disable-avdevice --disable-postproc --disable-swscale --disable-swresample -disable-everything –enable-decoder=h264 –enable-decoder=aac –enable-muxer=m4v –enable-muxer=aac –enable-parser=h264 –enable-parser=aac –enable-protocol=file