文章摘要: 本文主要描述了ffmpeg的安装方法。
操作系统: Debian8
软件版本: ffmpeg-4.2.1.tar.bz2, lame-3.100.tar.gz, opencore-amr-0.1.2


基于apt-get安装方法:

http://ffmpeg.org网站有相关说明的apt-get源,加入源至/etc/apt/source.list文件中

deb http://www.deb-multimedia.org stable main non-free
# apt-get update
# apt-get install ffmpeg

基于源码安装:

# git clone https://git.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# ./configure
# make
# make install

添加mp3支持:

下载lame源码

# ./configure --prefix=/opt/rootfs
# make 
# make install

指定安装目录,一会编译ffmpeg进须指定位置.

重新配置ffmpeg

# ./configure --prefix=/opt/rootfs --extra-cflags='-I/opt/rootfs/include' --extra-libs='-L/opt/rootfs/lib' --enable-libmp3lame 
# make 
# make install

--extra-cflags 通过编译参数指定第三方头文件位置;
--extra-libs 指定第三方库文件位置。


添加amr支持:
首先编译arm库

# wget https://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
# cd amr-0.1.2
# ./configure --prefix=/opt/rootfs
# make
# make install

重新配置ffmpeg

#./configure --prefix=/opt/rootfs --extra-cflags='-I/opt/rootfs/include' --extra-libs='-L/opt/rootfs/lib' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb 

--enable-version3
--enable-libopencore-amrnb
--enable-libopencore-amrwb


嵌入式软件交叉编译

./configure --enable-cross-compile --cross-prefix=arm-linux-gnueabihf- --cc=arm-linux-gnueabihf-gcc --arch=arm --target-os=linux 

--enable-cross-compile 使能交叉编译;
--cross-prefix 指定编译器前缀;
--cc 指定c编译器
--arch 指定CPU架构
--target-os=linux 指定操作系统