1 编译dav1d
dav1d是一种新的AV1跨平台解码器,是开源的,专注于速度和正确性。
该存储库的规范存储库URL为https:https://code.videolan.org/videolan/dav1d
该项目由开放媒体/ AOM联盟部分资助。
具体编译步骤
1, Install Meson (0.47 or higher), Ninja, and, for x86* targets, nasm (2.14 or higher)
2, Run mkdir build && cd build
to create a build directory and enter it
3, Run meson ..
to configure meson, add --default-library=static
if static linking is desired
4, Run ninja
to compile
5, ninja install
具体代码可以参考下面:
$ git clone --depth=1 https://code.videolan.org/videolan/dav1d.git
$ cd dav1d
$ mkdir build && cd build
$ meson --prefix /usr/local/ffmpeg/dav1d --bindir="/usr/local/ffmpeg/bin" ..
$ ninja
# ninja install
2 编译FFmpeg
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
这些是编译所需的软件包,但是如果您愿意,可以在完成后将其删除:
$ sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev
clone FFmpeg的git仓库:
$ mkdir ffmpeg && cd ffmpeg
$ git clone https://github.com/FFmpeg/FFmpeg.git
$ cd FFmpeg
$ ./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-static --enable-libdav1d
$ make
# make install
3 可能遇到的问题:
1 ERROR: dav1d >= 0.5.0 not found using pkg-config
这个问题的出现其实是因为环境变量里设置的PKG_CONFIG_PATH
系统找不到dav1d的libs。
参考https://stackoverflow.com/questions/61384486/error-dav1d-0-2-1-not-found-using-pkg-config
首先 要执行ninja install
。
然后 到./dav1d/dav1d/build/meson-private
目录里找到dav1d.pc文件,内容如下:
prefix=/usr/local/ffmpeg/dav1d
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: libdav1d
Description: AV1 decoding library
Version: 0.8.0
Libs: -L${libdir} -ldav1d
Libs.private: -pthread -ldl
Cflags: -I${includedir}
然后 把上面文件中的libdir
添加到PKG_CONFIG_PATH
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/ffmpeg/dav1d/lib/x86_64-linux-gnu:$PKG_CONFIG_PATH
$ echo $PKG_CONFIG_PATH
然后 重新回到FFmpeg
目录里
./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-static --enable-libdav1d
应该就解决了。
2 ERROR: Meson version is 0.45.1 but project requires >= 0.49.0.
这个问题好解决
首先删除从仓库里安装的meson
$ sudo apt-get purge meson
然后通过pip安装
$ pip3 install --user meson
3 ERROR: Problem encountered: nasm 2.14 or later is required for AVX-512 asm.
这个问题的出现和上面那个问题类似,都是因为仓库里的版本太低了,但是这个需要到nasm
的官网下载最新源码编译安装
$ cd ~/Downloads
$ wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.xz
$ tar xvf nasm-2.15.05.tar.xz
$ cd nasm-2.15.05
$ ./configure
$ make
# make install