Introduction to FFmpeg
FFmpeg is a solution to record,
convert and stream audio and video. It is a very fast video and
audio converter and it can also acquire from a live audio/video
source. Designed to be intuitive, the command-line interface
(ffmpeg) tries to
figure out all the parameters, when possible. FFmpeg can also convert from any sample rate
to any other, and resize video on the fly with a high quality
polyphase filter. FFmpeg can use a
Video4Linux compatible video source and any Open Sound System audio
source.
Package Information
Additional Downloads
FFmpeg Dependencies
Required
Pkgconf Personalties (for lib32)
Recommended
libaom-3.9.1,
libass, fdk-aac-2.0.3, FreeType-2.13.3 - Pass 2, LAME-3.100,
libvorbis-1.3.7, libvpx-1.15.0, Opus-1.5.2, x264-20240812, x265-4.1, and NASM-2.16.03
Recommended for desktop use
alsa-lib-1.2.13, libva-2.22.0,
SDL2-2.30.11
Recommended for systems with Intel Video
libvdpau-1.5 and libvdpau-va-gl-0.4.2
Optional
Full list of optional dependencies are in the
BLFS FFmpeg page.
Installation of FFmpeg
First, apply a patch that adds an API necessary for some packages
to build:
patch -Np1 -i ../ffmpeg-7.1-chromium_method-1.patch
Now fix an issue caused by the latest version of x265-4.1:
sed -e 's/X265_BUILD >= 210/(&) \&\& (X265_BUILD < 213)/' \
-i libavcodec/libx265.c
Next, if you have installed texinfo-7.2, apply a patch to ensure
generation of documentation does not fail:
patch -Np1 -i ../ffmpeg-7.1-texinfo_fix-1.patch
Install FFmpeg by running the
following commands:
./configure --prefix=/usr \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--disable-static \
--enable-shared \
--disable-debug \
--enable-libaom \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-openssl \
--ignore-tests=enhanced-flv-av1 \
--docdir=/usr/share/doc/ffmpeg-7.1 &&
make &&
gcc tools/qt-faststart.c -o tools/qt-faststart
Now, as the root
user:
make install &&
install -v -m755 tools/qt-faststart /usr/bin &&
install -v -m755 -d /usr/share/doc/ffmpeg-7.1 &&
install -v -m644 doc/*.txt /usr/share/doc/ffmpeg-7.1
lib32 Installation of FFmpeg
First clean the directory:
make distclean
Install lib32-FFmpeg by running
the following commands:
./configure --prefix=/usr \
--libdir=/usr/lib32 \
--shlibdir=/usr/lib32 \
--cc="gcc -m32" \
--pkg-config=i686-pc-linux-gnu-pkg-config \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--disable-static \
--enable-shared \
--disable-debug \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-openssl \
--ignore-tests=enhanced-flv-av1 &&
make
Now, as the root
user:
make DESTDIR=$PWD/DESTDIR install &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR &&
ldconfig
Command Explanations
find ... ;: Fixes
permissions of documentation files and directories.
--enable-libfreetype
:
Enables Freetype support.
--enable-gpl
: Enables the
use of GPL code and permits support for postprocessing, swscale and
many other features.
--enable-version3
: Enables
the use of (L)GPL version 3 code.
--enable-nonfree
: Enables
the use of nonfree code. Note that the resulting libraries and
binaries will be unredistributable.
--disable-static
: This
switch prevents installation of static versions of the libraries.
--enable-shared
: Enables
building shared libraries, otherwise only static libraries are
built and installed.
--disable-debug
: Disables
building debugging symbols into the programs and libraries.
--enable-libaom
: Enables
AV1 audio and video decoding via libaom
.
--enable-libdrm
: Use this switch if
libdrm-2.4.124 is installed to build the
“kmsgrab”
input module which is useful for screen capturing or streaming.
--enable-libfdk-aac
:
Enables AAC audio encoding via libfdk-aac
.
--enable-libmp3lame
:
Enables MP3 audio encoding via libmp3lame
.
--enable-libvorbis
--enable-libvpx
: Enables
WebM encoding via libvorbis
and
libvpx
.
--enable-libx264
: Enables
high-quality H.264/MPEG-4 AVC encoding via libx264
.
--enable-libx265
: Enables
high-quality H.265/HEVC encoding via libx265
.
--enable-openssl
: Enables
HTTPS protocol for network streams.
--ignore-tests=...
:
Disables tests that fail to run on BLFS without the optional
packages. Currently the AV1 test is disabled as it needs dav1d to
do AV1 decoding on the CPU. The test might work if you have a GPU
that can decode AV1, but this was not tested.
--enable-gnutls
: Use this option
instead of --enable-openssl
, if you want to use
GnuTLS instead of OpenSSL for HTTPS protocol.
--disable-doc
: Disables building html
documentation. This is only needed if doxygen is installed and you
do not want to build the html documentation.
--enable-libpulse
: Enables support for
Pulseaudio for audio output.
gcc tools/qt-faststart.c -o
tools/qt-faststart: This builds the qt-faststart program which can
modify QuickTime formatted movies (.mov
or .mp4
) so
that the header information is located at the beginning of the file
instead of the end. This allows the movie file to begin playing
before the entire file has been downloaded.
Note
Support for most of the dependency packages requires using
options passed to the configure script. View the
output from ./configure
--help for complete information about enabling
dependency packages.