Linux下交叉编译FFmpeg


Linux下交叉编译FFmpeg

首先编译x264 安装

下载

wget ftp://ftp.videolan.org/pub/x264/snapshots/last_stable_x264.tar.bz2

解压

tar jxvf x264-snapshot-20191216-2245.tar.bz2

编译安装

mkdir build
cd build
../configure --enable-static --enable-shared  --host=arm-linux-gnueabihf
make
make install

然后编译ffmpeg

下载

git clone https://github.com/FFmpeg/FFmpeg.git

安装

cd FFmpeg
mkdir build
cd build
../configure --cross-prefix=arm-linux-gnueabihf- --enable-cross-compile --target-os=linux --cc=arm-linux-gnueabihf-gcc --arch=arm --prefix=/usr/local/ffmpeg --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-ffmpeg  --enable-swscale --enable-pthreads --disable-armv5te --disable-armv6 --disable-armv6t2  --enable-libx264 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib  --extra-libs=-ldl  --enable-pic

make
make install

其中,--extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib 用来指定libx264的路径,需要--extra-libs=-ldl才能查找到libx264的路径,--enable-pic 如果静态地编译FFmpeg库,并且想要使用它们来构建自己的共享库,则可能需要强制PIC支持

拷贝include和lib下到相应的系统环境下或配置环境变量


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM