GitHub - hzw1199/Android-FFmpeg-Prebuilt: Prebuilt FFmpeg binaries (ffmpeg/ffprobe executables + unified ffmpeg.so) for Android (arm64-v8a, 16kb page size), compiled with NDK r28. Ready to use.

4 min read Original article ↗

GitHub stars FFmpeg Platform ABI License

中文文档

Prebuilt FFmpeg binaries for Android — ready to use, no compilation needed.

Provides ffmpeg / ffprobe executables and a single libffmpeg.so shared library with all core modules merged in.


Features

  • FFmpeg 8.1.1 & 8.0.1 — two prebuilt versions provided, pick whichever you need
  • Android arm64-v8a (aarch64) — targeting modern 64-bit devices, minSdkVersion 28
  • Single shared librarylibffmpeg.so merges libavcodec, libavformat, libavfilter, libavutil, libavdevice, libswresample, libswscale, all 7 core libraries into one .so
  • Standalone executablesffmpeg and ffprobe can be pushed to device and run directly via shell
  • C/C++ headers included — integrate into your Android NDK project
  • Pure LGPL build--disable-gpl --disable-nonfree, safe for commercial use
  • MediaCodec hardware acceleration — H.264 / HEVC / MPEG-4 hardware decoding via Android MediaCodec
  • 16 KB page size compatible — meets Google Play's 16 KB page size requirement for apps targeting Android 15+
  • Size-optimized — built with --enable-small -Os

File Structure

Both versions share the same layout, here we use ffmpeg-8.1.1/ as an example:

ffmpeg-8.1.1/
├── bin/
│   ├── ffmpeg           # CLI executable (15 MB)
│   └── ffprobe          # CLI executable (15 MB)
├── libffmpeg.so         # Merged shared library — all 7 modules in one .so (75 MB, not stripped)
├── include/
│   ├── libavcodec/
│   ├── libavdevice/
│   ├── libavfilter/
│   ├── libavformat/
│   ├── libavutil/
│   ├── libswresample/
│   └── libswscale/
└── examples/            # Official FFmpeg example source code

The 8.0.1 build lives in ffmpeg-8.0.1/ with nearly identical file sizes.

About libffmpeg.so size (strip)

For easier debugging, the libffmpeg.so shipped in this repo keeps full symbol information and is close to 80 MB. For production / release use, you can manually strip the symbols with the NDK-bundled llvm-strip to shrink it down to about 15 MB:

# Example with NDK r28
$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/<host-tag>/bin/llvm-strip \
    --strip-unneeded \
    ffmpeg-8.1.1/libffmpeg.so

<host-tag> is darwin-x86_64 on macOS, linux-x86_64 on Linux, and windows-x86_64 on Windows.

Build Configuration

Encoders & Decoders

All LGPL-compatible encoders and decoders enabled, including MediaCodec hardware decoders:

MediaCodec Decoder Description
h264_mediacodec H.264 hardware decoding via Android MediaCodec
hevc_mediacodec HEVC hardware decoding via Android MediaCodec
mpeg4_mediacodec MPEG-4 hardware decoding via Android MediaCodec

Other Capabilities

Category Status
Muxers / Demuxers All enabled
Protocols All enabled (network included)
Filters All enabled
Parsers / BSFs All enabled
Hardware Acceleration MediaCodec + JNI enabled
iconv Enabled

libffmpeg.so Included Libraries

libffmpeg.so is linked from all 7 static libraries:

Library Description
libavdevice Device capture & playback
libavfilter Audio/video filter framework
libavcodec Audio/video codec encoding & decoding
libavformat Muxing & demuxing (container formats)
libswresample Audio resampling & format conversion
libswscale Video scaling & pixel format conversion
libavutil Common utility functions

Quick Start

Use as CLI tool on device

adb push ffmpeg-8.1.1/bin/ffmpeg /data/local/tmp/
adb shell chmod +x /data/local/tmp/ffmpeg
adb shell /data/local/tmp/ffmpeg -version

Use libffmpeg.so in Android NDK project

CMakeLists.txt

add_library(ffmpeg SHARED IMPORTED)
set_target_properties(ffmpeg PROPERTIES
    IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libffmpeg.so
)
target_include_directories(your_target PRIVATE ${CMAKE_SOURCE_DIR}/ffmpeg-8.1.1/include)
target_link_libraries(your_target ffmpeg)

Build Information

Item Value
FFmpeg Version 8.1.1, 8.0.1
Target Platform Android
Target ABI arm64-v8a (aarch64)
minSdkVersion 28 (Android 9.0)
NDK Version r28
Toolchain LLVM / Clang
License Mode LGPL-2.1 (no GPL, no non-free)
Build Type Static libs → merged shared library + standalone executables
Size Optimization --enable-small, -Os -fpic

License

This build is compiled with --disable-gpl --disable-nonfree, making it a pure LGPL-2.1 build. You may use it in proprietary / commercial applications as long as you comply with the LGPL-2.1 license terms.

This repository distributes prebuilt binaries of FFmpeg. The complete FFmpeg source code is available at:

FFmpeg includes code from many contributors. Full copyright information is available in the FFmpeg source distribution.


If this project saved your time, please consider giving it a ⭐ — it helps others find it too!