1 下载所需要的软件
mkdir /usr/local/soft
cd /usr/local/soft
wget https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
freetype 下载地址 http://www.linuxfromscratch.org/blfs/view/svn/general/freetype2.html
fribidi 下载地址
http://www.linuxfromscratch.org/blfs/view/svn/general/fribidi.html
fontconfig 下载地址
http://www.linuxfromscratch.org/blfs/view/svn/general/fontconfig.html
harfbuzz 下载地址
https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.2.7.tar.bz2
2 软件安装
yasm 安装
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr/local/yasm
make
make install
配置环境变量
vim /etc/profile
export YASM=/usr/local/yasm
export PATH=
Y
A
S
M
/
b
i
n
:
{YASM}/bin:
YASM/bin:{PATH}
source /etc/profile
#查看版本 测试是否安装成功
yasm --version
nasm 安装
wget http://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar -jxvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02
./configure --prefix=/usr/local/nasm
make
make install
#配置环境变量
export NASM=/usr/local/nasm
export PATH=
N
A
S
M
/
b
i
n
:
{NASM}/bin:
NASM/bin:{PATH}
source /etc/profile
x264 安装
下载地址 https://code.videolan.org/videolan/x264
wget https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.gz
tar -zxvf x264-master.tar.gz
cd x264-master
./configure --prefix=/usr/local/x264 --enable-shared
make
配置环境变量
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig
export PATH=
P
K
G
C
O
N
F
I
G
P
A
T
H
/
b
i
n
:
{PKG_CONFIG_PATH}/bin:
PKGCONFIGPATH/bin:{PATH}
source /etc/profile
harfbuzz 安装
tar -jxvf harfbuzz-1.2.7.tar.bz2
cd harfbuzz-1.2.7
./configure --prefix=/usr/local/harfbuzz
make
make install
freetype 安装
tar -xvf freetype-2.10.4.tar.xz
cd freetype-2.10.4
./configure --prefix=/usr/local/freetype --disable-static
make
make install
fribidi 安装
tar -xvf fribidi-1.0.9.tar.xz
cd fribidi-1.0.9
./configure --prefix=/usr/local/fribidi
make
make install
fontconfig 安装
tar -jxvf fontconfig-2.13.1.tar.bz2
cd fontconfig-2.13.1
./configure --prefix=/usr/local/fontconfig
make
make install
libass 安装
https://www.linuxfromscratch.org/blfs/view/svn/multimedia/libass.html
tar -xvf libass-0.15.1.tar.xz
cd libass-0.15.1
./configure --prefix=/usr/local/libass --disable-static
make
make install
配置环境变量
vim /etc/profile
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig:/usr/local/freetype/lib/pkgconfig:/usr/local/harfbuzz/lib/pkgconfig:/usr/local/fribidi/lib/pkgconfig:/usr/local/libass/lib/pkgconfig
export PATH= P K G C O N F I G P A T H / b i n : {PKG_CONFIG_PATH}/bin: PKGCONFIGPATH/bin:{PATH}
#生效
source /etc/profile
ld.so.conf 配置
vim /etc/ld.so.conf
#添加一下内容
/usr/local/ffmpeg/lib
/usr/local/x264/lib
/usr/local/freetype/lib
/usr/local/firbidi/lib
/usr/local/harfbuzz/lib
/usr/local/libass/lib
#生效
ldconfig
3 ffmpeg 安装
tar -jxvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure --prefix=/usr/local/ffmpeg --enable-libx264 --enable-gpl --enable-libass --enable-fontconfig --enable-openssl --enable-nonfree
make
make install
#配置环境变量
export FFMPEG=/usr/local/ffmpeg
export PATH=
F
F
M
P
E
G
/
b
i
n
:
{FFMPEG}/bin:
FFMPEG/bin:{PATH}
source /etc/profile
ffmpeg --version
安装好 x264
vim /etc/ld.so.conf
在该文件夹中添加
/usr/local/ffmpeg/lib
/usr/local/x264/lib
#配置生效
ldconfig
字体文件添加
商用免费下载
下载地址:https://izihun.com/shangyongziti/r2/
linux 添加字体
以宋体为例,新建 songti 文件夹,将字体文件放入该文件夹中
cd /usr/share/fonts/songti
mkfontscale
mkfontdir
fc-cache-fv