6.0版本
安装路径为:/usr/local/ffmpeg
安装包路径为:mkdir ~/ffmpeg_sources
以下为centos安装方式
安装依赖
yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel -y
升级yasm
1.3.0为当前最新版
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install
libx264
H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples.H.264 视频编码器。有关详细信息和使用示例,请参阅 H.264 编码指南。
Requires ffmpeg to be configured with --enable-gpl --enable-libx264.需要使用 ffmpeg 进行 --enable-gpl --enable-libx264 配置 。
cd ~/ffmpeg_sources
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig"
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/ffmpeg/bin" --enable-static --disable-asm
make -j
make install
ffmpeg
cd ~/ffmpeg_sources
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
export PATH=$PATH:/usr/local/ffmpeg/bin PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig"
./configure \
--enable-shared \
--prefix="/usr/local/ffmpeg" \
--pkg-config-flags="--static" \
--extra-cflags="-I/usr/local/ffmpeg/include" \
--extra-ldflags="-L/usr/local/ffmpeg/lib" \
--extra-libs=-lpthread \
--extra-libs=-lm \
--bindir="/usr/local/ffmpeg/bin" \
--enable-libx264 \
--enable-gpl \
--enable-nonfree
make -j
make install
hash -d ffmpeg
也可以以http方式下载 ffmpeg下载源
如果需要ffmpeg支持更多编码器可参考centos编译安装ffmpeg ,以下报错表示不支持此编码器需要重新编译编码器和ffmpeg:
Unknown encoder ‘h264‘ 表示不支持libx264
修改环境变量
vim /etc/profile
export PATH=$PATH:/usr/local/ffmpeg/bin
source /etc/profile
4.1版本
升级yasm
参考6.0版本安装,依赖配置也相同。
下载源码
编译安装
./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-static --disable-doc
make -j
make install
修改环境变量
vim /etc/ld.so.conf
#新增
/usr/local/ffmpeg/lib/
#保存
ldconfig