diff --git a/pythonforandroid/recipes/ffmpeg/__init__.py b/pythonforandroid/recipes/ffmpeg/__init__.py new file mode 100644 index 0000000000..221a33af9e --- /dev/null +++ b/pythonforandroid/recipes/ffmpeg/__init__.py @@ -0,0 +1,43 @@ +from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory +from os.path import join, exists +import sh + +""" +FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+) + +http://writingminds.github.io/ffmpeg-android/ +""" +class FFMpegRecipe(Recipe): + + version = 'master' + url = 'git+https://github.com/WritingMinds/ffmpeg-android.git' + patches = ['settings.patch'] + + + def should_build(self, arch): + return not exists(self.get_build_bin(arch)) + + + def build_arch(self, arch): + super(FFMpegRecipe, self).build_arch(arch) + env = self.get_recipe_env(arch) + build_dir = self.get_build_dir(arch.arch) + with current_directory(build_dir): + bash = sh.Command('bash') + shprint(bash, 'init_update_libs.sh') + shprint(bash, 'android_build.sh', _env=env) + + + def get_build_bin(self, arch): + build_dir = self.get_build_dir(arch.arch) + return join(build_dir, 'build', arch.arch, 'bin', 'ffmpeg') + + + def get_recipe_env(self, arch): + env = super(FFMpegRecipe, self).get_recipe_env(arch) + env['ANDROID_NDK'] = self.ctx.ndk_dir + env['ANDROID_API'] = str(self.ctx.android_api) + return env + + +recipe = FFMpegRecipe() \ No newline at end of file diff --git a/pythonforandroid/recipes/ffmpeg/settings.patch b/pythonforandroid/recipes/ffmpeg/settings.patch new file mode 100644 index 0000000000..8e3181cf7f --- /dev/null +++ b/pythonforandroid/recipes/ffmpeg/settings.patch @@ -0,0 +1,19 @@ +--- ffmpeg/settings.sh 2016-04-27 18:50:16.294291099 +0200 ++++ ffmpeg-patch/settings.sh 2016-04-27 18:55:07.085398617 +0200 +@@ -1,13 +1,13 @@ + #!/bin/bash + +-SUPPORTED_ARCHITECTURES=(armeabi-v7a armeabi-v7a-neon x86) ++SUPPORTED_ARCHITECTURES=(${ARCH}) + ANDROID_NDK_ROOT_PATH=${ANDROID_NDK} + if [[ -z "$ANDROID_NDK_ROOT_PATH" ]]; then + echo "You need to set ANDROID_NDK environment variable, please check instructions" + exit + fi +-ANDROID_API_VERSION=9 +-NDK_TOOLCHAIN_ABI_VERSION=4.8 ++ANDROID_API_VERSION=${ANDROID_API} ++NDK_TOOLCHAIN_ABI_VERSION=${TOOLCHAIN_VERSION} + + NUMBER_OF_CORES=$(nproc) + HOST_UNAME=$(uname -m)