This guide details how to install the latest avifenc
(from libavif
) on Debian 12 by building from source, resolving the libyuv
dependency by building it locally.
deactivate
if in a (venv)
).Install Build Dependencies
Install the necessary tools and libraries for compiling libavif
and its dependencies.
sudo apt update
sudo apt install -y build-essential cmake ninja-build libpng-dev libjpeg-dev yasm pandoc git libaom-dev
Clone the libavif Repository
Download the latest libavif
source code from GitHub.
git clone https://github.com/AOMediaCodec/libavif.git
cd libavif
Create a Build Directory
Create a directory for building libavif
and navigate into it.
mkdir build
cd build
Configure the Build with CMake
Configure the build to include avifenc
, use the system libaom
, and build libyuv
locally.
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DAVIF_CODEC_AOM=SYSTEM \
-DAVIF_BUILD_APPS=ON \
-DAVIF_BUILD_MAN_PAGES=ON \
-DAVIF_LIBYUV=LOCAL \
-G Ninja ..
-DAVIF_LIBYUV=LOCAL
: Fetches and builds libyuv
locally to resolve the missing dependency.-DAVIF_BUILD_APPS=ON
: Ensures avifenc
and avifdec
binaries are built.-G Ninja
: Uses the Ninja build system for faster compilation.Build and Install
Compile the source code and install the binaries.
ninja
sudo ninja install
Verify Installation
Check the installed version of avifenc
to confirm success.
avifenc --version
Expected output: avifenc 1.3.0
(or the latest version from the repository, e.g., 1.3.0 as of May 2025), with libyuv: available
.
Clean Up (Optional)
Remove the source code and build files to free up space.
cd ../..
rm -rf libavif
libavif-bin
(e.g., version 0.11.1-1) from Debian repositories or backports, the source-built avifenc
will overwrite it in /usr/bin
. To avoid conflicts, remove the Debian package first:sudo apt remove libavif-bin
avifenc --version
shows an older version (e.g., 0.11.1), verify the binary path:which avifenc
/usr/bin/avifenc
. If not, ensure the installation completed correctly.cd libavif
rm -rf build
mkdir build
cd build
cmake
and ninja
steps.libaom-dev
is used for AV1 encoding. Other codecs like rav1e
or svt-av1
can be enabled with additional flags if needed (e.g., -DAVIF_CODEC_RAV1E=SYSTEM
).After following these steps, you’ll have the latest avifenc
installed (e.g., version 1.3.0 or newer), with libyuv
support enabled, ready for encoding AVIF images.
还没有人评论,抢个沙发吧...