首先一般都是需要安装yasm的:
sudo wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
sudo tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
sudo ./configure
sudo make && make install
这是解决会出现如下报错:
yasm/nasm not found or too old. Use –disable-yasm 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 “config.log” produced by configure as this will help
solve the problem.
然后安装ffmpeg:
下载并解压:
sudo wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
sudo tar -zxvf ffmpeg-3.1.tar.gz
安装:
cd ffmpeg-3.1
sudo ./configure --prefix=/usr/local/ffmpeg
sudo make && make install
配置环境变量:
vi /etc/profile
在最后PATH添加环境变量:
export PATH=$PATH:/usr/local/ffmpeg/bin
保存退出
查看是否生效
source /ect/profile 设置生效
查看版本:
ffmpeg -version
分割线
这边有个详细的安装方法:
# Step1、安装jdk
yum install -y libgdk*
yum install -y libgtk*
# Step2、安装依赖包
yum install -y autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig
yum install -y zlib zlib-devel curl curl-devel alsa-lib alsa-lib-devel gettext gettext-devel expat expat-devel gnutls gnutls-devel bzip2 bzip2-devel
# Step3、编译安装NASM
cd /usr/local
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 --prefix=/usr
make
make install
rm -rf /usr/local/nasm-2.15.05/
# Step4、编译安装Yasm
cd /usr/local
wget https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr
make
make install
rm -rf /usr/local/yasm-1.3.0/
# Step5、编译安装x264
cd /usr/local
wget https://anduin.linuxfromscratch.org/BLFS/x264/x264-20210211.tar.xz
tar xvf x264-20210211.tar.xz
cd x264-20210211
./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-cli
make
make install
rm -rf /usr/local/x264-20210211/
# Step6、编译安装x265
cd /usr/local
wget https://anduin.linuxfromscratch.org/BLFS/x265/x265_3.4.tar.gz
tar xzvf x265_3.4.tar.gz
cd x265_3.4
mkdir bld && cd bld
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/ffmpeg ../source
make
make install
rm -vf /usr/local/ffmpeg/lib/libx265.a
rm -rf /usr/local/x265_3.4/
# Step7、编译安装fdk-aac
cd /usr/local
wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.2.tar.gz
tar xzvf fdk-aac-2.0.2.tar.gz
cd fdk-aac-2.0.2
./configure --prefix=/usr/local/ffmpeg --disable-static
make
make install
rm -rf /usr/local/fdk-aac-2.0.2/
# Step8、编译安装lame
cd /usr/local
wget https://downloads.sourceforge.net/lame/lame-3.100.tar.gz
tar xzvf lame-3.100.tar.gz
cd lame-3.100
./configure --prefix=/usr/local/ffmpeg --enable-mp3rtp --disable-static
make
make pkghtmldir=/usr/local/ffmpeg/share/doc/lame-3.100 install
rm -rf /usr/local/lame-3.100/
# Step9、编译安装opus
cd /usr/local
wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar xzvf opus-1.3.1.tar.gz
cd opus-1.3.1
./configure --prefix=/usr/local/ffmpeg --disable-static --docdir=/usr/share/doc/opus-1.3.1
make
make install
rm -rf /usr/local/opus-1.3.1/
# Step10、编译安装libvpx
cd /usr/local
wget https://github.com/webmproject/libvpx/archive/v1.10.0/libvpx-1.10.0.tar.gz
tar xzvf libvpx-1.10.0.tar.gz
cd libvpx-1.10.0
sed -i 's/cp -p/cp/' build/make/Makefile
mkdir libvpx-build && cd libvpx-build
../configure --prefix=/usr/local/ffmpeg --enable-shared --disable-static
make
make install
rm -rf /usr/local/libvpx-1.10.0/
# Step11、安装ffmpeg
cd /usr/local
wget https://ffmpeg.org/releases/ffmpeg-4.4.tar.xz
tar xvf ffmpeg-4.4.tar.xz
cd ffmpeg-4.4
export PATH="/usr/local/ffmpeg/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig"
./configure --prefix=/usr/local/ffmpeg --pkg-config-flags="--static" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --enable-gpl --enable-version3 --enable-nonfree --disable-static --enable-shared --disable-debug --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl
make
make install
hash -d ffmpeg
# Step12、配置环境变量
echo "/usr/local/ffmpeg/lib" >> /etc/ld.so.conf
ldconfig
echo 'export PATH=/usr/local/ffmpeg/bin:$PATH' >> /etc/profile
source /etc/profile
# Step13、测试
# 查看版本
ffmpeg -version
分割线
~~
免安装方法:
~~
官网下载:
http://www.ffmpeg.org/download.html#build-linux
根据自己的系统选择下载就行
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
xz -d ffmpeg-release-amd64-static.tar.xz
tar xvf ffmpeg-release-amd64-static.tar
cp ffmpeg-4.4-amd64-static/ffmpeg /usr/bin/
cp ffmpeg-4.4-amd64-static/ffprobe /usr/bin/
ffmpeg -version