@@ -9,7 +9,6 @@ FFMPEG_VERSION="7.1"
99# Use current directory
1010WORK_DIR=$( pwd)
1111echo " Working directory: $WORK_DIR "
12- echo " Build started at: 2025-03-28 11:45:31 by husen-hn"
1312echo " FFmpeg version: $FFMPEG_VERSION "
1413
1514# Clean old build if exists
@@ -27,11 +26,11 @@ if [ -f "ffmpeg-${FFMPEG_VERSION}.tar.bz2" ]; then
2726 }
2827else
2928 echo " Error: ffmpeg-${FFMPEG_VERSION} .tar.bz2 not found!"
30- echo " Please download FFmpeg 7.1 from:"
31- echo " https://ffmpeg.org/releases/ffmpeg-7.1 .tar.bz2"
29+ echo " Please download FFmpeg ${FFMPEG_VERSION} from:"
30+ echo " https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION} .tar.bz2"
3231 echo " "
3332 echo " You can download it using:"
34- echo " wget https://ffmpeg.org/releases/ffmpeg-7.1 .tar.bz2"
33+ echo " wget https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION} .tar.bz2"
3534 exit 1
3635fi
3736
@@ -89,38 +88,42 @@ function build_ffmpeg
8988 ./configure \
9089 --prefix=$PREFIX \
9190 --enable-shared \
91+ --enable-pic \
92+ --enable-jni \
93+ --enable-mediacodec \
94+ --enable-neon \
95+ --enable-hwaccels \
96+ --enable-gpl \
97+ --enable-postproc \
98+ --enable-small \
99+ --enable-version3 \
100+ --enable-nonfree \
101+ --enable-protocols \
102+ --enable-cross-compile \
103+ --enable-encoders \
104+ --enable-decoders \
105+ --enable-demuxers \
106+ --enable-muxers \
107+ --enable-filters \
108+ --enable-bsfs \
109+ --enable-indevs \
110+ --enable-outdevs \
111+ --enable-network \
112+ --enable-ffmpeg \
113+ --enable-ffprobe \
114+ --disable-ffplay \
92115 --disable-static \
116+ --disable-debug \
93117 --disable-doc \
94- --disable-programs \
95- --disable-everything \
96- --disable-vulkan \
97- --disable-ffmpeg \
98- --disable-ffplay \
99- --disable-ffprobe \
100- --disable-avdevice \
101- --disable-devices \
102- --disable-hwaccels \
103- --disable-dxva2 \
104- --disable-vaapi \
105- --disable-vdpau \
106- --enable-protocol=file \
107- --enable-decoder=h264,aac,mp3 \
108- --enable-encoder=libx264,aac \
109- --enable-parser=h264,aac \
110- --enable-demuxer=mov,mp4,matroska \
111- --enable-muxer=mp4,matroska \
112- --enable-gpl \
113- --enable-pic \
114118 --cross-prefix=$CROSS_PREFIX \
115119 --target-os=android \
116120 --arch=$ARCH \
117121 --cpu=$CPU \
118122 --cc=$CC \
119123 --cxx=$CXX \
120- --enable-cross-compile \
121124 --sysroot=$TOOLCHAIN /sysroot \
122- --extra-cflags=" -Os -fpic " \
123- --extra-ldflags=" " || {
125+ --extra-cflags=" -O3 -fPIC " \
126+ --extra-ldflags=" -L $PREFIX /lib " || {
124127 echo " Configure failed for $ABI "
125128 return 1
126129 }
149152 fi
150153done
151154
152- # Copy .so files to the project
153- PROJECT_LIBS =" $WORK_DIR /android/project_libs "
154- mkdir -p $PROJECT_LIBS
155+ # Copy binaries and libraries
156+ PROJECT_OUTPUT =" $WORK_DIR /android/project_output "
157+ mkdir -p $PROJECT_OUTPUT
155158
156- # Copy only for specified architectures
159+ # Copy for each architecture
157160for ABI in armeabi-v7a arm64-v8a x86_64
158161do
159- ABI_LIBS=" $PROJECT_LIBS /$ABI "
160- mkdir -p $ABI_LIBS
161- cp $WORK_DIR /android/$ABI /lib/* .so $ABI_LIBS / || {
162+ ABI_DIR=" $PROJECT_OUTPUT /$ABI "
163+ mkdir -p $ABI_DIR /{lib,bin}
164+
165+ # Copy shared libraries
166+ echo " Copying shared libraries for $ABI ..."
167+ cp $WORK_DIR /android/$ABI /lib/* .so $ABI_DIR /lib/ || {
162168 echo " Failed to copy .so files for $ABI "
163169 exit 1
164170 }
171+
172+ # Copy ffmpeg binary
173+ echo " Copying ffmpeg binary for $ABI ..."
174+ if [ -f " $WORK_DIR /android/$ABI /bin/ffmpeg" ]; then
175+ cp $WORK_DIR /android/$ABI /bin/ffmpeg $ABI_DIR /bin/ && chmod +x $ABI_DIR /bin/ffmpeg
176+ else
177+ echo " Warning: ffmpeg binary not found for $ABI "
178+ fi
179+
180+ # Copy ffprobe binary
181+ echo " Copying ffprobe binary for $ABI ..."
182+ if [ -f " $WORK_DIR /android/$ABI /bin/ffprobe" ]; then
183+ cp $WORK_DIR /android/$ABI /bin/ffprobe $ABI_DIR /bin/ && chmod +x $ABI_DIR /bin/ffprobe
184+ else
185+ echo " Warning: ffprobe binary not found for $ABI "
186+ fi
165187done
166188
167- echo " Build completed! .so files are in $PROJECT_LIBS "
189+ echo " Build completed! Output is in $PROJECT_OUTPUT "
168190echo " Built architectures: armeabi-v7a arm64-v8a x86_64"
169- echo " FFmpeg version: $FFMPEG_VERSION "
191+ echo " FFmpeg version: $FFMPEG_VERSION "
192+
193+ # Create version info file
194+ cat > " $PROJECT_OUTPUT /build_info.txt" << EOF
195+ FFmpeg Android Build Information
196+ Github: https://github.com/husen-hn/ffmpeg-android-binary
197+ ==============================
198+ Version: $FFMPEG_VERSION
199+
200+ Architectures:
201+ - armeabi-v7a
202+ - arm64-v8a
203+ - x86_64
204+
205+ Features:
206+ - All encoders and decoders
207+ - All muxers and demuxers
208+ - All protocols
209+ - Hardware acceleration
210+ - Network support
211+ - FFmpeg and FFprobe included
212+ - MediaCodec support
213+ - NEON optimization
214+
215+ Components:
216+ 1. Shared Libraries (.so files):
217+ - libavcodec
218+ - libavdevice
219+ - libavfilter
220+ - libavformat
221+ - libavutil
222+ - libpostproc
223+ - libswresample
224+ - libswscale
225+
226+ 2. Executables:
227+ - ffmpeg
228+ - ffprobe
229+ EOF
230+
231+ # Create directory structure info
232+ echo -e " \nDirectory Structure:" >> " $PROJECT_OUTPUT /build_info.txt"
233+ if command -v tree > /dev/null; then
234+ tree $PROJECT_OUTPUT >> " $PROJECT_OUTPUT /build_info.txt"
235+ else
236+ find $PROJECT_OUTPUT -type f >> " $PROJECT_OUTPUT /build_info.txt"
237+ fi
238+
239+ echo " Build information has been saved to $PROJECT_OUTPUT /build_info.txt"
0 commit comments