1. 安装ffmpeg
wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
tar -xjvf ffmpeg-3.4.1.tar.bz2
cd ffmpeg-3.1
./configure --enable-shared --enable-gpl --prefix=/usr/local/ffmpeg
make
make install
echo "/usr/local/ffmpeg/lib" >> /etc/ld.so.conf
ldconfig
2.安装yasm
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 --prefix=/usr/local
make
make install
说明:
--enable-gpl,如果不想使用delogo等滤镜,可以不加。
为方便使用,可以将/usr/local/ffmpeg/bin加入环境变量PATH中
3.配置环境变量
vim /etc/profile
在最后PATH添加环境变量:
export PATH=$PATH:/usr/local/ffmpeg/bin
source /ect/profile 设置生效
4.检测是否安装成功
ffmpeg -version
输出:
ffmpeg version 3.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
configuration: --enable-shared --enable-gpl --prefix=/usr/local/ffmpeg
libavutil 55. 27.100 / 55. 27.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 40.101 / 57. 40.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
如果要查看支持的滤镜,可以使用如下命令
ffmpeg -filters
5.去除logo
ffmpeg -i logo.mp4 -filter_complex "delogo=x=100:y=100:w=100:h=100:show=0" logo_copy.mp4
x,y为logo在视频中坐标
w,h为logo的宽和高
show的值为0和1
0:去除后不显示边框
1:去除后显示边框