Compile FFmpeg with libbluray Support

This guide provides a straightforward, step-by-step walkthrough for compiling FFmpeg from source with libbluray support. By compiling FFmpeg with this library, you enable the tool to read, parse, and decode unprotected Blu-ray disc structures and streams directly from your command line.

Step 1: Install System Dependencies and Build Tools

Before compiling FFmpeg, you must install the necessary build tools and the development headers for libbluray.

On Ubuntu/Debian systems, run:

sudo apt update
sudo apt install build-essential yasm nasm pkg-config git libbluray-dev

On Fedora/CentOS/RHEL systems, run:

sudo dnf groupinstall "Development Tools"
sudo dnf install yasm nasm pkgconf-pkg-config libbluray-devel

On macOS (using Homebrew), run:

brew install xcode-select --install
brew install yasm nasm pkg-config libbluray

Step 2: Download the FFmpeg Source Code

Clone the official FFmpeg git repository to get the latest stable source code:

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg-source
cd ffmpeg-source

Step 3: Configure the FFmpeg Build

Configure the build environment to include the libbluray library. You must explicitly pass the --enable-libbluray flag to the configure script. It is also recommended to enable GPL support as some dependencies require it.

Run the following command inside the ffmpeg-source directory:

./configure --enable-gpl --enable-libbluray --enable-nonfree

If the configuration is successful, you will see a summary of enabled libraries, which should include libbluray. If it fails, ensure that pkg-config can locate libbluray.pc on your system.

Step 4: Compile and Install

Compile the binaries using all available CPU cores to speed up the process, then install them to your system:

make -j$(nproc)
sudo make install

(On macOS, use make -j$(sysctl -n hw.ncpu) instead of nproc).

Step 5: Verify the Installation

To verify that your newly compiled version of FFmpeg supports Blu-ray playback, check the configuration output of the binary:

ffmpeg -version

Look for --enable-libbluray in the configuration lines. You can also check if the bluray protocol is successfully registered by running:

ffmpeg -protocols | grep bluray