FFmpeg for iOS cross-compilation (i686 armv7 armv7s) with lame support

Source: Internet
Author: User

Http://www.cppblog.com/Khan/archive/2012/12/13/196216.html

Because the project also requires MP3 audio encoding, you must first download the lame source code to build a cross environment, and enter the following compilation script build. Sh 1 # Under the lame directory #! /Bin/sh
2
3
4 sdk_version = "6.0"
5
6 Rm-RF build
7 mkdir build
8
9 function build_lame ()
10 {
11 make distclean
12
13./configure \
14 cflags = "-isysroot/applications/xcode. APP/contents/developer/platforms/$ {SDK }. platform/developer/sdks/$ {SDK }$ {sdk_version }. SDK "\
15 cc = "/applications/xcode. APP/contents/developer/platforms/$ {SDK}. Platform/developer/usr/bin/GCC-arch $ {platform }"\
16 -- prefix =/users/Khan/downloads/lame-3.99.5 \
17 -- Host = "arm-apple-darwin9 "\
18 -- disable-shared \
19 -- enable-static \
20 -- disable-decoder \
21 -- disable-frontend
22
23 make
24 CP "libmp 3lame/. libs/libmp 3lame. A" "build/libmp 3lame-$ {platform}."
25}
26
27 platform = "i686"
28 SDK = "iphonesimulator"
29 build_lame
30
31 # armv6 and armv7 are difficult to coexist
32 # platform = "armv6"
33 # SDK = "iphoneos"
34 # build_lame
35
36 platform = "armv7"
37 SDK = "iphoneos"
38 build_lame
39
40 platform = "armv7s"
41 SDK = "iphoneos"
42 build_lame
43
44 lipo-create build/*-output build/libmp 3lame. A first go to https://github.com/yuvi/gas-preprocessor/download gas-preprocessor.pl, and then copy it to the/usr/sbin/directory (of course, you can put it in any directory, just make sure the -- As = '/$ {path}/gas-preprocessor.pl' path is correct)

Http://ffmpeg.org/download.html download FFMPEG source code, git or direct download

The terminal executes the following command # armv7s. /configure -- disable-doc -- disable-FFMPEG -- disable-ffplay -- disable-ffserver -- enable-pic -- enable-Cross-compile -- enable-decoder = h264 -- enable-libmp3lame \ -- arch = arm -- disable-ASM \ -- target-OS = Darwin -- cc =/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/usr/bin/GCC \ -- As = 'Gas-Preprocessor. PL/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/usr/bin/GCC '\ -- sysroot =/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos6.0.sdk \ -- CPU = cortex-a8 \ -- extra-cflags = '-arch armv7s-I/users/Khan/downloads/lame-3.99.5/include' \ -- extra -ldflags = '-arch armv7s-L/users/Khan/downloads/lame-3.99.5/build-lmp3lame-isysroot/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos6.0.sdk '\ -- prefix =/users/Khan/downloads/FFMPEG/arm7s. lib
Make
Make install

Make clean

# Armv7./configure -- disable-doc -- disable-FFMPEG -- disable-ffplay -- disable-ffserver -- enable-pic -- enable-Cross-compile -- enable-decoder = h264 -- enable-libmp3lame \-- disable-ASM -- arch = Arm \ -- target-OS = Darwin -- cc =/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/usr/bin/GCC \ -- As = 'Gas-Preprocessor. PL/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/usr/bin/GCC '\ -- sysroot =/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos6.0.sdk \ -- CPU = cortex-a8 \ -- extra-cflags = '-arch armv7-I/users/Khan/downloads/lame-3.99.5/include' \ -- extra -ldflags = '-arch armv7-L/users/Khan/downloads/lame-3.99.5/build-lmp3lame-isysroot/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos6.0.sdk '\ -- prefix =/users/Khan/downloads/FFMPEG/arm7.lib
Make
Make install

Make clean

# I686./configure -- disable-doc -- disable-FFMPEG -- disable-ffplay -- disable-ffserver -- enable-pic -- enable-Cross-compile -- enable-decoder = h264 -- enable-libmp3lame \-- disable-ASM -- arch = i686 -- CPU = i686 -- disable-armv5te \ -- target-OS = Darwin -- cc =/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/usr/bin/GCC \ -- As = 'Gas-Preprocessor. PL/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/usr/bin/GCC '\ -- sysroot =/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/sdks/iphonesimulator6.0.sdk \ -- extra-ldflags =-L/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/sdks/iphonesimulator6.0.sdk/usr/lib/System \ -- extra-cflags = '-arch i686-I/users/Khan/downloads/lame-3.99.5/include '\-- extra-ldflags = '-arch i686-L/users/Khan/downloads/lame-3.99.5/build-lmp3lame' \ -- prefix =/users/Khan/downloads/FFMPEG/i686.libmake
Make install
Make clean

-- Prefix =/users/Khan/downloads/FFMPEG/i686.lib/
Then, you can run the Lib lipo in each directory on the simulator and on the real machine with various instruction sets.

Lipo-create i686.lib/lib/libavcodec. A arm7.lib/lib/libavcodec. A arm7s. LIB/lib/libavcodec. a-output build/libavcodec. alipo-create i686.lib/lib/libavdevice. A arm7.lib/lib/libavdevice. A arm7s. LIB/lib/libavdevice. a-output build/libavdevice. alipo-create i686.lib/lib/libavfilter. A arm7.lib/lib/libavfilter. A arm7s. LIB/lib/libavfilter. a-output build/libavfilter. alipo-create i686.lib/lib/libavformat. A arm7.lib/lib/libavformat. A arm7s. LIB/lib/libavformat. a-output build/libavformat. alipo-create i686.lib/lib/libavutil. A arm7.lib/lib/libavutil. A arm7s. LIB/lib/libavutil. a-output build/libavutil. alipo-create i686.lib/lib/libswresample. A arm7.lib/lib/libswresample. A arm7s. LIB/lib/libswresample. a-output build/libswresample. alipo-create i686.lib/lib/libswscale. A arm7.lib/lib/libswscale. A arm7s. LIB/lib/libswscale. a-output build/libswscale. A

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.