How to Compile FFmpeg with libopenmpt Support
Compiling FFmpeg with libopenmpt support enables you to
decode and process a wide variety of tracker music module formats,
including MOD, S3M, XM, and IT files. This guide provides a step-by-step
walkthrough for setting up build prerequisites, configuring the FFmpeg
source tree with the --enable-libopenmpt flag, compiling
the binaries, and verifying that the module decoder functions correctly
on a Linux-based system.
1. Install Build Dependencies
Before compiling, you need essential build tools, an assembler,
pkg-config, and the libopenmpt development
libraries.
On Debian, Ubuntu, or Pop!_OS, run:
sudo apt update
sudo apt install -y \
build-essential \
pkg-config \
yasm \
nasm \
git \
libopenmpt-devOn Fedora, CentOS, or RHEL (with EPEL enabled):
sudo dnf install -y \
gcc \
gcc-c++ \
make \
pkgconfig \
yasm \
nasm \
git \
libopenmpt-develOn Arch Linux:
sudo pacman -S --needed \
base-devel \
yasm \
nasm \
git \
libopenmpt2. Download FFmpeg Source Code
Clone the official FFmpeg Git repository to your local machine:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpegTo compile a stable release instead of the development master branch, check out the latest stable tag:
git checkout release/7.0(Replace release/7.0 with your desired release
branch.)
3. Configure FFmpeg
Run the configure script to prepare the build
environment and explicitly enable libopenmpt.
pkg-config will automatically detect the installed
libopenmpt headers and shared objects.
./configure \
--prefix=/usr/local \
--enable-libopenmpt \
--enable-nonfree \
--enable-gplIf you only need a minimal build for testing tracker playback, you
can omit extra flags, but --enable-libopenmpt is mandatory.
Ensure the configure script outputs no errors and finishes
successfully.
4. Build and Install
Compile FFmpeg using all available CPU cores:
make -j$(nproc)Once compilation completes, install the binaries to your system:
sudo make install
sudo ldconfig5. Verify libopenmpt Integration
To confirm that the custom build was successful and
libopenmpt is active, check the installed FFmpeg
version:
ffmpeg -versionLook for --enable-libopenmpt in the
configuration: output line.
Next, verify that FFmpeg can use the libopenmpt
decoder:
ffmpeg -decoders | grep openmptThe output should show:
A....D libopenmpt Tracker formats (libopenmpt) (decoders: libopenmpt )
You can now use FFmpeg to play or transcode tracker modules directly:
ffmpeg -i input.mod output.wav