/ffmpeg-android-kotlin

FFmpeg for Android compiled with LGPL license, openh264 & aac encoding only (Supports Android 4.1+), contains Kotlin wrapper module

Primary LanguageKotlin

Android FFmpeg-openh264 converter

  • FFmpeg for Android compiled (encoders: aac & openh264)
  • Supports Android N
  • kotlin wrapper for FFmpeg (task queue)

Supported Architecture

Supported Host Environments

  • MacOS
  • Linux
  • Windows10 Linux Subsystem (NOTE: you have to set ANDROID_NDK_ROOT to LINUX version of Android SDK / NDK / build tools)

FFmpeg, openh2664 build instructions

  • Set environment variable default: ~/Android/Sdk/ndk-bundle
    or set it manually: export ANDROID_NDK_ROOT={Android NDK Base Path}
  • Run following commands to compile ffmpeg
    1. sudo apt-get --quiet --yes install build-essential git autoconf libtool pkg-config gperf gettext yasm python-lxml nasm
    2. ./update_modules.sh - update submodules and libraries
    3. ./build_android.sh - build ffmpeg & libopenh264
  • Find the executable binary in build/{arch}/bin directory.

Docker build instructions

The binaries can be built from a docker container using the included Dockerfile. This sets the version of the NDK to an older, known-working version.

./docker_build.sh will build the ffmpeg binaries (including openh264)

Kotlin wrapper module instructions

  1. import ffmpegandroid module
  2. put your ffmpeg & libopenh264.so into kotlin-wrapper/ffmpegandroid/ffmpeg
  3. replace
  compile project(path: ':ffmpegandroid')

with

  debugCompile project(path: ':ffmpegandroid', configuration: "debug") // force compile debug module
  releaseCompile project(path: ':ffmpegandroid', configuration: "release")

in your app build.gradle file (dependencies section)

  1. usage example

Licenses

  • FFmpeg: LGPL 3.0
  • openh264: BSD
  • kotlin wrapper: MIT
  • build scripts: MIT

Info

Inspired by WritingMinds java forks