Skip to main content
This guide walks you through building FFmpeg from source code. Building from source gives you complete control over enabled features and optimizations.

Quick Start

The basic build process follows these steps:
1

Configure the build

Run the configure script to set up the build configuration:
./configure
To see all available options:
./configure --help
2

Compile FFmpeg

Build FFmpeg using GNU Make (version 3.81 or later required):
make
3

Install binaries

Install all built binaries and libraries:
make install

Prerequisites

Required Tools

  • GNU Make 3.81 or later
  • C compiler supporting ISO C11 (public headers must stay C99 compatible)
  • Assembler for platform-specific optimizations:
    • NASM on x86
    • GAS on ARM and RISC-V

Build Dependencies

Non-system dependencies (e.g. libx264, libvpx) are disabled by default.
You must explicitly enable external libraries during configuration:
./configure --enable-libx264 --enable-libvpx

Configuration Options

Out-of-Tree Builds

You can build FFmpeg outside the source directory:
# From a different directory
/path/to/ffmpeg/configure
make
Use an absolute path when launching configure from outside the source tree.

Source Plugins

If you want to include source plugins, merge them before running configure:
tools/merge-all-source-plugins
./configure

Platform-Specific Notes

Language Requirements

Main Language:
  • FFmpeg is primarily programmed in ISO C11
  • Public headers must maintain C99 compatibility
  • Compiler-specific extensions may be used but code must still compile without them
Prohibited C99 Features:
Do not use these C99 features anywhere in the codebase:
  • Variable-length arrays
  • Complex numbers
Other Languages: May be used in special cases:
  • Compiler intrinsics or inline assembly - When code cannot be written in standard C and needs to be inlined
  • Objective-C - Required for macOS-specific interfaces

SIMD and DSP Optimization

FFmpeg uses handwritten assembly for performance-critical code since compilers cannot generate efficient SIMD/DSP code from plain C. Standard Approach:
  1. Write a plain C version that works everywhere
  2. Write architecture-specific optimized versions
  3. Initialization code selects the best version at runtime
  4. Function is called through a function pointer
Assembly Syntax:
  • x86: NASM
  • ARM: GAS
  • RISC-V: GAS
Testing Assembly: All new assembly must include checkasm tests:
# Tests are located in
tests/checkasm/

For Package Maintainers

Recommended Build Strategy for Distributions
To avoid circular dependencies, build FFmpeg twice:
1

First Build - Minimal Dependencies

Build with minimal external dependencies:
./configure --disable-everything --enable-avutil --enable-avcodec
make
make install
This allows 3rd party packages to build against FFmpeg’s core libraries.
2

Build 3rd Party Packages

Build packages that depend on libavutil/libavfilter/libavcodec/libavformat.
3

Second Build - Full Dependencies

Rebuild FFmpeg with all dependencies enabled:
./configure --enable-libx264 --enable-libvpx --enable-gpl
make
make install
This approach prevents circular dependencies during the build process.

Common Configuration Examples

Minimal Build

./configure --disable-everything --enable-decoder=h264
make
./configure \
  --enable-gpl \
  --enable-version3 \
  --enable-nonfree \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libvpx \
  --enable-libopus
make

Development Build with Debugging

./configure \
  --enable-debug=3 \
  --disable-optimizations \
  --disable-stripping
make

Troubleshooting

Configuration Issues

If configure fails, check:
  • Required dependencies are installed
  • Compiler version is compatible
  • External library development packages are available

Build Failures

For build errors:
  1. Ensure GNU Make 3.81 or later is installed
  2. Check that all required headers are available
  3. Verify disk space is sufficient

Runtime Issues

If the built binary doesn’t work:
  1. Check that all enabled libraries are properly linked
  2. Verify library paths are correctly set (LD_LIBRARY_PATH on Linux)
  3. Test with a minimal configuration first

Next Steps

Contributing

Learn how to contribute your changes back to FFmpeg

Code Style

Follow FFmpeg’s coding standards and style guidelines

Testing

Run FATE tests to verify your build

Build docs developers (and LLMs) love