=========================================================================== FFmpeg for Android http://sourceforge.net/projects/ffmpeg4android/ Srdjan Obucina =========================================================================== =========================================================================== Introduction =========================================================================== FFmpeg for Android is a set of Android makefiles which enable configuration and building FFmpeg library using Android NDK, as part of your application. While working as a system integrator, I have come upon more than few Android ports of FFmpeg library. All of them have some non-features in common: - It is not possible to use configure script to configure the library. This may lead to invalid library configuration and output and degraded performance or feature set. - Some FFmpeg libraries are missing. Usually, only libavutil, libavcodec and libavformat are built. - FFmpeg tools (ffmpeg, ffplay, ffprobe, ffserver) are missing. - Manually added files into Android.mk, usually without proper understanding of dependencies between files and function of each file in a library. - Configuration is locked to single architecture. - The library can not be built in parallel for different target products and architectures. This is important for large test environments. - Missing or incomplete compiler and linker flags. - Building library in a "It compiles = It is working" manner. - Building library as a large single file. This project is my attempt to address these and many other issues and create makefiles for building FFmpeg library under Android source code tree which will create output as close as possible to the output of "regular" building process using standalone toolchain. These makefiles are result of combining and extending various makefiles I have found on the web and during my work. Makefiles are tested and are working fine on: Build host OS: Ubuntu 12.04 Android target OS: was tested on Android 4.0, should run on everything Architecture: was tested on arm, should also support mips and x86 SDK + NDK release: NDK-r8d, API level 14 FFmpeg releases: 1.1.2, other versions were not tested but should work =========================================================================== Features =========================================================================== - On-the-fly library configuration. FFmpeg will be configured on-the-fly, during Android building process, in accordance to the selected product, cpu architecture, cpu architecture variant, and fine tuning cpu parameters. - Configuration driven building. No need to manually add filenames to the makefiles, or hack through the library in order to get the build you want. - Per product configuration. Every TARGET_PRODUCT will have its own configuration. - Builds all libraries and tools, except ffplay. - Builds both shared and static libraries. - Builds latest releases form 0.7, 0.8, 0.9, 0.10, 0.11, 1.0, 1.1 and HEAD branches. - Supports parallel building from the same source for the different products. =========================================================================== Known issues =========================================================================== - None =========================================================================== Note =========================================================================== As number of FFmpeg branches grows, the load on my equipment for build testing becomes overwhelming. At the same time, interest in older branches, like 0.7, 0.8, 0.9, 0.10, 0.11 is slim to none. In the future, I may stop supporting branches 0.8, 0.9, 0.10 and 0.11. I will keep 0.7, because it is the last 0.6 ABI compatible. =========================================================================== Usage =========================================================================== To include this library to your Android project, do following changes: jni/Application.mk: APP_MODULES += avcodec \ avdevice \ avfilter \ avformat \ avresample \ avutil \ swresample \ swscale jni//Android.mk: LOCAL_SHARED_LIBRARIES += avcodec \ avdevice \ avfilter \ avformat \ avresample \ avutil \ swresample \ swscale LOCAL_C_INCLUDES += jni/ffmpeg/include and somewhere in Java code: // Order is important, they depend on each other String ffmpeg_libs[] = { "avutil", "avcodec", "avformat", "avresample", "swresample", "swscale", "avfilter", "avdevice" }; for(String l : ffmpeg_libs) { System.loadLibrary(l); } =========================================================================== Support =========================================================================== Since Android is changing daily, and releases are tested only on a release day, it is possible that after some time you will have issues with building FFmpeg for Android. Feel free to post on discussion board: https://sourceforge.net/p/ffmpeg4android/discussion/ Feel free to report issues: https://sourceforge.net/p/ffmpeg4android/tickets/ I will try to respond in a timely manner. =========================================================================== Plan =========================================================================== Short term plan is to test and update scripts to work on more architectures and platforms. Long term plan is to continue to provide scripts for latest FFmpeg library releases, as they appear. The Ultimate plan is to try to make scripts part of official FFmpeg library, once they are stable and robust enough. =========================================================================== License: =========================================================================== Please, note that FFmpeg library and FFmpeg for Android makefiles for building it under Android source code tree are two different projects. FFmpeg for Android makefiles are licensed under whatever license You are using FFmpeg.