Compilation and installation of ffmpeg in Mac

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.

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
insert image description here
and then check the installation content in ffmpeg

cd /usr/local/Cellar/ffmpeg/5.0.1
cd include
cd lib

insert image description here

  1. 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
  1. 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

  1. Step 1: clone
    ffmpeg source address: https://github.com/FFmpeg/FFmpeg

    git clone git@github.com:FFmpeg/FFmpeg.git
    

    insert image description here
    If you want to see some of the tools provided by ffmpeg, you can use the following command

    ./configure --help
    ./configure --list-decoders
    
  2. Step 2: Generate configuration file
    Enter the following content in the terminal, optional input

    ffmpeg 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
    

    insert image description here
    If there is an error in this step, for example: nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
    insert image description here
    solution: brew install yasm, and then regenerate the configuration file

  3. Step 3: Compile and install

    make && make install
    

    insert image description here
    At this point, ffmpeg compilation and installation is complete.

Guess you like

Origin blog.csdn.net/weixin_42182599/article/details/125142176