How to compile ffmpeg for iPhone

  1. Download and install the iPhone SDK 3.1.
  2. Get the latest gas-preprocessor and install it in /usr/local/bin or some other directory in your $PATH.
    http://github.com/yuvi/gas-preprocessor/
  3. Get the latest FFmpeg from SVN (minimum r20151).
  4. Configure FFmpeg with one of the following commands. These give a
    clean build with a default installation of iPhone SDK 3.1 on OSX Leopard.
    Other versions may vary.
  5. For iPhone 3GS or iPod Touch 3G 32GB/64GB, use this command:

    ./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk --enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic
  6. For other iPhone or iPod Touch models, use this command:

    ./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk --enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s
  7. Run make.

Comments :

我按照你上面说的去编译ffmpeg 不过再make

我按照你上面说的去编译ffmpeg 不过再make 时会失败 错误是
Unrecognized character \xC2 in column 2 at /usr/local/bin/gas-preprocessor.pl line 17

这是为什么啊 ? 怎么解决呀? 我看了下 gas-preprocessor的内容! 和那个源文件一样哦~~

configure 的项也是用你上面的哦~~

我也有问题,我用的是最新的ffmpeg,/bin/sh:

我也有问题,我用的是最新的ffmpeg,/bin/sh: gas-preprocessor.pl: command not found
make: *** [libavcodec/arm/dsputil_arm.o] Error 127
localhost:ffmpeg apple$

你要下載和安裝

你要下載和安裝 http://github.com/yuvi/gas-preprocessor/

請教一下, FFMPEG的編譯問題

之前我有按照你說的方式去編譯, 也找到網路上的完整的 compile 所使用的 configure 的 flag.
<之前使用的 flag, 編譯都OK, 也都能夠使用>
#iphone 3gs
#./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='~/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic --disable-mlib --disable-ffmpeg --disable-ffserver

#iphone 3g
./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='~/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s --disable-mlib --disable-armv6 --disable-armv6t2 --disable-armv5te --disable-armvfp --disable-ffmpeg --disable-ffserver

我也寫了一支 iPhone 的程式包這個 libav.a 去撥放 mpeg4 的檔案, 聲音跟影像都正常, 但是目前, iPhone OS 從 3.13 又往上升升到 4.0, 用相同的 configure flag 去編譯, 也都過關, 沒有任何錯誤, 但是放上去新的 iPhone OS 4.0 上面去跑, 確什麼都沒有了, 沒有聲音也沒有影像了.

駐: 我已經把我的手機 FW, 升級的 OS 4.0, 但是照理說, 那個 libav 應該是能用的, 可是事實上卻是完全不能使用, 可否請 water 大, 幫我看看問題出在哪邊?!

Summary: 原本 iPhone OS 3G/3GS, 編譯出來的 ffmpeg libav.a 都能夠使用, 但是自從 OS 升級到 4.0, libav.a 就變成不能用了 (手機都是同一支), 問題到底出在哪邊????

救命阿!! WATER 大!!

還未試過在 os4 行啊,有空再試。

還未試過在 os4 行啊,有空再試。

我已经安装了,但是还有问题在ar的时候

我已经安装了,但是还有问题在ar的时候

安装指的是什么意思,我考到了usr/bin下边了,好像生效

安装指的是什么意思,我考到了usr/bin下边了,好像生效了但是还有错误
AR libavformat/libavformat.a
ranlib: archive member: libavformat/libavformat.a(avlanguage.o) cputype (7) does not match previous archive members cputype (12) (all members must match)
ranlib: archive member: libavformat/libavformat.a(avlanguage.o) cputype (7) does not match previous archive members cputype (12) (all members must match)
make: *** [libavformat/libavformat.a] Error 1
麻烦问下你遇到过么

似乎你有些object file 不是compile 做

似乎你有些object file 不是compile 做 arm,試試 make clean 重新compile 吧~