Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
@@ -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()
19 changes: 19 additions & 0 deletions pythonforandroid/recipes/ffmpeg/settings.patch
Original file line number Diff line number Diff line change
@@ -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)