ffmpeg builing for ios


this is how i compiled ffmpeg this might help someone, here are steps to build ffmpeg for IOS5

1. i download the ffmpeg4ios.
2. enabled required coders/decoders in build_armv7
if you know which one is to be enable then enable them, otherwise just use the following code in build-armv7. it will enable all encoders and decoders..
#!/bin/tcsh -f

if (! -d armv7) mkdir armv7
if (! -d lib) mkdir lib

rm armv7/*.a

make clean

./configure –enable-cross-compile –arch=arm –target-os=darwin –cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc –as=’gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc’ –sysroot=/Developer/Platforms/iPhoneOS.platform/ Developer/SDKs/iPhoneOS5.0.sdk –cpu=cortex-a8 –extra-cflags=’-arch armv7′ –extra-ldflags=’-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk’ –enable-pic


mv libavcodec/libavcodec.a armv7/
mv libavdevice/libavdevice.a armv7/
mv libavformat/libavformat.a armv7/
mv libavutil/libavutil.a armv7/
mv libswscale/libswscale.a armv7/

rm lib/*.a

cp armv7/*.a lib/


3. and now run the ./configure –disable-yasm from where it placed
4. now open config.h file and check weather required things are enabled or not, if not once check build-armv7 and change required things and goto step 3
5. and than run ./build_armv7
here i faced some problems like


    CC  libavformat/asfcrypt.o error: invalid operand in inline asm: 'ldr   ${0:Q}, $1       ldr   ${0:R}, $2       ' 

than i comment a line in libavutil/arm/intmath.h i.e,

#define av_clipl_int32 av_clipl_int32_arm

if it says install gas-preprocessor.pl just download it from here

now give all permissions to the file(i,e 777) and move the file to /usr/local/bin

here you can find source code which help you using this static libraries build from ffmpeg

NOTE: while you are trying to open a local file if av_open_input_file() returns -2 make sure enable file protocol. just open config.h file there you can find what are enabled. and we need to call av_register_all() before opening file,

if anything i missed please write comment(top right of the post) here ……..