Skip to content
Permalink
Browse files

build and include freetype2 by default to enable the 'drawtext' filter

* ffmpeg's ./configure requires the use of pkg-config for detecting if
  external libraries are present. Since we're not installing these
  cross-compiled versions, we need to make a fake pkg-config to trick
  ffmpeg's ./configure.
  • Loading branch information...
eighthave committed Aug 25, 2012
1 parent 4b4b4f6 commit f08db49e613a7ea4423effb22973e3f1afefb819
Showing with 70 additions and 1 deletion.
  1. +13 −1 README.txt
  2. +4 −0 clean.sh
  3. +3 −0 configure_ffmpeg.sh
  4. +2 −0 configure_freetype2.sh
  5. +2 −0 configure_make_everything.sh
  6. +16 −0 enable-fake-pkg-config.patch
  7. +24 −0 fake-pkg-config
  8. +6 −0 make_freetype2.sh
@@ -8,7 +8,7 @@ setup
-----

1. Install the Android NDK r8 or newer
2. On Debian/Ubuntu, run: apt-get install yasm bash patch make
2. On Debian/Ubuntu, run: apt-get install yasm bash patch make gawk


building
@@ -73,3 +73,15 @@ testing
-acodec copy \
-vcodec libx264 -b:v 1000k -an -f mp4 \
-y /tmp/output.mp4

# drawtext test
./ffmpeg \
-i test.mp4 \
-fflags +genpts -t 600 -r 8 -s 640x480 \
-vf drawtext="fontfile=DejaVuSans.ttf:x=70:y=455: \
text='\%H\:\%M\:\%S | \%a \%d/\%b/\%Y | S500ATV | camera 0': \
fontcolor=0xFFFFFFFF:fontsize=18: \
shadowcolor=0x000000EE:shadowx=1:shadowy=1" \
-b:v 1500000 -r 8 \
-acodec copy \
-y video_file.mp4
@@ -7,6 +7,10 @@ find . -name \*.o -delete
pushd x264
make clean

popd
pushd freetype2
make clean

popd
pushd ffmpeg
make clean
@@ -17,6 +17,8 @@ patch -d ffmpeg -N -p1 --reject-file=- < \
ARM_generate_position_independent_code_to_access_data_symbols.patch
patch -d ffmpeg -N -p1 --reject-file=- < \
ARM_intmath_use_native-size_return_types_for_clipping_functions.patch
patch -d ffmpeg -N -p1 --reject-file=- < \
enable-fake-pkg-config.patch

pushd ffmpeg

@@ -98,6 +100,7 @@ $DEBUG_FLAG \
\
--enable-filters \
--enable-avresample \
--enable-libfreetype \
\
--disable-indevs \
--enable-indev=lavfi \
@@ -9,9 +9,11 @@ pushd freetype2
./configure \
CC="$CC" \
LD="$LD" \
CFLAGS="-std=gnu99 -mcpu=cortex-a8 -marm -mfloat-abi=softfp -mfpu=neon" \
--host=$HOST \
--with-sysroot="$NDK_SYSROOT" \
--enable-static \
--disable-shared \
--without-bzip2

popd;popd
@@ -7,5 +7,7 @@ function die {
./clean.sh
./configure_x264.sh || die "X264 configure"
./make_x264.sh || die "X264 make"
./configure_freetype2.sh || die "freetype2 configure"
./make_freetype2.sh || die "freetype2 make"
./configure_ffmpeg.sh || die "FFMPEG configure"
./make_ffmpeg.sh || die "FFMPEG make"
@@ -0,0 +1,16 @@
diff --git a/configure b/configure
index 4e1a611..34c6d27 100755
--- a/configure
+++ b/configure
@@ -2106,6 +2106,11 @@ set_default cc cxx nm pkg_config strip sysinclude yasmexe
enabled cross_compile || host_cc_default=$cc
set_default host_cc

+# hack because the Android NDK does not provide pkg-config, and ffmpeg
+# requires pkg-config for configuring when building against external
+# libraries.
+pkg_config=../fake-pkg-config
+
if ! $pkg_config --version >/dev/null 2>&1; then
warn "$pkg_config not found, library detection may fail."
pkg_config=false
@@ -0,0 +1,24 @@
#!/bin/sh
#
# this is a fake pkg-config since ffmpeg requires pkg-config if you want to
# include external libraries like libfreetype or libass. The Android NDK does
# not provide any kind of pkg-config.

case $1 in
--exists)
if [ $2 = "freetype2" ]; then
return 0
else
return 1
fi
;;
--cflags)
echo "-I../freetype2/include"
;;
--libs)
echo "-L../freetype2/objs/.libs -lfreetype"
;;
*)
echo "fake pkg-config for Android NDK build!"
;;
esac
@@ -0,0 +1,6 @@
#!/bin/bash
pushd `dirname $0`
. settings.sh
pushd freetype2
make -j4
popd;popd

0 comments on commit f08db49

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.