|
1 | 1 | # Android FFmpeg Builder |
2 | | -A robust shell script to build FFmpeg libraries for Android. This script automatically builds FFmpeg shared libraries (.so files) for multiple Android architectures. |
3 | 2 |
|
4 | | -## Current Features |
5 | | -- Builds FFmpeg version 7.1 for Android |
6 | | -- Supports multiple architectures (armeabi-v7a, arm64-v8a, x86_64) |
7 | | -- Minimal configuration focusing on core video/audio functionality |
8 | | -- Optimized for size and performance |
9 | | -- Automated build process |
10 | | -- Pre-built binaries available in releases |
| 3 | +🎬 Automated FFmpeg shared library and binary builder for Android. This script builds FFmpeg with full codec support and hardware acceleration for multiple Android architectures. |
11 | 4 |
|
12 | | -## Prerequisites |
| 5 | +[](LICENSE) |
| 6 | +[](https://ffmpeg.org/releases/ffmpeg-7.1.tar.bz2) |
| 7 | +[](https://github.com/husen-hn/ffmpeg-android-binary/commits/main) |
| 8 | +[](https://github.com/husen-hn/ffmpeg-android-binary/releases/latest) |
| 9 | + |
| 10 | +## 🚀 Features |
| 11 | + |
| 12 | +- FFmpeg 7.1 with full codec and format support |
| 13 | +- Supported architectures: |
| 14 | + - arm64-v8a |
| 15 | + - armeabi-v7a |
| 16 | + - x86_64 |
| 17 | +- Hardware acceleration enabled |
| 18 | +- MediaCodec support |
| 19 | +- NEON optimization |
| 20 | +- Network capabilities |
| 21 | +- All encoders and decoders |
| 22 | +- All muxers and demuxers |
| 23 | +- All protocols enabled |
| 24 | +- ffmpeg and ffprobe binaries included |
| 25 | + |
| 26 | +## 📋 Prerequisites |
13 | 27 |
|
14 | 28 | ### Required Tools |
| 29 | + |
15 | 30 | - Android NDK |
16 | 31 | - Build essentials (gcc, make) |
17 | 32 | - YASM/NASM assembler |
18 | 33 | - wget |
19 | 34 | - pkg-config |
20 | 35 |
|
21 | 36 | On Ubuntu/Debian: |
| 37 | + |
22 | 38 | ```bash |
23 | | -sudo apt-get update |
24 | | -sudo apt-get install build-essential gcc make yasm nasm pkg-config wget |
| 39 | +sudo apt-get update && sudo apt-get install -y \ |
| 40 | + build-essential \ |
| 41 | + gcc \ |
| 42 | + make \ |
| 43 | + yasm \ |
| 44 | + nasm \ |
| 45 | + pkg-config \ |
| 46 | + wget |
25 | 47 | ``` |
26 | 48 |
|
27 | 49 | On macOS: |
| 50 | + |
28 | 51 | ```bash |
29 | 52 | brew install automake yasm nasm pkg-config wget |
30 | 53 | ``` |
31 | 54 |
|
32 | | -Android NDK Setup |
| 55 | +### Android NDK Setup |
| 56 | + |
33 | 57 | 1. Download Android NDK from [Android's NDK page](https://developer.android.com/ndk/downloads) |
34 | 58 | 2. Extract it to a location (default: `/opt/android-ndk`) |
35 | 59 | 3. Update the `ANDROID_NDK_HOME` variable in the script if your NDK is installed elsewhere |
| 60 | +4. Ensure NDK toolchain is accessible |
| 61 | + |
| 62 | +## 🛠️ Usage |
| 63 | + |
| 64 | +1. Clone the repository: |
36 | 65 |
|
37 | | -## Usage |
38 | | -1. Clone this repository: |
39 | 66 | ```bash |
40 | 67 | git clone https://github.com/husen-hn/android-ffmpeg-builder.git |
41 | 68 | cd android-ffmpeg-builder |
42 | 69 | ``` |
43 | 70 |
|
44 | 71 | 2. Make the script executable: |
| 72 | + |
45 | 73 | ```bash |
46 | 74 | chmod +x build_ffmpeg.sh |
47 | 75 | ``` |
48 | 76 |
|
49 | 77 | 3. Run the script: |
| 78 | + |
50 | 79 | ```bash |
51 | 80 | ./build_ffmpeg.sh |
52 | 81 | ``` |
53 | 82 |
|
54 | | -The built libraries will be in `android/project_libs/`: |
| 83 | +## 📚 Output Structure |
| 84 | + |
55 | 85 | ``` |
56 | | -android/project_libs/ |
| 86 | +android/project_output/ |
57 | 87 | ├── arm64-v8a/ |
58 | | -│ ├── libavcodec.so |
59 | | -│ ├── libavformat.so |
60 | | -│ ├── libavutil.so |
61 | | -│ ├── libswresample.so |
62 | | -│ └── libswscale.so |
| 88 | +│ ├── bin/ |
| 89 | +│ │ ├── ffmpeg |
| 90 | +│ │ └── ffprobe |
| 91 | +│ └── lib/ |
| 92 | +│ ├── libavcodec.so |
| 93 | +│ ├── libavdevice.so |
| 94 | +│ ├── libavfilter.so |
| 95 | +│ ├── libavformat.so |
| 96 | +│ ├── libavutil.so |
| 97 | +│ ├── libpostproc.so |
| 98 | +│ ├── libswresample.so |
| 99 | +│ └── libswscale.so |
63 | 100 | ├── armeabi-v7a/ |
64 | | -└── x86_64/ |
| 101 | +├── x86_64/ |
| 102 | +└── build_info.txt |
65 | 103 | ``` |
66 | 104 |
|
67 | | -## Configurations |
68 | | -The script builds FFmpeg with these configurations: |
| 105 | +## 🔧 Configurations |
| 106 | + |
| 107 | +The script builds FFmpeg with these features: |
| 108 | + |
69 | 109 | - Shared libraries enabled |
70 | | -- Static libraries disabled |
71 | | -- Documentation disabled |
72 | | -- Programs (ffmpeg, ffplay, ffprobe) disabled |
73 | | -- Hardware acceleration disabled |
74 | | -- Minimal codec support (h264, aac, mp3) |
75 | | -- File protocol support |
76 | | -- MP4 and MKV container support |
77 | | - |
78 | | -## License |
79 | | -This project is licensed under the GNU Lesser General Public Version 3 License - see the [LICENSE](./LICENSE) file for details. |
| 110 | +- Hardware acceleration |
| 111 | +- MediaCodec support |
| 112 | +- NEON optimization |
| 113 | +- Network support |
| 114 | +- All codecs and formats |
| 115 | +- Debug symbols stripped |
| 116 | +- Size-optimized binaries |
| 117 | + |
| 118 | +## 📦 Releases & Pre-built Binaries |
| 119 | + |
| 120 | +### Latest Release |
| 121 | + |
| 122 | +[](https://github.com/husen-hn/ffmpeg-android-binary/releases/latest) |
| 123 | + |
| 124 | +Pre-built binaries are available in the [Releases](https://github.com/husen-hn/ffmpeg-android-binary/releases) section. Each release includes: |
| 125 | + |
| 126 | +- Built `.so` files for all supported architectures (arm64-v8a, armeabi-v7a, x86_64) |
| 127 | +- ffmpeg and ffprobe binaries |
| 128 | +- Build information and checksums |
| 129 | +- Source code archive |
| 130 | + |
| 131 | +## 🔄 Updating FFmpeg Version |
| 132 | + |
| 133 | +1. Update the version in `build_ffmpeg.sh`: |
| 134 | + |
| 135 | +```bash |
| 136 | +# Change this line |
| 137 | +FFMPEG_VERSION="7.1" |
| 138 | +``` |
| 139 | + |
| 140 | +2. Download the new FFmpeg source: |
| 141 | + |
| 142 | +```bash |
| 143 | +wget https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 |
| 144 | +``` |
| 145 | + |
| 146 | +3. Clean old build files: |
| 147 | + |
| 148 | +```bash |
| 149 | +rm -rf ffmpeg-* |
| 150 | +rm -rf android/project_output/* |
| 151 | +``` |
| 152 | + |
| 153 | +4. Run the build script: |
| 154 | + |
| 155 | +```bah |
| 156 | +./build_ffmpeg.sh |
| 157 | +``` |
| 158 | + |
| 159 | +## 📜 License |
| 160 | + |
| 161 | +This project is licensed under the GNU Lesser General Public Version 3 License - see the [LICENSE](./LICENSE) file for details. |
0 commit comments