嵌入式视频行业。
分类: LINUX
2013-06-13 09:38:44
本页的FFMPEG版本n0.9,x264版本(snapshot-20130606-2245)
1】本地跟踪调试(用于本地跟踪调试,开启了debug,关闭了编译器优化)
./configure --disable-asm --disable-optimizations --disable-yasm --enable-encoder=libx264 --enable-libx264 --enable-gpl --enable-static --enable-debug
2】本地裁剪编译
为FFmpeg安装x264编码器
1)首先安装x264,
./configure --enable-shared --enable-static
2)安装ffmpeg
./configure --disable-yasm --enable-libx264 --enable-gpl
裁剪FFMPEG
1)粗略裁剪配置
./configure --disable-everything --disable-muxers --disable-avdevice --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-armvfp --disable-zlib --disable-bzlib --disable-debug --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-filters --disable-devices --disable-encoders --disable-hwaccels --enable-static --enable-memalign-hack --enable-small --enable-demuxers --enable-parsers --enable-protocols --disable-yasm --enable-libx264 --enable-gpl --enable-muxer=mp4 --enable-encoder=aac --enable-encoder=libx264
2)AAC encoder + H264 Encoder --> MP4裁剪配置
./configure --disable-everything --disable-muxers --disable-avdevice --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-armvfp --disable-zlib --disable-bzlib --disable-debug --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-filters --disable-devices --disable-encoders --disable-hwaccels --enable-static --enable-small --disable-demuxers --enable-demuxer=mp4 --disable-parsers --enable-parser=aac --enable-parser=h264 --disable-yasm --enable-libx264 --enable-gpl --enable-muxer=mp4 --enable-encoder=aac --enable-encoder=libx264 --enable-protocol=file
3】交叉编译
x264
CC=arm-hisiv200-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/usr/local/arm-x264 --enable-shared --disable-asm --enable-static
FFMPEG
LDFLAGS=-L/usr/local/arm-x264/lib/ CFLAGS=-I/home/iskey/work/x264-arm-hisi/ ./configure --disable-everything --disable-muxers --disable-avdevice --disable-zlib --disable-bzlib --disable-debug --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-filters --disable-devices --disable-encoders --disable-hwaccels --enable-static --enable-small --disable-demuxers --enable-demuxer=mp4 --disable-parsers --enable-parser=aac --enable-parser=h264 --disable-yasm --enable-libx264 --enable-gpl --enable-muxer=mp4 --enable-encoder=aac --enable-encoder=libx264 --enable-protocol=file --target-os=linux --arch=arm --enable-cross-compile --cross-prefix=arm-hisiv200-linux-gnueabi- --cc=arm-hisiv200-linux-gnueabi-gcc
4】遇到的问题
1)利用前边生成的库文件,编写程序时,出现如下错误
libswscale.a(utils.o): in function sws_init_context:libswscale/utils.c:791: error: undefined reference to 'av_get_cpu_flags'
libswscale.a(swscale.o): in function swScale:libswscale/swscale.c:2588: error: undefined reference to 'av_get_cpu_flags'
原因及解决:由于链接顺序造成,把lavutil放在链接库最后,问题解决。