This is based on the original project here. Those files were updated with newer packages, FFmpeg 6.1 and the AC4 decoding patches.
The FFmpeg build script provides an easy way to build a static FFmpeg on macOS and Linux with optional non-free and GPL codecs (--enable-gpl-and-non-free, see https://ffmpeg.org/legal.html) included.
Youtube: How-To build and install FFmpeg on macOS
This script will download different packages with different licenses from various sources, which may track your usage. These sources are out of control by the developers of this script. Also, this script can create a non-free and unredistributable binary. By downloading and using this script, you are fully aware of this.
Use this script at your own risk.
$ git clone https://git.home.oriley.net/apps/ffmpeg.git
$ cd ffmpeg-build-script
$ ./build-ffmpeg --build
x264
: H.264 Video Codec (MPEG-4 AVC)x265
: H.265 Video Codec (HEVC)libsvtav1
, SVT-AV1 Encoder and Decoderaom
: AV1 Video Codec (Experimental and very slow!)fdk_aac
: Fraunhofer FDK AAC Codecxvidcore
: MPEG-4 video coding standardVP8/VP9/webm
: VP8 / VP9 Video Codec for the WebM video file formatAC4
: AC4 Audio Codec (used by ATSC 3.0)mp3
: MPEG-1 or MPEG-2 Audio Layer IIIogg
: Free, open container formatvorbis
: Lossy audio compression formattheora
: Free lossy video compression formatopus
: Lossy audio coding formatsrt
: Secure Reliable Transportwebp
: Image format both lossless and lossyvaapi
: Video Acceleration API. These encoders/decoders will only be
available if a libva driver installation was found while building the binary. Follow these
instructions for installation. Supported codecs in vaapi:
h264_vaapi
hevc_vaapi
mjpeg_vaapi
mpeg2_vaapi
vp8_vaapi
vp9_vaapi
The script also builds FFmpeg on a new MacBook with an Apple Silicon M1 processor.
If Python is available, the script will build a ffmpeg binary with lv2 plugin support.
# Debian and Ubuntu
$ sudo apt install build-essential curl tcl
# Fedora
$ sudo dnf install @development-tools curl tcl
With Docker, FFmpeg can be built reliably without altering the host system.
If you're running an operating system other than the one above, a completely static build may work. To build a full statically linked binary inside Docker, just run the following command:
$ docker build --tag=ffmpeg:default --output type=local,dest=build -f Dockerfile .
You can also run the FFmpeg directly inside a Docker container.
A dockerized FFmpeg build can be executed with the following command:
$ sudo docker build --tag=ffmpeg .
$ sudo docker run ffmpeg -i https://files.coconut.co.s3.amazonaws.com/test.mp4 -f webm -c:v libvpx -c:a libvorbis - > test.mp4
If you want to enable Vaapi, please refer to these and install the driver.
$ ./build-ffmpeg --build
You will need the libva driver, so please install it below.
# Debian and Ubuntu
$ sudo apt install libva-dev vainfo
# Fedora and CentOS
$ sudo dnf install libva-devel libva-intel-driver libva-utils
Usage: build-ffmpeg [OPTIONS]
Options:
-h, --help Display usage information
--version Display version information
-b, --build Starts the build process
--enable-gpl-and-non-free Enable non-free codecs - https://ffmpeg.org/legal.html
-c, --cleanup Remove all working dirs
--full-static Complete static build of ffmpeg (eg. glibc, pthreads etc...) **only Linux**
Note: Because of the NSS (Name Service Switch), glibc does not recommend static links.
Because of the NSS (Name Service Switch), glibc does not recommend static links. See detail below: https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F
Vaapi cannot be statically linked.