Skip to content

Commit cb388d9

Browse files
committed
FFmpeg 3.4.2
1 parent 5d1ae46 commit cb388d9

File tree

799 files changed

+410560
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

799 files changed

+410560
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FFmpeg_3.4.2_iOS_3.4.2.zip filter=lfs diff=lfs merge=lfs -text

FFmpeg_3.4.2_iOS_3.4.2.zip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:11c7f850b1c92071fb98573d36b7f310090bd0b74bcb3fd03b71a6bc60278e8c
3+
size 157279777

build-faac-iOS.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/sh
2+
3+
CONFIGURE_FLAGS="--enable-static --with-pic"
4+
5+
ARCHS="arm64 armv7s x86_64 i386 armv7"
6+
7+
# directories
8+
SOURCE="faac"
9+
FAT="fat-faac"
10+
11+
SCRATCH="scratch-faac"
12+
# must be an absolute path
13+
THIN=`pwd`/"thin-faac"
14+
15+
COMPILE="y"
16+
LIPO="y"
17+
18+
if [ "$*" ]
19+
then
20+
if [ "$*" = "lipo" ]
21+
then
22+
# skip compile
23+
COMPILE=
24+
else
25+
ARCHS="$*"
26+
if [ $# -eq 1 ]
27+
then
28+
# skip lipo
29+
LIPO=
30+
fi
31+
fi
32+
fi
33+
34+
if [ "$COMPILE" ]
35+
then
36+
CWD=`pwd`
37+
for ARCH in $ARCHS
38+
do
39+
echo "building $ARCH..."
40+
mkdir -p "$SCRATCH/$ARCH"
41+
cd "$SCRATCH/$ARCH"
42+
43+
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
44+
then
45+
PLATFORM="iPhoneSimulator"
46+
CPU=
47+
if [ "$ARCH" = "x86_64" ]
48+
then
49+
SIMULATOR="-mios-simulator-version-min=8.0"
50+
HOST=
51+
else
52+
SIMULATOR="-mios-simulator-version-min=8.0 -fembed-bitcode"
53+
HOST="--host=i386-apple-darwin"
54+
fi
55+
else
56+
PLATFORM="iPhoneOS"
57+
if [ $ARCH = "armv7s" ]
58+
then
59+
CPU="--cpu=swift"
60+
else
61+
CPU=
62+
fi
63+
SIMULATOR=
64+
HOST="--host=arm-apple-darwin"
65+
fi
66+
67+
XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
68+
CC="xcrun -sdk $XCRUN_SDK clang -Wno-error=unused-command-line-argument-hard-error-in-future"
69+
AS="/usr/local/bin/gas-preprocessor.pl $CC"
70+
CFLAGS="-arch $ARCH $SIMULATOR"
71+
CXXFLAGS="$CFLAGS"
72+
LDFLAGS="$CFLAGS"
73+
74+
CC=$CC CFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS CPPFLAGS=$CXXFLAGS CXX=$CC CXXFLAGS=$CXXFLAGS $CWD/$SOURCE/configure \
75+
$CONFIGURE_FLAGS \
76+
$HOST \
77+
--prefix="$THIN/$ARCH" \
78+
--disable-shared \
79+
--without-mp4v2
80+
81+
make clean && make && make install-strip
82+
cd $CWD
83+
done
84+
fi
85+
86+
#================ fat lib ===================
87+
88+
echo "building fat binaries..."
89+
mkdir -p $FAT/lib
90+
set - $ARCHS
91+
CWD=`pwd`
92+
cd $THIN/$1/lib
93+
for LIB in *.a
94+
do
95+
cd $CWD
96+
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
97+
done
98+
99+
cd $CWD
100+
cp -rf $THIN/$1/include $FAT

build-fdk-aac-iOS.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/sh
2+
#https://sourceforge.net/projects/opencore-amr/files/fdk-aac/
3+
4+
CONFIGURE_FLAGS="--enable-static --with-pic=yes --disable-shared"
5+
6+
ARCHS="arm64 x86_64 i386 armv7 armv7s"
7+
8+
# directories
9+
SOURCE="fdk-aac-0.1.6"
10+
FAT="fdk-aac-ios"
11+
12+
SCRATCH="scratch"
13+
# must be an absolute path
14+
THIN=`pwd`/"thin"
15+
16+
COMPILE="y"
17+
LIPO="y"
18+
19+
if [ "$*" ]
20+
then
21+
if [ "$*" = "lipo" ]
22+
then
23+
# skip compile
24+
COMPILE=
25+
else
26+
ARCHS="$*"
27+
if [ $# -eq 1 ]
28+
then
29+
# skip lipo
30+
LIPO=
31+
fi
32+
fi
33+
fi
34+
35+
if [ "$COMPILE" ]
36+
then
37+
CWD=`pwd`
38+
for ARCH in $ARCHS
39+
do
40+
echo "building $ARCH..."
41+
mkdir -p "$SCRATCH/$ARCH"
42+
cd "$SCRATCH/$ARCH"
43+
44+
CFLAGS="-arch $ARCH"
45+
46+
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
47+
then
48+
PLATFORM="iPhoneSimulator"
49+
CPU=
50+
if [ "$ARCH" = "x86_64" ]
51+
then
52+
CFLAGS="$CFLAGS -mios-simulator-version-min=8.0"
53+
HOST="--host=x86_64-apple-darwin"
54+
else
55+
CFLAGS="$CFLAGS -mios-simulator-version-min=8.0"
56+
HOST="--host=i386-apple-darwin"
57+
fi
58+
else
59+
PLATFORM="iPhoneOS"
60+
if [ $ARCH = arm64 ]
61+
then
62+
HOST="--host=aarch64-apple-darwin"
63+
else
64+
HOST="--host=arm-apple-darwin"
65+
fi
66+
CFLAGS="$CFLAGS -mios-version-min=8.0 -fembed-bitcode"
67+
fi
68+
69+
XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
70+
CC="xcrun -sdk $XCRUN_SDK clang -Wno-error=unused-command-line-argument-hard-error-in-future"
71+
AS="$CWD/$SOURCE/extras/gas-preprocessor.pl $CC"
72+
CXXFLAGS="$CFLAGS"
73+
LDFLAGS="$CFLAGS"
74+
75+
$CWD/$SOURCE/configure \
76+
$CONFIGURE_FLAGS \
77+
$HOST \
78+
$CPU \
79+
CC="$CC" \
80+
CXX="$CC" \
81+
CPP="$CC -E" \
82+
AS="$AS" \
83+
CFLAGS="$CFLAGS" \
84+
LDFLAGS="$LDFLAGS" \
85+
CPPFLAGS="$CFLAGS" \
86+
--prefix="$THIN/$ARCH"
87+
88+
make -j3 install
89+
cd $CWD
90+
done
91+
fi
92+
93+
if [ "$LIPO" ]
94+
then
95+
echo "building fat binaries..."
96+
mkdir -p $FAT/lib
97+
set - $ARCHS
98+
CWD=`pwd`
99+
cd $THIN/$1/lib
100+
for LIB in *.a
101+
do
102+
cd $CWD
103+
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
104+
done
105+
106+
cd $CWD
107+
cp -rf $THIN/$1/include $FAT
108+
fi

build-ffmpeg-iOS.sh

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/bin/sh
2+
#armv7xcode9.1,
3+
#sudo xcode-select -switch pathToXcode9.1/Contents/Developer
4+
#xcode-select --print-path
5+
6+
#需要编译FFpmeg版本号
7+
FF_VERSION="3.4.2"
8+
if [[ $FFMPEG_VERSION != "" ]]; then
9+
FF_VERSION=$FFMPEG_VERSION
10+
fi
11+
SOURCE="ffmpeg-$FF_VERSION"
12+
#输出路径
13+
FAT="FFmpeg-iOS"
14+
15+
SCRATCH=`pwd`/"scratch"
16+
THIN=`pwd`/"thin"
17+
#编译之前需要删除临时缓存文件夹,防止和之前编译的或fdk-aac冲突
18+
rm -rf "$SCRATCH"
19+
rm -rf "$THIN"
20+
21+
X264=`pwd`/x264-iOS #H.264编码器
22+
FDK_AAC=`pwd`/fdk-aac-ios #AAC第三方解码库
23+
FREETYPE=`pwd`/freetype-iOS #字体引擎库
24+
25+
CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-programs --disable-doc --enable-pic --enable-static --disable-shared"
26+
27+
if [ "$X264" ]
28+
then
29+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-gpl --enable-libx264"
30+
fi
31+
32+
if [ "$FDK_AAC" ]
33+
then
34+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfdk-aac --enable-nonfree"
35+
fi
36+
37+
if [ "$FREETYPE" ]
38+
then
39+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfreetype"
40+
fi
41+
42+
ARCHS="armv7 armv7s arm64 x86_64 i386"
43+
44+
COMPILE="y"
45+
LIPO="y"
46+
47+
DEPLOYMENT_TARGET="8.0"
48+
49+
if [ "$*" ]
50+
then
51+
if [ "$*" = "lipo" ]
52+
then
53+
COMPILE=
54+
else
55+
ARCHS="$*"
56+
if [ $# -eq 1 ]
57+
then
58+
LIPO=
59+
fi
60+
fi
61+
fi
62+
63+
if [ "$COMPILE" ]
64+
then
65+
if [ ! `which yasm` ]
66+
then
67+
echo 'Yasm not found'
68+
if [ ! `which brew` ]
69+
then
70+
echo 'Homebrew not found. Trying to install...'
71+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
72+
|| exit 1
73+
fi
74+
echo 'Trying to install Yasm...'
75+
brew install yasm || exit 1
76+
fi
77+
if [ ! `which gas-preprocessor.pl` ]
78+
then
79+
echo 'gas-preprocessor.pl not found. Trying to install...'
80+
(curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \
81+
-o /usr/local/bin/gas-preprocessor.pl \
82+
&& chmod +x /usr/local/bin/gas-preprocessor.pl) \
83+
|| exit 1
84+
fi
85+
86+
if [ ! -r $SOURCE ]
87+
then
88+
echo "$SOURCE source not found. Trying to download..."
89+
curl http://www.ffmpeg.org/releases/$SOURCE.tar.bz2 | tar xj \
90+
|| exit 1
91+
fi
92+
93+
CWD=`pwd`
94+
for ARCH in $ARCHS
95+
do
96+
echo "building $ARCH..."
97+
mkdir -p "$SCRATCH/$ARCH"
98+
cd "$SCRATCH/$ARCH"
99+
100+
CFLAGS="-arch $ARCH"
101+
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
102+
then
103+
PLATFORM="iPhoneSimulator"
104+
CFLAGS="$CFLAGS -mios-simulator-version-min=$DEPLOYMENT_TARGET"
105+
else
106+
PLATFORM="iPhoneOS"
107+
CFLAGS="$CFLAGS -mios-version-min=$DEPLOYMENT_TARGET -fembed-bitcode"
108+
if [ "$ARCH" = "arm64" ]
109+
then
110+
EXPORT="GASPP_FIX_XCODE5=1"
111+
fi
112+
fi
113+
114+
XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
115+
CC="xcrun -sdk $XCRUN_SDK clang"
116+
117+
if [ "$ARCH" = "arm64" ]
118+
then
119+
AS="gas-preprocessor.pl -arch aarch64 -- $CC"
120+
else
121+
AS="gas-preprocessor.pl -- $CC"
122+
fi
123+
124+
CXXFLAGS="$CFLAGS"
125+
LDFLAGS="$CFLAGS"
126+
if [ "$X264" ]
127+
then
128+
CFLAGS="$CFLAGS -I$X264/include"
129+
LDFLAGS="$LDFLAGS -L$X264/lib"
130+
fi
131+
if [ "$FDK_AAC" ]
132+
then
133+
CFLAGS="$CFLAGS -I$FDK_AAC/include"
134+
LDFLAGS="$LDFLAGS -L$FDK_AAC/lib"
135+
fi
136+
if [ "$FREETYPE" ]
137+
then
138+
CFLAGS="$CFLAGS -I$FREETYPE/include/freetype2 -I$CWD/libpng/include"
139+
LDFLAGS="$LDFLAGS -L$FREETYPE/lib -L$CWD/libpng-iOS/lib -lfreetype -lpng"
140+
fi
141+
142+
TMPDIR=${TMPDIR/%\/} $CWD/$SOURCE/configure \
143+
--target-os=darwin \
144+
--arch=$ARCH \
145+
--cc="$CC" \
146+
--as="$AS" \
147+
$CONFIGURE_FLAGS \
148+
--extra-cflags="$CFLAGS" \
149+
--extra-ldflags="$LDFLAGS" \
150+
--prefix="$THIN/$ARCH" \
151+
|| exit 1
152+
153+
make -j3 install $EXPORT || exit 1
154+
cd $CWD
155+
done
156+
fi
157+
158+
if [ "$LIPO" ]
159+
then
160+
echo "building fat binaries..."
161+
mkdir -p $FAT/lib
162+
set - $ARCHS
163+
CWD=`pwd`
164+
cd $THIN/$1/lib
165+
for LIB in *.a
166+
do
167+
cd $CWD
168+
echo lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB 1>&2
169+
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB || exit 1
170+
done
171+
172+
cd $CWD
173+
cp -rf $THIN/$1/include $FAT
174+
fi
175+
176+
echo "iOS FFmpeg bulid success!"

0 commit comments

Comments
 (0)