How to Compile FFmpeg with libdvdread and libdvdnav
This guide walks you through compiling FFmpeg with support for
libdvdread and libdvdnav to enable native DVD
navigation and extraction capabilities. Because the official FFmpeg
mainline does not natively integrate these libraries, building FFmpeg
with DVD reading functionality requires installing the development
headers, applying the community DVD demuxer patch to the FFmpeg source
tree, configuring the build with the required flags, and compiling the
final binary.
Step 1: Install Dependencies
You must install the necessary compiler tools,
pkg-config, and the development headers for both
libdvdread and libdvdnav.
On Debian, Ubuntu, or Linux Mint:
sudo apt update
sudo apt install -y build-essential git nasm yasm pkg-config \
libdvdread-dev libdvdnav-devOn Fedora, RHEL, or CentOS:
sudo dnf install -y gcc gcc-c++ git make nasm yasm pkgconf-pkg-config \
libdvdread-devel libdvdnav-develOn Arch Linux:
sudo pacman -S --needed base-devel git nasm yasm pkgconf \
libdvdread libdvdnavStep 2: Clone the FFmpeg Source Code
Clone the official FFmpeg source code repository into a local directory:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg-source
cd ffmpeg-sourceTo ensure compatibility with available DVD demuxer patches, check out a stable release branch (for example, FFmpeg 6.1 or 7.0):
git checkout release/6.1Step 3: Apply the libdvdnav / libdvdread Patch
Mainline FFmpeg lacks built-in demuxers for libdvdread
and libdvdnav. To compile with these options, apply the
external DVD demuxer patch:
- Download the
ffmpeg-dvdnavpatch compatible with your checked-out branch:
curl -O https://raw.githubusercontent.com/sunshinj/ffmpeg-dvdnav/master/dvdnav.patch- Apply the patch to the source code:
git apply dvdnav.patchNote: If git apply outputs errors due to minor
codebase changes in newer revisions, use
patch -p1 < dvdnav.patch to allow fuzzy line
matching.
Step 4: Configure FFmpeg
Run the ./configure script. You must pass
--enable-gpl because libdvdread and
libdvdnav are licensed under the GNU General Public
License.
./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-libdvdread \
--enable-libdvdnav \
--enable-nonfreeInspect the output at the end of the configure process to verify that
both libdvdread and libdvdnav are listed under
enabled external libraries.
Step 5: Compile and Install
Compile FFmpeg using all available CPU cores:
make -j$(nproc)Once compilation completes without errors, install the binaries to your system:
sudo make installUpdate your shared library cache:
sudo ldconfigStep 6: Verify the Installation
Confirm that the newly compiled FFmpeg binary recognizes the DVD protocol and demuxer:
ffmpeg -demuxers | grep -E "dvd|dvdnav"You can now use FFmpeg to read directly from a DVD drive, ISO, or directory structure using the DVD protocol:
ffmpeg -i dvdnav:///dev/sr0 -c:v libx264 -crf 20 -c:a aac output.mp4