一、首先是安装各种解码器
1、lame
wget https://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-shared
make
make install
2、libogg
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar -zxvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --enable-shared
make
make install
3、libvorbis
#libvorbis依赖于libogg, 所以libogg必须先于libvorbis安装
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
tar -zxvf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5
./configure --enable-shared
make
make install
4、xvidcore
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar -zxvf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure --enable-shared
make
make install
进行这步时,安装报错了
If you have an old version installed, it is best to remove it, although you may also be able to get things to work by modifying LD_LIBRARY_PATH configure: error: must have Ogg installed!
解决方法:
vi /etc/ld.so.conf
添加
/usr/local/lib
保存后执行
ldconfig
5、x264
因为没有找到好的资源,给一个ftp资源,下载最新版本之后上传到linux上
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/
tar -jxvf x264-snapshot-20190111-2245.tar.bz2
cd x264-snapshot-20190111-2245
./configure --enable-shared
make
make install
在 ./configure --enable-shared 时,报错了
Found no assembler
Minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm
好像是要安装nasm,最低版本要在2.13以上,使用yum install build-essential nasm,好像是安装成功了,但是继续执行
./configure --enable-shared,还是报相同的错误,一个小白,没办法了,按照linux提示,不使用asm,直接执行
./configure --enable-shared --disable-asm,有知道怎么回事的大神,求指点!!!
6、libdts
同样没找到资源,给出一个ftp,http://download.videolan.org/pub/videolan/libdca/0.0.5/
tar -jxvf libdca-0.0.5.tar.bz2
cd libdca-0.0.5
./configure --enable-shared
make
make install
7、faad2
wget https://jaist.dl.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
tar -zxvf faad2-2.7.tar.gz
cd faad2-2.7
./configure --enable-shared
make
make install
8、faac
wget https://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
tar -zxvf faac-1.28.tar.gz
cd faac-1.28
./configure --enable-shared
make
make install
9、amr-nb
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-10.0.0.0.tar.bz2
tar -jxvf amrnb-10.0.0.0.tar.bz2
cd amrnb-11.0.0.0
./configure --enable-shared
make
make install
10、amr-wb
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-11.0.0.0.tar.bz2
tar -jxvf amrwb-11.0.0.0.tar.bz2
cd amrwb-11.0.0.0
./configure --enable-shared
make
make install
二、安装yasm
yum -y install yasm
三、安装ffmpeg
wget http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2
tar -jxvf http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2
cd ffmpeg-3.2.4
#其中–enable-shared表示生成动态链接库,可以供以后编程使用,同时生成的可执行程序也依赖这些动态库。如果不加上–enable-shared选项则使用静态链接的方式编译,此时不会生成动态库,同时生成的ffmpeg等的可执行文件也比较大,但他们不需要动态库就可以直接运行
./configure --enable-shared
#编译,需要较长时间,10分钟左右。
make
#安装
make install
四、测试
执行 ffmpeg
出现
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
configuration:
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg',表示安装成功