When people live in this world, they can't tell the difference between happiness and pain, so I just want it to be genuine.
Friends, Dragon Boat Festival, I am learning about audio and video knowledge recently, so I organize what I have learned and use it as my own notes. Whenever I forget, I will take a look. Please pay attention to the follow-up audio and video related Blog.
Table of contents
1. What's ffmpeg?
ffmpeg is developed in C language and is a 音视频编解码
multimedia open source library for use. It provides developers with rich calling interfaces for audio and video processing. ffmpeg official website
2. The usefulness of ffmpeg
- Can run on Linux, Mac, Windows
- It is an excellent multimedia library that can be used for the conversion of multimedia formats
- Capable of decoding, encoding, transcoding, multiplexing, demultiplexing, and filtering audio and video data
3. ffmpeg installation and compilation
3.1 One-click installation on Mac
If you are using a Mac computer, you can enter the following command to install ffmpeg
brew install ffmpeg
After the installation is complete, enter ffmpeg in the terminal, there will be the following content, the installation path of ffmpeg is /usr/local/Cellar/ffmpeg/5.0.1
and then check the installation content in ffmpeg
cd /usr/local/Cellar/ffmpeg/5.0.1
cd include
cd lib
- The header files are stored in the include directory.
- libavformat: Parsing and encapsulation of multimedia formats,
- libavutil: commonly used tools
- libavcodec: codec
- libavdevice: audio and video capture, desktop capture
- libavfilter: filter
- libswresample: audio sampling
- Stored in the lib directory is a dynamic library
with an extension of .dylib, a dynamic library generated for the Mac platform
3.2 Compile and install through the clone ffmpeg library
-
Step 1: clone
ffmpeg source address: https://github.com/FFmpeg/FFmpeggit clone git@github.com:FFmpeg/FFmpeg.git
If you want to see some of the tools provided by ffmpeg, you can use the following command./configure --help ./configure --list-decoders
-
Step 2: Generate configuration file
Enter the following content in the terminal, optional inputffmpeg git:(master) ./configure --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-nonfree --enable-libfdk-aac --enable-ffplay --enable-gpl --enable-libaom --enable-libwebp --enable-libx264 --enable-libx265 --disable-indev=jack --enable-videotoolbox --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-hardcoded-tables
If there is an error in this step, for example:nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
solution: brew install yasm, and then regenerate the configuration file -
Step 3: Compile and install
make && make install
At this point, ffmpeg compilation and installation is complete.