HI3516A ffmpeg x264 Cross Compilation

Source: Internet
Author: User

Environment: Centos_6.5_x86

Cross tool chain: arm-hisiv300-linux-

Steps:

1. Download x264:

# git clone git://git.videolan.org/x264.git

2. Download FFmpeg

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

3. Cross-compiling

1) [Root@demo x264]#./configure--enable-pthread--enable-static--disable-shared--host=arm-linux--disable-asm

2) Modify Config.mak

Srcpath=.
Prefix=/usr/local
Exec_prefix=${prefix}
Bindir=${exec_prefix}/bin
Libdir=${exec_prefix}/lib
Includedir=${prefix}/include
Sys_arch=arm
Sys=linux
cc=arm-hisiv300-linux-gcc
Cflags=-wshadow-o3-ffast-math-wall-i.-i$ (Srcpath)-std=gnu99-fomit-frame-pointer-fno-tree-vectorize
Compiler=gnu
Compiler_style=gnu
Depmm=-mm-g0
Depmt=-mt
Ld=arm-hisiv300-linux-gcc-o
Ldflags=-l/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/lib-lm-l/opt/hisi-linux/x86-arm/arm-hisiv300-linux /target/lib-lpthread-l/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/lib-ldl
libx264=libx264.a
Ar=arm-hisiv300-linux-ar RC
Ranlib=arm-hisiv300-linux-ranlib
Strip=arm-hisiv300-linux-strip

3) [Root@demo x264] #make

[Root@demo x264] #make Install

Installation path

Install-d/usr/local/bin
Install X264/usr/local/bin
Install-d/usr/local/include
Install-d/usr/local/lib
Install-d/usr/local/lib/pkgconfig
Install-m 644./x264.h/usr/local/include
Install-m 644 X264_config.h/usr/local/include
Install-m 644 X264.pc/usr/local/lib/pkgconfig
Install-m 644 Libx264.a/usr/local/lib
arm-hisiv300-linux-ranlib/usr/local/lib/libx264.a

4.ffmpeg Cross-compilation

[Root@demoffmpeg]#./configure--enable-cross-compile--arch=arm--target-os=linux--enable-static--disable-shared- -disable-yasm--enable-memalign-hack--ENABLE-GPL--CC=ARM-HISIV300-LINUX-GCC--enable-libx264--extra-cflags=-I/ Usr/local/include--extra-ldflags=-l/usr/local/lib--PREFIX=/USR/LOCAL--EXTRA-LIBS=-LDL

Modify Config.mak

# automatically generated by configure-do not modify!
Ifndef Ffmpeg_config_mak
Ffmpeg_config_mak=1
Ffmpeg_configuration=--enable-cross-compile--arch=arm--target-os=linux--enable-static--disable-shared-- Disable-yasm--enable-memalign-hack--ENABLE-GPL--CC=ARM-HISIV300-LINUX-GCC--enable-libx264--extra-cflags=-I/usr /local/include--extra-ldflags=-l/usr/local/lib--prefix=/usr/local--EXTRA-LIBS=-LDL
Prefix=/usr/local
libdir=$ (DESTDIR) ${prefix}/lib
shlibdir=$ (DESTDIR) ${prefix}/lib
incdir=$ (DESTDIR) ${prefix}/include
bindir=$ (DESTDIR) ${prefix}/bin
datadir=$ (DESTDIR) ${prefix}/share/ffmpeg
docdir=$ (DESTDIR) ${prefix}/share/doc/ffmpeg
mandir=$ (DESTDIR) ${prefix}/share/man
pkgconfigdir=$ (DESTDIR) ${prefix}/lib/pkgconfig
Src_path=.
Ifndef Main_makefile
src_path:=$ (src_path:.%=..%)
endif
CC_IDENT=GCC 4.8.3 (hisilicon_v300) 20131202 (Prerelease)
Arch=arm
Intrinsics=none
cc=arm-hisiv300-linux-gcc
cxx=arm-hisiv300-linux-g++
as=arm-hisiv300-linux-gcc
ld=arm-hisiv300-linux-gcc
depcc=arm-hisiv300-linux-gcc
Depccflags= $ (cppflags)
depas=arm-hisiv300-linux-gcc
Depasflags= $ (cppflags)
Yasm=yasm
Depyasm=yasm
Ar=arm-hisiv300-linux-ar

[Root@demo FFmpeg] #make
Summary of issues:

1) ffmpeg undefined reference to symbol ' Dlclose '

Configure option, add--EXTRA-LIBS=-LDL to it.

2) Report an error:

X264.c:50:34:error:libavformat/avformat.h:no such file or directory
X264.c:51:30:error:libavutil/pixfmt.h:no such file or directory

Modify the tenth line of the Config.mak file and add-i//home/ffmpeg/ffmpeg/ffmpeg to find it.

3) After running the Make command, the compilation passes, but there is an error linking. When compiling the LIBX264.A library, the command shown is:

Arm-linux-arlibx264.a ....

The make file has no spaces between the link command and the library name, causing the system to not recognize this command

Manually execute the following command:

Arm-hisiv300-linux-ar RC libx264.a common/mc.o common/predict.o COMMON/PIXEL.O common/macroblock.o COMMON/FRAME.O COMMON/DCT.O common/cpu.o common/cabac.o common/common.o common/osdep.o common/rectangle.o common/set.o common/ QUANT.O common/deblock.o common/vlc.o common/mvpred.o common/bitstream.o encoder/analyse.o encoder/me.o encoder/ RATECONTROL.O encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/ LOOKAHEAD.O COMMON/THREADPOOL.O

4) Arm-linux-ranlib libx264.a (for generating x264-config.h files)


Reference related reference: http://blog.csdn.net/laotie1015/article/details/8295531


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.