ubuntu 下载并编译ffmpeg

1. 下载

ffmpeg地址:http://ffmpeg.org/

git :git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

 

2. 编译

./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --cc=clang --host-cflags= --host-ldflags=

3. apt clang编译器  

sudo apt install clang

4.下载x265

地址: http://ftp.videolan.org/pub/videolan/x265/

x265是cmake编译的,所以先安装cmake:sudo apt install cmake

进入目录./x265_1.9/build/linux/下,执行脚本: 
sh make-Makefiles.bash (注意,我当时下的是3.0版本,这个版本需要修改make-Makefiles.bash文件,将“ccmake”改成“cmake”)

此时在该目录下生成了makefile脚本,你只要执行以下make,库便在当前目录下生成了。执行make install安装x265

5.下载x264

1. wget http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/last_x264.tar.bz2
2. bunzip2 last_x264.tar.bz2
3. tar -vxf last_x264.tar
4. ./configure --enable-static --enable-shared --disable-asm --disable-avs
5. make && sudo make instal

6.下载fdk_aac

wget https://jaist.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.6.tar.gz
tar xvf fdk-aac-0.1.6.tar.gz
cd fdk-aac-0.1.6
./configure
make && sudo make install

7.下载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
make && sudo make install

8.报错:

loading shared libraries: libx265.so.130: cannot open shared object file: No such file or directory

原因是lib目录未加载到链接到系统库中,系统ld目录列表在/etc/ld.so.conf中,打开文件会发现,里面引用了/etc/ld.so.conf.d/下面所有的.conf文件

vim /etc/ld.so.conf.d/ffmpeg.conf
/usr/local/lib/          #添加一行,因为x265的lib库是在/usr/local/lib目录

9.下载 speex

地址: https://www.speex.org/downloads/

然后解压,进入目录

./configure

sudo make && sudo make install

你可能感兴趣的:(android)