Skip to content

Commit b49db34

Browse files
committed
add ffmpeg4、5、6、7
1 parent 382ef82 commit b49db34

File tree

6 files changed

+203
-43
lines changed

6 files changed

+203
-43
lines changed

configs/ffconfig/auto-detect-third-libs.sh

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# pkg-config --libs dav1d
2323
# pkg-config --cflags --libs libbluray
2424

25+
2526
THIRD_CFG_FLAGS=
2627

2728
# echo "----------------------"
@@ -133,6 +134,21 @@ echo "----------------------"
133134

134135
# FFmpeg 4.2 支持AV1、AVS2等格式
135136
# dav1d由VideoLAN,VLC和FFmpeg联合开发,项目由AOM联盟赞助,和libaom相比,dav1d性能普遍提升100%,最高提升400%
137+
138+
result=$(gt_or_equal "$GIT_REPO_VERSION" "4.2")
139+
if [[ $result ]]; then
140+
141+
pkg-config --libs dav1d --silence-errors >/dev/null && enable_dav1d=1
142+
143+
if [[ $enable_dav1d ]];then
144+
echo "[✅] --enable-libdav1d : $(pkg-config --modversion dav1d)"
145+
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdav1d --enable-decoder=libdav1d"
146+
else
147+
echo "[❌] --disable-libdav1d --disable-decoder=libdav1d"
148+
fi
149+
echo "----------------------"
150+
fi
151+
136152
#从FFmpeg7.1.1开始支持硬解av1,苹果需要M3芯片
137153
result=$(gt_or_equal "$GIT_REPO_VERSION" "7.1.1")
138154
if [[ $result ]]; then
@@ -144,28 +160,25 @@ fi
144160

145161
echo "----------------------"
146162

147-
pkg-config --libs dav1d --silence-errors >/dev/null && enable_dav1d=1
148-
149-
if [[ $enable_dav1d ]];then
150-
echo "[✅] --enable-libdav1d : $(pkg-config --modversion dav1d)"
151-
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdav1d --enable-decoder=libdav1d"
152-
else
153-
echo "[❌] --disable-libdav1d --disable-decoder=libdav1d"
154-
fi
163+
# 从6开始支持的 smb2 协议
164+
result=$(gt_or_equal "$GIT_REPO_VERSION" "6")
165+
if [[ $result ]]; then
166+
pkg-config --libs libsmb2 --silence-errors >/dev/null && enable_smb2=1
155167

156-
echo "----------------------"
168+
if [[ $enable_smb2 ]];then
169+
echo "[✅] --enable-libsmb2 : $(pkg-config --modversion libsmb2)"
170+
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libsmb2 --enable-protocol=libsmb2"
171+
else
172+
echo "[❌] --disable-libsmb2 --disable-protocol=libsmb2"
173+
fi
157174

158-
pkg-config --libs libsmb2 --silence-errors >/dev/null && enable_smb2=1
175+
echo "----------------------"
159176

160-
if [[ $enable_smb2 ]];then
161-
echo "[✅] --enable-libsmb2 : $(pkg-config --modversion libsmb2)"
162-
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libsmb2 --enable-protocol=libsmb2"
163-
else
164-
echo "[❌] --disable-libsmb2 --disable-protocol=libsmb2"
177+
echo "[✅] --enable-parser=av3a"
178+
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-parser=av3a --enable-demuxer=av3a"
179+
echo "----------------------"
165180
fi
166181

167-
echo "----------------------"
168-
169182
pkg-config --libs libbluray --silence-errors >/dev/null && enable_bluray=1
170183

171184
if [[ $enable_bluray ]];then
@@ -174,6 +187,7 @@ if [[ $enable_bluray ]];then
174187
else
175188
echo "[❌] --disable-libbluray --disable-protocol=bluray"
176189
fi
190+
177191
echo "----------------------"
178192

179193
#不确定7代之前的版本是否支持dvdvideo
@@ -188,29 +202,35 @@ if [[ $result ]]; then
188202
else
189203
echo "[❌] --disable-dvdvideo"
190204
fi
205+
echo "----------------------"
191206
else
192-
pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1
193-
if [[ $enable_dvdread ]];then
194-
echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)"
195-
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd"
196-
else
197-
echo "[❌] --disable-dvd protocol"
207+
result=$(gt_or_equal "$GIT_REPO_VERSION" "5")
208+
if [[ $result ]]; then
209+
pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1
210+
if [[ $enable_dvdread ]];then
211+
echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)"
212+
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd"
213+
else
214+
echo "[❌] --disable-dvd protocol"
215+
fi
216+
echo "----------------------"
198217
fi
199218
fi
200219

201-
echo "----------------------"
220+
result=$(gt_or_equal "$GIT_REPO_VERSION" "5")
221+
if [[ $result ]]; then
222+
pkg-config --libs uavs3d --silence-errors >/dev/null && enable_uavs3d=1
202223

203-
pkg-config --libs uavs3d --silence-errors >/dev/null && enable_uavs3d=1
224+
if [[ $enable_uavs3d ]];then
225+
echo "[✅] --enable-libuavs3d : $(pkg-config --modversion uavs3d)"
226+
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libuavs3d --enable-decoder=libuavs3d"
227+
else
228+
echo "[❌] --disable-libuavs3d --disable-decoder=libuavs3d"
229+
fi
204230

205-
if [[ $enable_uavs3d ]];then
206-
echo "[✅] --enable-libuavs3d : $(pkg-config --modversion uavs3d)"
207-
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libuavs3d --enable-decoder=libuavs3d"
208-
else
209-
echo "[❌] --disable-libuavs3d --disable-decoder=libuavs3d"
231+
echo "----------------------"
210232
fi
211233

212-
echo "----------------------"
213-
214234
pkg-config --libs libxml-2.0 --silence-errors >/dev/null && enable_xml2=1
215235

216236
if [[ $enable_xml2 ]];then
@@ -242,8 +262,6 @@ echo "----------------------"
242262
# echo "[❌] --disable-decoder=av3a"
243263
# fi
244264

245-
echo "[✅] --enable-parser=av3a"
246-
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-parser=av3a --enable-demuxer=av3a"
247265

248266
# --------------------------------------------------------------
249267
THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --pkg-config-flags=--static"

configs/libs/ffmpeg4.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
# brew install nasm
19+
# If you really want to compile without asm, configure with --disable-asm.
20+
21+
export LIB_NAME='ffmpeg'
22+
export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice"
23+
export LIB_DEPENDS_BIN="nasm pkg-config"
24+
export GIT_LOCAL_REPO=extra/ffmpeg
25+
export REPO_DIR=ffmpeg4
26+
export PATCH_DIR=ffmpeg-n4.0
27+
28+
# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror
29+
if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then
30+
export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM"
31+
else
32+
export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git
33+
fi
34+
35+
if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then
36+
export GIT_COMMIT="$GIT_FFMPEG_COMMIT"
37+
export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT"
38+
else
39+
export GIT_COMMIT=n4.0.5
40+
export GIT_REPO_VERSION=4.0.5
41+
fi
42+
43+
# pre compiled
44+
export PRE_COMPILE_TAG_TVOS=
45+
export PRE_COMPILE_TAG_MACOS=
46+
export PRE_COMPILE_TAG_IOS=
47+
export PRE_COMPILE_TAG_ANDROID=

configs/libs/ffmpeg5.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
# brew install nasm
19+
# If you really want to compile without asm, configure with --disable-asm.
20+
21+
export LIB_NAME='ffmpeg'
22+
export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice"
23+
export LIB_DEPENDS_BIN="nasm pkg-config"
24+
export GIT_LOCAL_REPO=extra/ffmpeg
25+
export REPO_DIR=ffmpeg5
26+
export PATCH_DIR=ffmpeg-n5.1
27+
28+
# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror
29+
if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then
30+
export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM"
31+
else
32+
export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git
33+
fi
34+
35+
if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then
36+
export GIT_COMMIT="$GIT_FFMPEG_COMMIT"
37+
export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT"
38+
else
39+
export GIT_COMMIT=n5.1.6
40+
export GIT_REPO_VERSION=5.1.6
41+
fi
42+
43+
# pre compiled
44+
export PRE_COMPILE_TAG_TVOS=
45+
export PRE_COMPILE_TAG_MACOS=
46+
export PRE_COMPILE_TAG_IOS=
47+
export PRE_COMPILE_TAG_ANDROID=

configs/libs/ffmpeg6.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
# brew install nasm
19+
# If you really want to compile without asm, configure with --disable-asm.
20+
21+
export LIB_NAME='ffmpeg'
22+
export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice"
23+
export LIB_DEPENDS_BIN="nasm pkg-config"
24+
export GIT_LOCAL_REPO=extra/ffmpeg
25+
export REPO_DIR=ffmpeg6
26+
export PATCH_DIR=ffmpeg-n6.1
27+
28+
# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror
29+
if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then
30+
export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM"
31+
else
32+
export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git
33+
fi
34+
35+
if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then
36+
export GIT_COMMIT="$GIT_FFMPEG_COMMIT"
37+
export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT"
38+
else
39+
export GIT_COMMIT=n6.1.1 #origin/release/5.1
40+
export GIT_REPO_VERSION=6.1.1
41+
fi
42+
43+
# pre compiled
44+
export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407
45+
export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635
46+
export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250520112635
47+
export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635
48+
export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110

configs/libs/ffmpeg.sh renamed to configs/libs/ffmpeg7.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export LIB_NAME='ffmpeg'
2222
export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice"
2323
export LIB_DEPENDS_BIN="nasm pkg-config"
2424
export GIT_LOCAL_REPO=extra/ffmpeg
25-
export REPO_DIR=ffmpeg
25+
export REPO_DIR=ffmpeg7
26+
export PATCH_DIR=ffmpeg-n7.1.1
2627

2728
# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror
2829
if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then
@@ -40,9 +41,8 @@ else
4041
fi
4142

4243
# pre compiled
43-
export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407
44+
4445
export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250605164908
4546
export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250605164908
4647
export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250605164908
47-
export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110
4848

do-compile/apple/ffmpeg.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ cp config.* $MR_BUILD_PREFIX
8888
make install >/dev/null
8989
mkdir -p $MR_BUILD_PREFIX/include/libffmpeg
9090
cp -f config.h $MR_BUILD_PREFIX/include/libffmpeg/
91-
[ -e config_components.h ] && cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/
91+
cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/ &> /dev/null || true
9292
# copy private header for ffmpeg-kit.
93-
[ -e $MR_BUILD_SOURCE/libavutil/getenv_utf8.h ] && cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/
93+
cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/ &> /dev/null || true
9494
cp -f $MR_BUILD_SOURCE/libavutil/internal.h $MR_BUILD_PREFIX/include/libavutil/
9595
cp -f $MR_BUILD_SOURCE/libavutil/libm.h $MR_BUILD_PREFIX/include/libavutil/
96-
[ -e $MR_BUILD_SOURCE/libavutil/attributes_internal.h ] && cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/
96+
cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/ &> /dev/null || true
9797
cp -f $MR_BUILD_SOURCE/libavcodec/mathops.h $MR_BUILD_PREFIX/include/libavcodec/
9898

9999
mkdir -p $MR_BUILD_PREFIX/include/libavcodec/x86/
100100
cp -f $MR_BUILD_SOURCE/libavcodec/x86/mathops.h $MR_BUILD_PREFIX/include/libavcodec/x86/
101101
mkdir -p $MR_BUILD_PREFIX/include/libavutil/x86/
102102
cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/
103103
#copy private header for hls.c
104-
cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/
105-
cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/
106-
cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/
104+
cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true
105+
cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true
106+
cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true

0 commit comments

Comments
 (0)