对于 Android 有一个 NDK,试试这个
http://mobilepearls.com/labs/native-android-api/ndk/docs/openmaxal/index.html
对于 iOS,您可以使用默认 MPMoviewPlayer 来播放流
NSURL *mediaURL = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"];
MPMoviePlayerController *mediaPlayer = [[MPMoviePlayerController alloc] initWithContentURL:mediaURL];
对于需要使用ffmpeg的自定义技巧,这里有一个iOS下编译ffmpeg的脚本
export PLATFORM="iPhoneOS"
export MIN_VERSION="4.0"
export MAX_VERSION="5.0"
export DEVROOT=/Developer/Platforms/${PLATFORM}.platform/Developer
export SDKROOT=$DEVROOT/SDKs/${PLATFORM}${MAX_VERSION}.sdk
export CC=$DEVROOT/usr/bin/llvm-gcc
export LD=$DEVROOT/usr/bin/ld
export CPP=$DEVROOT/usr/bin/cpp
export CXX=$DEVROOT/usr/bin/llvm-g++
export AR=$DEVROOT/usr/bin/ar
export LIBTOOL=$DEVROOT/usr/bin/libtool
export NM=$DEVROOT/usr/bin/nm
export CXXCPP=$DEVROOT/usr/bin/cpp
export RANLIB=$DEVROOT/usr/bin/ranlib
COMMONFLAGS="-pipe -gdwarf-2 -no-cpp-precomp -isysroot ${SDKROOT} -marm -fPIC"
export LDFLAGS="${COMMONFLAGS} -fPIC"
export CFLAGS="${COMMONFLAGS} -fvisibility=hidden"
export CXXFLAGS="${COMMONFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden"
FFMPEG_LIBS="libavcodec libavdevice libavformat libavutil libswscale"
echo "Building armv6..."
make clean
./configure \
--cpu=arm1176jzf-s \
--extra-cflags='-arch armv6 -miphoneos-version-min=${MIN_VERSION} -mthumb' \
--extra-ldflags='-arch armv6 -miphoneos-version-min=${MIN_VERSION}' \
--enable-cross-compile \
--arch=arm \
--target-os=darwin \
--cc=${CC} \
--sysroot=${SDKROOT} \
--prefix=installed \
--disable-network \
--disable-decoders \
--disable-muxers \
--disable-demuxers \
--disable-devices \
--disable-parsers \
--disable-encoders \
--disable-protocols \
--disable-filters \
--disable-bsfs \
--enable-decoder=h264 \
--enable-decoder=svq3 \
--enable-gpl \
--enable-pic \
--disable-doc
perl -pi -e 's/HAVE_INLINE_ASM 1/HAVE_INLINE_ASM 0/' config.h
make -j3
mkdir -p build.armv6
for i in ${FFMPEG_LIBS}; do cp ./$i/$i.a ./build.armv6/; done
echo "Building armv7..."
make clean
./configure \
--cpu=cortex-a8 \
--extra-cflags='-arch armv7 -miphoneos-version-min=${MIN_VERSION} -mthumb' \
--extra-ldflags='-arch armv7 -miphoneos-version-min=${MIN_VERSION}' \
--enable-cross-compile \
--arch=arm \
--target-os=darwin \
--cc=${CC} \
--sysroot=${SDKROOT} \
--prefix=installed \
--disable-network \
--disable-decoders \
--disable-muxers \
--disable-demuxers \
--disable-devices \
--disable-parsers \
--disable-encoders \
--disable-protocols \
--disable-filters \
--disable-bsfs \
--enable-decoder=h264 \
--enable-decoder=svq3 \
--enable-gpl \
--enable-pic \
--disable-doc
perl -pi -e 's/HAVE_INLINE_ASM 1/HAVE_INLINE_ASM 0/' config.h
make -j3
mkdir -p build.armv7
for i in ${FFMPEG_LIBS}; do cp ./$i/$i.a ./build.armv7/; done
mkdir -p build.universal
for i in ${FFMPEG_LIBS}; do lipo -create ./build.armv7/$i.a ./build.armv6/$i.a -output ./build.universal/$i.a; done
for i in ${FFMPEG_LIBS}; do cp ./build.universal/$i.a ./$i/$i.a; done
make install
将此用于 android ffmpeg
http://bambuser.com/opensource