Xcode5编译ffmpeg

news/2024/7/10 22:14:37 标签: ffmpeg, xcode, git
  1. 命令行安装FFmpeg:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg(或:到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build)

  2. 安装命令行工具(Command Line Tools)

    打开终端,输入命令:xcode-select --install

    osx-10.9-clt-1

     

    选择“安装”,然后同意安装协议。

    osx-10.9-clt-2

     

    osx-10.9-clt-3

     

  3. 下载gas-preprocessor:https://github.com/mansr/gas-preprocessor, 先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。

    然后修改gas-preprocessor.pl文件的权限。注:需要有读,写和执行的权限。具体操作为,首先在命令行下进入/usr/bin目录,然后执行chmod命令,如下图所示:

    13224613-88afdd0778fa46bda8c5a6549a0febf

     

  4. 运行build-ffmpeg.sh文件:

    1、cd  /build-ffmpeg.sh 脚本的所在目录下

    2、sh build-ffmpeg.sh

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    #!/bin/bash
    ###########################################################################
    #  Choose your ffmpeg version and your currently-installed iOS SDK version:
    #
    VERSION= "2.0.2"
    SDKVERSION= "7.0"
    #
    #
    ###########################################################################
    #
    # Don't change anything under  this  line!
    #
    ###########################################################################
    # No need to change  this  since xcode build will only compile  in  the
    # necessary bits from the libraries we create
    ARCHS= "armv7 armv7s i386"
    DEVELOPER=`xcode-select -print-path`
    cd  "`dirname \"$0\"`"
    REPOROOT=$(pwd)
    # Where we'll end up storing things  in  the end
    OUTPUTDIR= "${REPOROOT}/dependencies"
    mkdir -p ${OUTPUTDIR}/ include
    mkdir -p ${OUTPUTDIR}/lib
    mkdir -p ${OUTPUTDIR}/bin
    BUILDDIR= "${REPOROOT}/build"
    mkdir -p $BUILDDIR
    # where we will keep our sources and build from.
    SRCDIR= "${BUILDDIR}/src"
    mkdir -p $SRCDIR
    # where we will store intermediary builds
    INTERDIR= "${BUILDDIR}/built"
    mkdir -p $INTERDIR
    ########################################
    cd $SRCDIR
    # Exit the script  if  an error happens
    set  -e
    if  [ ! -e  "${SRCDIR}/ffmpeg-${VERSION}.tar.bz2"  ]; then
         echo  "Downloading ffmpeg-${VERSION}.tar.bz2"
         curl -LO http: //ffmpeg.org/releases/ffmpeg-${VERSION}.tar.bz2
    else
         echo  "Using ffmpeg-${VERSION}.tar.bz2"
    fi
    tar jxf ffmpeg-${VERSION}.tar.bz2 -C $SRCDIR
    cd  "${SRCDIR}/ffmpeg-${VERSION}"
    set  +e # don 't bail out of bash script if ccache doesn' t exist
    CCACHE=`which ccache`
    if  [ $? ==  "0"  ]; then
         echo  "Building with ccache: $CCACHE"
         CCACHE= "${CCACHE} "
    else
         echo  "Building without ccache"
         CCACHE= ""
    fi
    set  -e # back to regular  "bail out on error"  mode
    for  ARCH  in  ${ARCHS}
    do
         if  "${ARCH}"  ==  "i386"  ];
         then
             PLATFORM= "iPhoneSimulator"
             EXTRA_CONFIG= "--arch=i386 --disable-asm --enable-cross-compile --target-os=darwin --cpu=i386"
             EXTRA_CFLAGS= "-arch i386"
             EXTRA_LDFLAGS= "-I${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk/usr/lib -mfpu=neon"
         else
             PLATFORM= "iPhoneOS"
             EXTRA_CONFIG= "--arch=arm --target-os=darwin --enable-cross-compile --cpu=cortex-a9 --disable-armv5te"
             EXTRA_CFLAGS= "-w -arch ${ARCH} -mfpu=neon"
             EXTRA_LDFLAGS= "-mfpu=neon"
         fi
         mkdir -p  "${INTERDIR}/${ARCH}"
         ./configure --prefix= "${INTERDIR}/${ARCH}"  --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-iconv --disable-bzlib --enable-avresample --sysroot= "${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"  --cc= "${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"  -- as = '/usr/local/bin/gas-preprocessor.pl'  --extra-cflags= "${EXTRA_CFLAGS} -miphoneos-version-min=${SDKVERSION} -I${OUTPUTDIR}/include"  --extra-ldflags= "-arch ${ARCH} ${EXTRA_LDFLAGS} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk -miphoneos-version-min=${SDKVERSION} -L${OUTPUTDIR}/lib"  ${EXTRA_CONFIG} --enable-pic --extra-cxxflags= "$CPPFLAGS -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
         make && make install && make clean
                                                                                                                                
    done
    mkdir -p  "${INTERDIR}/universal/lib"
    cd  "${INTERDIR}/armv7/lib"
    for  file  in  *.a
    do
    cd ${INTERDIR}
    xcrun -sdk iphoneos lipo -output universal/lib/$file  -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$file
    echo  "Universal $file created."
    done
    cp -r ${INTERDIR}/armv7/ include  ${INTERDIR}/universal/
    echo  "Done."

     

  5. 把/build/built/universal目录下的 lib 和 include 文件导入工程,并在header search path 配置 include文件 路径。

 

本文出自 “追逐风飞的花” 博客,请务必保留此出处http://metoo.blog.51cto.com/7809119/1382158

转载于:https://www.cnblogs.com/yulang314/p/3710272.html


http://www.niftyadmin.cn/n/846451.html

相关文章

第十二篇 带控制的物料的实地盘点设置与测试

详见, http://bbs.erp100.com/thread-273174-1-1.html Oracle提供的实地盘点在使用的时候虽然把工作做得很精细,但同时也很繁琐,尤其是当物料启用了控制的情况下就更加精细,但是也更加繁琐。反而使得其实用性更加低。在实施过程中…

Golang 性能忽然增加变慢10倍的现象,推测是编译器在spilt stack,导致的问题

2019独角兽企业重金招聘Python工程师标准>>> 本测试分别执行三种测试: 1.程序嵌套调用时使用int; 2.程序嵌套调用时使用intstring; 3.程序嵌套调用时使用intinterface{}; 测试脚本如下: // stackSplitTest package mainimport (&q…

worksteal thread pool

worksteal的场景 对于一个线程池,每个线程有一个队列,想象这种场景,有的线程队列中有大量的比较耗时的任务堆积,而有的线程队列却是空的,现象就是有的线程处于饥饿状态,而有的线程处于消化不良的状态&#…

网站后台语言的是html,非常实用的管理系统 网站后台html模板

【实例简介】经典清新的左右分栏的后台模板,左边是菜单栏,右边是功能显示栏。主菜单点开有子菜单。模板为html格式。下载后请从index.html进入,其它子页面在相应的文件夹下面【实例截图】【核心代码】houtai_xiangmu└── houtai_xiangmu├─…

彻底搞懂Oracle字符集

基本概念字符集(Character set):是一个系统支持的所有抽象字符的集合。字符是各种文字和符号的总称,包括各国家文字、标点符号、图形符号、数字等。常见的字符集有ASCII,ZHS16GB231280,ZHS16GBK等。字符编码…

理解MySQL——索引与优化

2019独角兽企业重金招聘Python工程师标准>>> 写在前面:索引对查询的速度有着至关重要的影响,理解索引也是进行数据库性能调优的起点。考虑如下情况,假设数据库中一个表有10^6条记录,DBMS的页面大小为4K,并存…

UE4代码规范

为什么80%的码农都做不了架构师?>>> 命名部分 函数名,变量名,类型名,首字母大写。eg:UPrimitiveComponent类型名有一个额外的大写字母前缀。模板类以T为前缀。eg:TArray 继承UObject的类以&a…

三星 9810 android 9,【极光ROM】-【三星NOTE9 N960X-9810】-【V17.0 Android-Q-TB9】

● 支持机型:● N960F/FD(欧版)● N960N(韩版)主要更新内容:1、基于N960F官方最新安卓Q底包N960FXXS5DTB9制作。2、基于官方最新DTA5内核源码重新编译内核。3、修复浮动信息开关无效问题。4、优化重启后直接指纹解锁。5、增加S20U壁纸。6、ROM不再包含任…