FFMPEG+XVID+X264 cross-compilation process

Source: Internet
Author: User

Turn from: http://zyg0227.blog.51cto.com/1043164/313085/


1.xvid Compilation:
Download XviD pressure and enter build->generic
Input./configure--host=arm-linux--prefix=/usr/local/arm/3.4.1/arm-linux/(important, otherwise the xvid,x264 library cannot be found when compiling ffmpeg)
Make
Enter example folder after success
Input
Arm-linux-gcc-o Xvid_encraw xvid_encraw.c-lc-lm-i. /src/-L. /build/generic/=build-lxvidcore
You can generate Xvid_encraw
2.x264
The latest version (which I started with is 20090715) has cross-compile support, and the transplant should still be smooth. But this version of win under the compilation does not pass, the problem was found on the internet, did not solve. Then the second, the choice of a 20060805 version, this version found in the online win under the VC6 can be compiled through the version, but also in x264 official FTP to find Linux can be compiled version. Finally decided to use this version. This can facilitate some of the interactive debugging under win.

Note, here to remind, within a few years, the change of x264 is still very big. All in all, it seems that a similar version is necessary when you need two platforms to cross-debug. Otherwise, this can happen: program in win under the easy to use, in Linux is not used, and then you use VS, while using GDB, and finally found a different place, found that a standard API x264 to the same parameters of the assignment is completely not the same ... (for example, I found out that the two versions of the X264_param_init () function I used were different to the Param.i_bframe assignment, which led to a program that was good under win and Linux was bad)

New version of the transplant I'm not saying, I'm probably talking about the old version of the transplant.

The old is not--disable-asm and--cross-compile of these two configure support (the former is the compilation of x86 optimization, cross compilation of course not, the latter is the cross-compilation environment settings). In fact, as I did before the transplant process, here to write a step:

0. Environmental


Os:ubuntu 9.04
version:x264-snapshot-20060805-2245.tar.bz2

1. Configure


./configure--prefix=/usr/local/arm/3.4.1/arm-linux/--enable-shared--enable-debug

I've turned on dynamic links and debug here. The former can generate libx264.so, which can be used when you tune the program with GDB in the step into the library function.
2. Modify Configuration parameters

Modify Config.mak:
prefix=/usr/local/arm/3.4.1/arm-linux/
Exec_prefix=${prefix}
Bindir=${exec_prefix}/bin
Libdir=${exec_prefix}/lib
Includedir=${prefix}/include
# here instead of arm
Arch=arm
Sys=linux
# here instead ARM-LINUX-GCC
cc=arm-linux-gcc
# get rid of-dhave_mmxext-dhave_sse2-darch_x86 here
Cflags=-wall-i.-o4-ffast-math-d__x264__-dhave_malloc_h-dsys_linux-dhave_pthread-s-fomit-frame-pointer
ldflags=-lm-lpthread-s
As=nasm
Asflags=-o2-f elf
Vfw=no
Gtk=no
Exe=
Vis=no
Have_getopt_long=1
Devnull=/dev/null
configure_args= '--enable-shared '--prefix=/usr/local/arm/3.4.1/arm-linux/'
soname=libx264.so.49
Default: $ (soname)

Modify Makefile, the 66~68 line of AR and ranlib to arm under:

LIBX264.A:. Depend $ (OBJS) $ (objasm)
Arm-linux-ar RC libx264.a $ (OBJS) $ (objasm)
Arm-linux-ranlib libx264.a

3. Compile and install

Make
Make install
3. Cross-compile FFmpeg
./configure--prefix=/usr/local/arm/3.4.1/arm-linux--CC=ARM-LINUX-GCC--cpu=arm--enable-shared--enable-x264- Enable-xvid--ENABLE-GPL--enable-pthreads
(Note that red fonts are not libx264 and Libxvid)
Problem 1:snow.c:in function ' Predict_slice ':
Snow.c:2892:warning:passing Arg 5 of ' add_yblock ' discards qualifiers from pointer target type
snow.c:in function ' Common_init ':
Snow.c:3244:warning:assignment from incompatible pointer type
Snow.c:3244:warning:assignment from incompatible pointer type
Snow.c:3245:warning:assignment from incompatible pointer type
Snow.c:3245:warning:assignment from incompatible pointer type
Snow.c:3246:warning:assignment from incompatible pointer type
Snow.c:3246:warning:assignment from incompatible pointer type
Snow.c:3247:warning:assignment from incompatible pointer type
Snow.c:3247:warning:assignment from incompatible pointer type
MAKE[1]: * * * * [SNOW.O] Interrupted
Make: * * * [lib] _
A: This is my manual interrupt compilation, or panic, this is a small bug, correct method, compiled separately:
[Root@localhost libavcodec]# arm-linux-gcc-o3-g-wall-wno-switch-dhave_av_config_h-i. -I '/home/ffmpeg/ffmpeg-0.4.9-p20051120 '/libavutil-d_file_offset_bits=64-d_largefile_source-d_gnu_source-c-O SNOW.O SNOW.C This is the original compilation option, will-o3 to-o can be changed;
Problem 2:x264.c:in function ' x264_init ':
X264.c:140:error:structure has no member named ' B_CBR '
A: Comment out 140 lines can be;
Question 3:
Strip:unable to recognise the format of the input file
Answer: Open will config.mk
As follows:
Strip=strip Change to Arm-linux-strip can
Explained as follows:
Sometimes U got error while doing ' make install ':
Strip:unable to recognise the format of the input file

This is because the flag "Installstrip = S" in file Config.mak
Would pass to ' install ' application while you are doing "make install" ...
Disable the flag "Installstrip =" and make install.;0)

Or Edit Flag "INSTALL = $your _arm_install_application"
ps;===============================================
Typically occurs at the time of a cross compilation.
Because the install program at the time of installation detects the flag Installstrip =-s----You need to perform the strip to remove some useless symbols. And at this time the strip is only the host, so can not strip the target machine files.
Question 4:

Need to change the strip
Remove the installstrip=-s,-s from the Config.mak

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.