ffmpeg编译shell

本文介绍如何使用FFmpeg进行iOS设备(iPhone 3G, iPhone 3GS)及模拟器的跨平台编译过程,包括配置参数、编译环境搭建等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载地址


#!/bin/bash


ROOT_PATH=`pwd`/`dirname "$0"`
LIB_PATH=$ROOT_PATH/ffmpeg_build


if [ ! -s $ROOT_PATH/ffmpeg/libswscale ] ; then
ln -sf ../libswscale/ $ROOT_PATH/ffmpeg/libswscale
fi


mkdir -p $LIB_PATH/{i386,iphone3g,iphone3gs}


PATH=$PATH:$ROOT_PATH


COMMON_PARAMS="--disable-doc --disable-ffplay --disable-ffserver \
--disable-encoders --disable-decoders --disable-hwaccels \
--disable-muxers --disable-demuxers --disable-parsers --disable-bsfs \
--disable-protocols --disable-indevs --disable-outdevs --disable-devices \
--disable-filters --disable-network --disable-zlib --disable-bzlib \
--enable-decoder=h264 \
--enable-demuxer=h264 \
--enable-parser=h264"


# Note - to disable optimizations (for debugging, etc.), add the following:
# --enable-decoder=h263 --enable-decoder=svq3 --disable-optimizations"


cd $LIB_PATH/iphone3gs


../../ffmpeg/configure --enable-cross-compile --arch=arm --target-os=darwin \
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang \
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk \
--extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic \
$COMMON_PARAMS


make


cd $LIB_PATH/iphone3g


../../ffmpeg/configure --enable-cross-compile --arch=arm --target-os=darwin \
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang \
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk \
--extra-cflags='-arch armv6' --extra-ldflags='-arch armv6' --enable-pic \
$COMMON_PARAMS


make


cd $LIB_PATH/i386


SIMULATOR_CONFIG=""


../../ffmpeg/configure --enable-cross-compile --arch=i386 --target-os=darwin \
--cc=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang \
--sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk \
--extra-cflags='-arch i386' --extra-ldflags='-arch i386' --enable-pic --disable-mmx --disable-mmx2 \
$COMMON_PARAMS


make


cd $LIB_PATH


for l in `echo -ne "libavcodec\nlibavdevice\nlibavformat\nlibavutil\nlibswscale"`; do
lipo -create "i386/$l/$l.a" "iphone3gs/$l/$l.a" "iphone3g/$l/$l.a" -output "$l.a";
done

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值