安装依赖:
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev
Ubuntu 20.04还需要安装:
sudo apt install libunistring-dev libaom-dev libdav1d-dev
FFmpeg为提高编译效率,默认会使用汇编指令,如果没有安装nasm,会导致以下错误:
nasm/yasm not found or too old. Use –disable-x86asm for a crippled build.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file “ffbuild/config.log” produced by configure as this will help
solve the problem.
安装nasm:
sudo apt install nasm
或者也可以在编译时通过添加以下配置项禁用汇编指令编译:
--disable-x86asm
克隆FFmpeg:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
进入源码目录:
cd ffmpeg
配置:
./configure --prefix=/usr/local/ffmpeg --enable-openssl
常用配置项还有:
--enable-gpl \
--enable-gnutls \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libsvtav1 \
--enable-libdav1d \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
编译安装:
make && make install
添加环境变量:
vi /etc/profile
在末尾添加如下行:
export PATH=$PATH:/usr/local/ffmpeg/bin
载入环境变量:
source /etc/profile
更多信息请参考官方文档:Compile FFmpeg for Ubuntu, Debian, or Mint
原创文章,作者:,如若转载,请注明出处:https://ce.771633.xyz/2116.html