Skip to content

FFmpeg Build Script for macOS, focus on runtime performance by multiple optimizations

License

Notifications You must be signed in to change notification settings

MiKayule/ffbuild-macos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FFmpeg Build Script for macOS

This script was made to compile FFmpeg with common codecs on Linux and macOS by Martin Riedl @martinr92 , I made the FFmpeg compiled by this script a shared one, with PGO and LTO optimization (currently only for x265 and SVT-AV1), focus on using it directly by CLI and the best performance as possible.

Compatibility with Linux

This script is currently not compatible with Linux, because of the difference of sed's syntax, clang/gnu, and the behavior of CMake. I will try to work on it later after finishing my main development goals.

Looking for the pre-compiled result?

Check out the build server. Here you can download builds for Linux and macOS.

Result

This repository builds FFmpeg, FFprobe and FFplay using

To get a full list of all formats and codecs that are supported just execute

./ffmpeg -formats
./ffmpeg -codecs

Requirements

There are just a few dependencies to other tools. Most of the software is compiled or downloaded during script execution. Also most of the tools should be already available on the system by default.

Linux

  • gcc (c and c++ compiler)
  • curl
  • make
  • zip, bunzip2
  • rust / cargo / cargo-c
  • python3 (including pip virtualenv)

macOS

  • Xcode
  • rust / cargo / cargo-c
  • python3 (including pip virtualenv)

Windows (not supported)

For compilation on Windows please use MSYS2. Follow the whole instructions for installation (including step 7).

Execution

All files that are downloaded and generated through this script are placed in the current working directory. The recommendation is to use an empty folder for this and execute the build.sh.

mkdir ffmpeg-compile
cd ffmpeg-compile
../build.sh

You can use the following parameters

  • -FFMPEG_SNAPSHOT=YES for using the latest snapshot of FFmpeg instead of the last release
  • -SKIP_TEST=YES for skipping the tests after compiling
  • -SKIP_BUNDLE=YES for skipping creating the ffmpeg-success.zip file
  • -CPU_LIMIT=num for limit CPU thread usage (default: automatically detected)

If you don't need a codec/library, you can also disable them:

  • libraries
    • -SKIP_LIBKLVANC=YES
    • -SKIP_LIBBLURAY=YES
    • -SKIP_SNAPPY=YES
    • -SKIP_SRT=YES
    • -SKIP_LIBVMAF=YES
    • -SKIP_ZIMG=YES
    • -SKIP_ZVBI=YES
  • video codecs
    • -SKIP_AOM=YES
    • -SKIP_DAV1D=YES
    • -SKIP_OPEN_H264=YES
    • -SKIP_OPEN_JPEG=YES
    • -SKIP_RAV1E=YES
    • -SKIP_SVT_AV1=YES
    • -SKIP_LIBTHEORA=YES
    • -SKIP_VPX=YES
    • -SKIP_LIBWEBP=YES
    • -SKIP_X264=YES
    • -SKIP_X265=YES
    • -SKIP_X265_MULTIBIT=YES
  • audio codecs
    • -SKIP_LAME=YES
    • -SKIP_OPUS=YES
    • -SKIP_LIBVORBIS=YES

After the execution a new folder called out exists. It contains the compiled FFmpeg binary (in the bin sub-folder). The ffmpeg-success.zip contains also all binary files of FFmpeg, FFprobe and FFplay.

Decklink

It is required to prepare the Blackmagic Decklink SDK manually, because a automated download is not possible. Download the SDK manually from the Blackmagic Website and extract the compressed file. Then add the following parameters (for the SDK include location):

-DECKLINK_SDK=/path/to/SDK/os/include -SKIP_DECKLINK=NO

Validate Build

Dynamic Linking

You can check dynamically linked libraries using the follwing command:

# macOS
otool -L out/bin/ffmpeg

# linux
ldd out/bin/ffmpeg

Build failed?

Check the detailed logfiles in the log directory. Each build step has its own file starting with "build-*".

If the build of ffmpeg failes during the configuration phase (e.g. because it doesn't find one codec) check also the log file in source/ffmpeg/ffmpeg-*/ffbuild/config.log.

License

Copyright 2021 Martin Riedl Copyright 2024 Hayden Zheng

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

FFmpeg Build Script for macOS, focus on runtime performance by multiple optimizations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages