脚本bug修改

ffmpeg_4.4.2
luoye 2 years ago
parent 5600c0d755
commit c7a2f689cd
  1. 22
      .github/workflows/compilability_check.yml
  2. 1
      .gitignore
  3. 9
      README.md
  4. BIN
      images/all_branch.png
  5. BIN
      images/all_lib.png
  6. BIN
      images/output_structure.png
  7. 20
      scripts/ffmpeg/build.sh

@ -1,22 +0,0 @@
name: Compilability check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
abi: [ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Setup the environment
run: |
sudo pip3 install meson==1.0.1
sudo apt-get install nasm ninja-build
- name: Executing the script
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME
./ffmpeg-android-maker.sh -all-free -all-gpl -android=21 -abis=${{ matrix.abi }}

1
.gitignore vendored

@ -1,5 +1,4 @@
build build
output
sources sources
stats stats
.DS_Store .DS_Store

@ -5,7 +5,14 @@
[![Android Weekly #378](https://androidweekly.net/issues/issue-378/badge)](https://androidweekly.net/issues/issue-378) [![Android Weekly #378](https://androidweekly.net/issues/issue-378/badge)](https://androidweekly.net/issues/issue-378)
[![Android Weekly #396](https://androidweekly.net/issues/issue-396/badge)](https://androidweekly.net/issues/issue-396) [![Android Weekly #396](https://androidweekly.net/issues/issue-396/badge)](https://androidweekly.net/issues/issue-396)
<img src="https://github.com/Javernaut/ffmpeg-android-maker/blob/master/images/output_structure.png" width="280" align="right">
这个工程是基于[ffmpeg-android-maker](https://github.com/Javernaut/ffmpeg-android-maker) 修改而来,在此基础上把多个SO合并成了一个SO, 并且裁剪了很多Android日常开发不需要的库,目前SO大小为6M,最低可以裁剪到2M左右,有需要的可以自己裁剪,默认编译了FFmpeg 6.0.0,5.1.1, 4.4.2, 3.4.8,以及集成了libmp3lame,libx264并上传到了github上,大家可以直接使用
This project is based on [ffmpeg-android-maker](https://github.com/Javernaut/ffmpeg-android-maker) with modifications. On this basis, multiple dynamic link libraries (SO) are merged into one and many unnecessary libraries for Android daily development are trimmed. The current size of the SO is 6MB, which can be further trimmed to about 2MB according to specific needs. FFmpeg versions including 6.0.0, 5.1.1, 4.4.2, and 3.4.8 are compiled by default, and libmp3lame and libx264 are integrated. This project has been uploaded to Github for direct use.
<img src="https://github.com/bookzhan/ffmpeg-android-build/blob/master/images/all_branch.png" width="280" align="right">
<img src="https://github.com/bookzhan/ffmpeg-android-build/blob/master/images/all_lib.png" width="280" align="right">
Here is a script that downloads the source code of [FFmpeg](https://www.ffmpeg.org) library and assembles it for Android. The script produces shared libraries (\*.so files) as well as header files (\*.h files). The output structure is represented in the image. Here is a script that downloads the source code of [FFmpeg](https://www.ffmpeg.org) library and assembles it for Android. The script produces shared libraries (\*.so files) as well as header files (\*.h files). The output structure is represented in the image.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

@ -3,10 +3,16 @@
case $ANDROID_ABI in case $ANDROID_ABI in
x86) x86)
# Disabling assembler optimizations, because they have text relocations # Disabling assembler optimizations, because they have text relocations
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-asm" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm"
;; ;;
x86_64) x86_64)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --x86asmexe=${FAM_YASM}" EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-neon --disable-asm"
;;
armeabi-v7a)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm"
;;
arm64-v8a)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-neon --disable-asm --enable-inline-asm"
;; ;;
esac esac
@ -40,7 +46,7 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
--nm=${FAM_NM} \ --nm=${FAM_NM} \
--ranlib=${FAM_RANLIB} \ --ranlib=${FAM_RANLIB} \
--strip=${FAM_STRIP} \ --strip=${FAM_STRIP} \
--extra-cflags="-O3 -fPIC $DEP_CFLAGS" \ --extra-cflags="-O3 -fPIC -lm -lz -landroid $DEP_CFLAGS" \
--extra-ldflags="$DEP_LD_FLAGS" \ --extra-ldflags="$DEP_LD_FLAGS" \
--disable-shared \ --disable-shared \
--enable-static \ --enable-static \
@ -168,7 +174,7 @@ done
echo EXTERNAL_STATIC_LIB_PATH=${EXTERNAL_STATIC_LIB_PATH} echo EXTERNAL_STATIC_LIB_PATH=${EXTERNAL_STATIC_LIB_PATH}
${FAM_CC} -shared -o ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} \ ${FAM_CC} -shared -o ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} \
-Wl,--whole-archive,-Bsymbolic \ -Wl,--whole-archive \
${EXTERNAL_STATIC_LIB_PATH}\ ${EXTERNAL_STATIC_LIB_PATH}\
${STATIC_LIB_DIR}/libavutil.a \ ${STATIC_LIB_DIR}/libavutil.a \
${STATIC_LIB_DIR}/libavcodec.a \ ${STATIC_LIB_DIR}/libavcodec.a \
@ -176,7 +182,11 @@ ${FAM_CC} -shared -o ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} \
${STATIC_LIB_DIR}/libswresample.a \ ${STATIC_LIB_DIR}/libswresample.a \
${STATIC_LIB_DIR}/libavformat.a \ ${STATIC_LIB_DIR}/libavformat.a \
${STATIC_LIB_DIR}/libswscale.a \ ${STATIC_LIB_DIR}/libswscale.a \
-Wl,--no-whole-archive -Wl,--no-whole-archive -lm -lz -landroid
OUTPUT_CONFIG_HEADERS_DIR=${OUTPUT_DIR}/include/${ANDROID_ABI}
mkdir -p ${OUTPUT_CONFIG_HEADERS_DIR}
cp config.h ${OUTPUT_CONFIG_HEADERS_DIR}/config.h
${FAM_STRIP} --strip-unneeded ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME} ${FAM_STRIP} --strip-unneeded ${STATIC_LIB_DIR}/${OUTPUT_SO_NAME}

Loading…
Cancel
Save