[FFmpeg-user] compiling for android

Patrick Shirkey pshirkey at boosthardware.com
Tue Jul 8 19:55:24 CEST 2014


Hi,

I have successfully compiled  and run ffmpeg and ffserver on my
android-4.4 device
using the ffmpeg4android scripts here:

http://sourceforge.net/projects/ffmpeg4android/

I am now trying to get x264 included so I can run ffserver with h264 encoding
enabled.

I am running into two problems.

1:  Using the scripts above the build fails when trying to link the
executables. I suspect this is because it is looking for the static lib in
"out/target/product/wing-k70/obj/STATIC_LIBRARIES/x264_intermediates" or
similar.

====
target StaticLib: libswresample-2.2.git
(out/target/product/wing-k70/obj/STATIC_LIBRARIES/libswresample-2.2.git_intermediates/libswresample-2.2.git.a)
target StaticLib: libavutil-2.2.git
(out/target/product/wing-k70/obj/STATIC_LIBRARIES/libavutil-2.2.git_intermediates/libavutil-2.2.git.a)
target StaticLib: libswscale-2.2.git
(out/target/product/wing-k70/obj/STATIC_LIBRARIES/libswscale-2.2.git_intermediates/libswscale-2.2.git.a)
target StaticLib: libpostproc-2.2.git
(out/target/product/wing-k70/obj/STATIC_LIBRARIES/libpostproc-2.2.git_intermediates/libpostproc-2.2.git.a)
target Executable: ffprobe-static-2.2.git
(out/target/product/wing-k70/obj/EXECUTABLES/ffprobe-static-2.2.git_intermediates/LINKED/ffprobe-static-2.2.git)
target Executable: ffmpeg-static-2.2.git
(out/target/product/wing-k70/obj/EXECUTABLES/ffmpeg-static-2.2.git_intermediates/LINKED/ffmpeg-static-2.2.git)
target Executable: ffserver-static-2.2.git
(out/target/product/wing-k70/obj/EXECUTABLES/ffserver-static-2.2.git_intermediates/LINKED/ffserver-static-2.2.git)
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:748: error:
undefined reference to 'x264_bit_depth'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:308: error:
undefined reference to 'x264_encoder_close'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:169: error:
undefined reference to 'x264_picture_init'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:189: error:
undefined reference to 'x264_encoder_reconfig'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:195: error:
undefined reference to 'x264_encoder_reconfig'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:202: error:
undefined reference to 'x264_encoder_reconfig'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:222: error:
undefined reference to 'x264_encoder_reconfig'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:267: error:
undefined reference to 'x264_encoder_encode'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:267: error:
undefined reference to 'x264_encoder_encode'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:273: error:
undefined reference to 'x264_encoder_delayed_frames'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:133: error:
undefined reference to 'x264_bit_depth'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:371: error:
undefined reference to 'x264_param_default'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:378: error:
undefined reference to 'x264_param_default_preset'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:400: error:
undefined reference to 'x264_param_parse'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:430: error:
undefined reference to 'x264_param_parse'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:507: error:
undefined reference to 'x264_param_parse'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:508: error:
undefined reference to 'x264_param_parse'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:561: error:
undefined reference to 'x264_param_apply_fastfirstpass'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:592: error:
undefined reference to 'x264_param_apply_profile'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:676: error:
undefined reference to 'x264_encoder_open_142'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:689: error:
undefined reference to 'x264_encoder_headers'
external/ffmpeg-HEAD-7558e55.android/libavcodec/libx264.c:708: error:
undefined reference to 'x264_levels'
collect2: error: ld returned 1 exit status
make: ***
[out/target/product/wing-k70/obj/EXECUTABLES/ffserver-static-2.2.git_intermediates/LINKED/ffserver-static-2.2.git]
Error 1
make: *** Waiting for unfinished jobs....
====

2:  Using the standard build method

    ./configure;make

I cannot get past the error for sincos/sincosf which is not accessible in
the default NDK libm.a. I am not sure how to go about building ffmpeg
against Bionic. I have tried a few tricks but they all fail for me.

libavcodec/aacps_tablegen.h:153: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:154: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:166: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:166: error: undefined reference to 'sincosf'
collect2: error: ld returned 1 exit status
make: *** [ffprobe_g] Error 1

 - I have tried many different methods to beat the issue with various
configuration commands/combinations but it seems I will have to hard code
those functions into ffmpeg.

I have set these flags :

 --extra-cflags='-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon
-D_GNU_SOURCE -fno-builtin-sin -fno-builtin-cos -std=c99'

- I have also tried -DGNU_SOURCE


--
Patrick Shirkey
Boost Hardware Ltd


More information about the ffmpeg-user mailing list