• ffmpeg iOS 编译


    编译模拟器版本
    1 到https://github.com/yuvi/gas-preprocessor下载gas-preprocessor.p并拷贝到/usr/sbin目录中
    2 下载ffmpeg源码。
    http://ffmpeg.org/download.html
    https://github.com/FFmpeg/FFmpeg
    3 解压源码,cd到源码目录下
    4 创建文件config_i386.sh,其内容如下

    复制代码
    #!/bin/tcsh -f
    set targetDir="../ffmpeg-libs/i386"
    if (! -d $targetDir ) mkdir $targetDir
    
    rm -f $targetDir/*.a
    
    make clean
    
    #./configure --arch=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386'  --disable-encoders --disable-debug --disable-mmx
    
    
    ./configure 
    --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' 
    --nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm" 
    --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk 
    --target-os=darwin 
    --arch=i386 
    --cpu=i386 
    --extra-cflags='-arch i386 -miphoneos-version-min=4.3 -mdynamic-no-pic' 
    --extra-ldflags='-arch i386 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' 
    --prefix=compiled/i386 
    --enable-cross-compile 
    --enable-nonfree 
    --enable-gpl 
    --disable-armv5te 
    --disable-swscale-alpha 
    --disable-doc 
    --disable-ffmpeg 
    --disable-ffplay 
    --disable-ffprobe 
    --disable-ffserver 
    --disable-asm 
    --disable-debug
    
    
    make
    
    mv libavcodec/libavcodec.a $targetDir
    mv libavdevice/libavdevice.a $targetDir
    mv libavformat/libavformat.a $targetDir
    mv libavutil/libavutil.a $targetDir
    mv libswscale/libswscale.a $targetDir
    复制代码

    5 执行config_i386.sh进行配置和编译
    编译完成后,可以在$targetDir找到相应的静态库文件

    编译真机版
    前3步同上
    第4步:创建文件config_armv7,其内容如下

    复制代码
    #!/bin/tcsh -f
    set targetDir="../ffmpeg-libs/armv7"
    if (! -d $targetDir ) mkdir $targetDir
    
    rm -f $targetDir/*.a
    
    make clean
    
    ./configure 
    --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' 
    --nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/nm" 
    --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk 
    --target-os=darwin 
    --arch=arm 
    --cpu=cortex-a8 
    --extra-cflags='-arch armv7 -miphoneos-version-min=4.3 -mdynamic-no-pic' 
    --extra-ldflags='-arch armv7 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' 
    --prefix=compiled/armv7 
    --enable-cross-compile 
    --enable-nonfree 
    --enable-gpl 
    --disable-armv5te 
    --disable-swscale-alpha 
    --disable-doc 
    --disable-ffmpeg 
    --disable-ffplay 
    --disable-ffprobe 
    --disable-ffserver 
    --disable-asm 
    --disable-debug
    
    
    make
    
    mv libavcodec/libavcodec.a $targetDir
    mv libavformat/libavformat.a $targetDir
    mv libavutil/libavutil.a $targetDir
    mv libswscale/libswscale.a $targetDir
    复制代码

    第5步:
    执行config_armv7进行配置和编译,编译完成后可以在$targetDir找到相应的静态库文件

  • 相关阅读:
    java 网络编程基础 InetAddress类;URLDecoder和URLEncoder;URL和URLConnection;多线程下载文件示例
    java 图形化工具Swing 颜色文件选择器 ;JColorChooser;JFileChoose
    java 图形化工具Swing 创建工具条
    2021年XX百万职工技能大赛-网络与信息安全管理员理论题复习题库(第二套)
    2021年XX百万职工技能大赛-网络与信息安全管理员理论题复习题库(第一套)
    百度ABC相关学习和笔记
    Ai趣味课堂笔记 -- 第二季 计算机视觉
    Ai趣味课堂笔记 -- 第一季 人工智能基础知识
    CKA-Kubernets(K8s) (四)
    CKA-Kubernets(K8s) (三)
  • 原文地址:https://www.cnblogs.com/liyufeng2013/p/3421337.html
Copyright © 2020-2023  润新知