1.安装yasm
cd yasm-1.3.0
./configure
make
sudo make install
2.安装ffmpeg
cd ffmpeg-3.4.2
./configure --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang -- host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma
sudo make
sudo make install
3.添加动态链接库:
文件/etc/ld.so.conf
增加 include /usr/local/lib ##自己的安装目录而定,/usr/local/lib是默认安装位置
#执行
sudo ldconfig
4.添加ffmpeg到环境变量
文件/etc/profile
#加入以下内容:
export PATH="/usr/local/bin:$PATH"
#让环境变量生效
sudo source /etc/profile
5.验证安装是否成功:
#执行
ffmpeg -version
#输出:
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
configuration: --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100