Skip to content

Add recipe to install ffpyplayer with many video formats support for old toolchain #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 11 additions & 0 deletions recipes/ffmpeg2/patches/fix-libshine-configure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- ./configure.orig 2016-09-19 04:41:33.000000000 +0300
+++ ./configure 2016-12-06 19:12:05.046025000 +0300
@@ -5260,7 +5260,7 @@
enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
-enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
+enabled libshine && require "shine" shine/layer3.h shine_encode_buffer -lshine
enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
102 changes: 63 additions & 39 deletions recipes/ffmpeg2/recipe.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
#!/bin/bash
# Recent change made ffmpeg2 not compatible with python-for-android yet.
# Only h264+aac build are working.

VERSION_ffmpeg2=${VERSION_ffmpeg2:-2.7.1}
VERSION_ffmpeg2=${VERSION_ffmpeg2:-2.8.8}
URL_ffmpeg2=http://ffmpeg.org/releases/ffmpeg-$VERSION_ffmpeg2.tar.bz2
DEPS_ffmpeg2=(sdl)
DEPS_OPTIONAL_ffmpeg2=(openssl)
DEPS_OPTIONAL_ffmpeg2=(openssl ffpyplayer_codecs)
MD5_ffmpeg2=
BUILD_ffmpeg2=$BUILD_PATH/ffmpeg2/$(get_directory $URL_ffmpeg2)
RECIPE_ffmpeg2=$RECIPES_PATH/ffmpeg2
ARCH_ffmpeg2=${ARCH_ffmpeg2:-armv7a}

function prebuild_ffmpeg2() {
true
cd $BUILD_ffmpeg2

if [ -f .patched ]; then
return
fi

debug $BUILD_ffmpeg2

try patch -p1 < $RECIPE_ffmpeg2/patches/fix-libshine-configure.patch

touch .patched
}

function shouldbuild_ffmpeg2() {
Expand All @@ -24,69 +32,83 @@ function shouldbuild_ffmpeg2() {
function build_ffmpeg2() {
cd $BUILD_ffmpeg2

# build ffmpeg2
export NDK=$ANDROIDNDK
push_arm

# configure
DEST=build/ffmpeg
export NDK=$ANDROIDNDK

# openssl activated ?
SSL_CFLAGS=""
SSL_LDFLAGS=""
if [ "X$BUILD_openssl" != "X" ]; then
debug "Activate flags for openssl / ffmpeg2"
SSL_CFLAGS="-I$BUILD_openssl/include/"
SSL_LDFLAGS="-L$BUILD_openssl/"
fi
DEST=build/ffmpeg

for version in $ARCH_ffmpeg2; do

FLAGS="--disable-everything"
FLAGS="$FLAGS --enable-parser=h264,aac"
FLAGS="$FLAGS --enable-decoder=h263,h264,aac"
FLAGS="$FLAGS --enable-filter=aresample,resample,crop,adelay,volume"
FLAGS="$FLAGS --enable-protocol=file,http,https,tls_openssl"
FLAGS="$FLAGS --enable-demuxer=sdp --enable-pic"
FLAGS="$FLAGS --enable-small"
FLAGS="$FLAGS --enable-hwaccels"
FLAGS="$FLAGS --disable-static --enable-shared"
# libpostproc is GPL: https://ffmpeg.org/pipermail/ffmpeg-user/2012-February/005162.html
FLAGS="$FLAGS --enable-gpl"
EXTRA_CFLAGS=""
EXTRA_LDFLAGS=""

# enable openssl if needed
# openssl
if [ "X$BUILD_openssl" != "X" ]; then
FLAGS="$FLAGS --enable-openssl --enable-nonfree"
FLAGS="$FLAGS --enable-protocol=https,tls_openssl"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$BUILD_openssl/include/"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$BUILD_openssl/"
fi

# ffpyplayer_codecs
if [ "X$BUILD_ffpyplayer_codecs" != "X" ]; then
# libx264
FLAGS="$FLAGS --enable-libx264"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$BUILD_libx264/include/"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$BUILD_libx264/lib/ -lx264"

# libshine
FLAGS="$FLAGS --enable-libshine"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$BUILD_libshine/include/"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$BUILD_libshine/lib/ -lshine"

# Enable all codecs:
FLAGS="$FLAGS --enable-parsers"
FLAGS="$FLAGS --enable-decoders"
FLAGS="$FLAGS --enable-encoders"
FLAGS="$FLAGS --enable-muxers"
FLAGS="$FLAGS --enable-demuxers"
else
# Enable codecs only for .mp4:
FLAGS="$FLAGS --enable-parser=h264,aac"
FLAGS="$FLAGS --enable-decoder=h263,h264,aac"

# disable some unused algo
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
FLAGS="$FLAGS --disable-dxva2 --disable-vdpau --disable-vaapi"
FLAGS="$FLAGS --disable-dct"
fi

# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
# /usr/bin/ld: failed to set dynamic section sizes: Bad value
FLAGS="$FLAGS --disable-symver"

# disable some unused algo
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
FLAGS="$FLAGS --disable-dxva2 --disable-vdpau --disable-vaapi"
FLAGS="$FLAGS --disable-dct"

# disable binaries / doc
FLAGS="$FLAGS --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver"
FLAGS="$FLAGS --disable-doc"

# other flags:
FLAGS="$FLAGS --enable-filter=aresample,resample,crop,adelay,volume"
FLAGS="$FLAGS --enable-protocol=file,http"
FLAGS="$FLAGS --enable-small"
FLAGS="$FLAGS --enable-hwaccels"
FLAGS="$FLAGS --enable-gpl"
FLAGS="$FLAGS --enable-pic"
FLAGS="$FLAGS --disable-static --enable-shared"

case "$version" in
x86)
EXTRA_CFLAGS="$SSL_CFLAGS"
EXTRA_LDFLAGS="$SSL_LDFLAGS"
ABI="x86"
;;
armv7a)
ARM_FLAGS="--target-os=android --cross-prefix=arm-linux-androideabi- --arch=arm"
ARM_FLAGS="$ARM_FLAGS --sysroot=$NDKPLATFORM"
FLAGS="$ARM_FLAGS $FLAGS"
FLAGS="$FLAGS --enable-neon"
EXTRA_CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fPIC -DANDROID $SSL_CFLAGS"
EXTRA_LDFLAGS="$SSL_LDFLAGS"
EXTRA_CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fPIC -DANDROID $EXTRA_CFLAGS"
ABI="armeabi-v7a"
;;
*)
Expand All @@ -99,9 +121,11 @@ function build_ffmpeg2() {

mkdir -p $DEST
make distclean

try ./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS"

make clean
try make -j4
try make -j$MAKE_JOBS
try make install

done
Expand Down
1 change: 1 addition & 0 deletions recipes/ffpyplayer/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
VERSION_ffpyplayer=${VERSION_ffpyplayer:-master}
URL_ffpyplayer=http://github.com/matham/ffpyplayer/archive/$VERSION_ffpyplayer.zip
DEPS_ffpyplayer=(python ffmpeg2)
DEPS_OPTIONAL_ffpyplayer=(openssl ffpyplayer_codecs)
MD5_ffpyplayer=
BUILD_ffpyplayer=$BUILD_PATH/ffpyplayer/$(get_directory $URL_ffpyplayer)
RECIPE_ffpyplayer=$RECIPES_PATH/ffpyplayer
Expand Down
21 changes: 21 additions & 0 deletions recipes/ffpyplayer_codecs/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

VERSION_ffpyplayer_codecs=
URL_ffpyplayer_codecs=
DEPS_ffpyplayer_codecs=(libshine libx264)
MD5_ffpyplayer_codecs=
BUILD_ffpyplayer_codecs=$BUILD_PATH/ffpyplayer_codecs/$(get_directory $URL_ffpyplayer_codecs)
RECIPE_ffpyplayer_codecs=$RECIPES_PATH/ffpyplayer_codecs

function prebuild_ffpyplayer_codecs() {
true
}

function build_ffpyplayer_codecs() {
true
}

function postbuild_ffpyplayer_codecs() {
true
}

47 changes: 47 additions & 0 deletions recipes/libshine/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

VERSION_libshine=${VERSION_libshine:-master}
URL_libshine=https://github.com/toots/shine/archive/$VERSION_libshine.zip
DEPS_libshine=()
MD5_libshine=
BUILD_libshine=$BUILD_PATH/libshine/$(get_directory $URL_libshine)
RECIPE_libshine=$RECIPES_PATH/libshine

function prebuild_libshine() {
true
}

function shouldbuild_libshine() {
if [ -f "$BUILD_libshine/lib/libshine.a" ]; then
DO_BUILD=0
fi
}

function build_libshine() {
cd $BUILD_libshine

push_arm

# configure
mkdir -p $BUILD_libshine
make distclean

try ./bootstrap

try ./configure \
--host=arm-linux \
--enable-pic \
--disable-shared \
--enable-static \
--prefix=$BUILD_libshine

make clean
try make -j$MAKE_JOBS
try make install

pop_arm
}

function postbuild_libshine() {
true
}
49 changes: 49 additions & 0 deletions recipes/libx264/recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

VERSION_libx264=${VERSION_libx264:-last_stable_x264}
URL_libx264=ftp://ftp.videolan.org/pub/x264/snapshots/$VERSION_libx264.tar.bz2
DEPS_libx264=()
MD5_libx264=
BUILD_libx264=$BUILD_PATH/libx264/$(get_directory $URL_libx264)
RECIPE_libx264=$RECIPES_PATH/libx264

function prebuild_libx264() {
true
}

function shouldbuild_libx264() {
if [ -f "$BUILD_libx264/lib/libx264.a" ]; then
DO_BUILD=0
fi
}

function build_libx264() {
cd $BUILD_libx264

push_arm

# configure
mkdir -p $BUILD_libx264
make distclean

try ./configure \
--cross-prefix=arm-linux-androideabi- \
--sysroot="$NDKPLATFORM" \
--host=arm-linux \
--disable-asm \
--disable-cli \
--enable-pic \
--disable-shared \
--enable-static \
--prefix=$BUILD_libx264

make clean
try make -j$MAKE_JOBS
try make install

pop_arm
}

function postbuild_libx264() {
true
}