├── .gitignore
├── LICENSE
├── README.md
├── bin
└── ffmpeg
└── src
├── 0_make_ndk_toolchain.sh
├── 1_download_ffmpeg.sh
├── 1_download_libvpx.sh
├── 1_download_libx264.sh
├── 2_build_libvpx_armv7.sh
├── 3_build_libx264_armv7.sh
├── 9_build_ffmpeg_armv7.sh
└── build_all.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | desktop.ini
3 | .idea
4 | ffmpeg_src
5 | *.bz2
6 | *.tgz
7 | *.so
8 | src/**/bin
9 | *test*
10 | src/**/std_toolchain
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) {{{year}}} {{{fullname}}}
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | For Android users, provide a prebuild binary file of ffmpeg 2.1.3, you can upload following file to your device and use it freely.
2 |
3 | bin/ffmpeg5 | 6 | Supported features:
4 |
8 | Accepted formats: raw image, jpg, png, H264/MP4, WebM14 | 15 | 16 | Tested Compiler Environment:
9 | Accepted protocols: pipe, file, tcp
10 | Accepted filters: resize, rotate, crop
11 |
12 | Feel free to convert between jpg,png,web,mp4 and raw video! 13 |
18 | Android NDK r8, r9, r10. Gcc 4.4.3, 4.7, 4.8, 4.9 19 |20 | Then execute:
22 | cd src25 | 26 |
23 | ./build_all.sh
24 |
27 | Mac OS X 10.7 64bit30 | -------------------------------------------------------------------------------- /bin/ffmpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjitech/ffmpeg-android/ea037eddf08d11fe2e2df027b46bc100fc80d200/bin/ffmpeg -------------------------------------------------------------------------------- /src/0_make_ndk_toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo ---------------make standard GCC Tool Chain from Android NDK-------------------- 4 | ls -d ./std_toolchain && { echo ./std_toolchain already exist; exit 0; } 5 | 6 | printenv ANDROID_NDK_ROOT > /dev/null || { echo please export ANDROID_NDK_ROOT=root_dir_of_your_android_ndk; exit 1; } 7 | 8 | PLATFORM=$(basename $(ls -d $ANDROID_NDK_ROOT/platforms/android-8)); test -z $PLATFORM && exit 1 9 | TOOLCHAIN=$(basename $(ls -d $ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-[4-5].* | tail -n 1)); test -z $TOOLCHAIN && exit 1 10 | WORK_SYSTEM=$(basename $(ls -d $ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-[4-5].*/prebuilt/* | tail -n 1)); test -z $WORK_SYSTEM && exit 1 11 | $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --install-dir=./std_toolchain --platform=$PLATFORM --toolchain=$TOOLCHAIN --system=$WORK_SYSTEM --arch=arm --verbose 12 | 13 | echo ""; echo ok; echo "" 14 | -------------------------------------------------------------------------------- /src/1_download_ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo ---------------download ffmpeg-------------------- 4 | ls -d ffmpeg_src && { echo ffmpeg_src already exist; exit 0; } 5 | ls ffmpeg-2.4.tar.bz2 || { wget http://www.ffmpeg.org/releases/ffmpeg-2.4.tar.bz2 || exit 1; } 6 | tar -xvjf ffmpeg-2.4.tar.bz2 || exit 1 7 | mv ffmpeg-2.4 ffmpeg_src || exit 1 8 | 9 | echo ""; echo ok; echo "" 10 | -------------------------------------------------------------------------------- /src/1_download_libvpx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo ---------------download libvpx-------------------- 4 | ls -d ffmpeg_src/libvpx_src && { echo ffmpeg_src/libvpx_src already exist; exit 0; } 5 | ls libvpx-v1.3.0.tar.bz2 || { wget https://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 || exit 1; } 6 | tar -xvjf libvpx-v1.3.0.tar.bz2 || exit 1 7 | mv libvpx-v1.3.0 ffmpeg_src/libvpx_src || exit 1 8 | 9 | echo ""; echo ok; echo "" 10 | -------------------------------------------------------------------------------- /src/1_download_libx264.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo ---------------download libx264-------------------- 4 | ls -d ffmpeg_src/libx264_src && { echo ffmpeg_src/libx264_src already exist; exit 0; } 5 | ls libx264.tgz || { wget -O libx264.tgz "http://git.videolan.org/?p=x264.git;a=snapshot;h=refs/heads/stable;sf=tgz" || exit 1; } 6 | rm -fr x264* 7 | tar -xvzf libx264.tgz || exit 1 8 | echo "" 9 | mv -v x264* ffmpeg_src/libx264_src || exit 1 10 | 11 | echo ""; echo ok; echo "" 12 | -------------------------------------------------------------------------------- /src/2_build_libvpx_armv7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | printenv ANDROID_NDK_ROOT > /dev/null || { echo please export ANDROID_NDK_ROOT=root_dir_of_your_android_ndk; exit 1; } 4 | 5 | cd ./ffmpeg_src/libvpx_src || { echo please download libvpx source to [./ffmpeg_src/libvpx_src]; exit 1; } 6 | 7 | echo ---------------config libvpx [armv7]-------------------- 8 | ./configure --target=armv7-android-gcc --disable-examples --disable-docs --enable-static --enable-pic --disable-realtime-only \ 9 | --sdk-path=$ANDROID_NDK_ROOT --prefix=./qj_armv7 \ 10 | || exit 1 11 | 12 | echo ---------------make libvpx [armv7]-------------------- 13 | make clean 14 | make all || exit 1 15 | make install || exit 1 16 | 17 | echo ""; echo ok; echo "" -------------------------------------------------------------------------------- /src/3_build_libx264_armv7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ls -d ./std_toolchain > /dev/null || { echo please execute ./0_make_ndk_toolchain.sh first; exit 1; } 4 | 5 | export PATH="$PWD/std_toolchain/bin:$PATH" 6 | export CC=arm-linux-androideabi-gcc 7 | 8 | cd ./ffmpeg_src/libx264_src || { echo please download libx264 source to [./ffmpeg_src/libx264_src]; exit 1; } 9 | 10 | echo ---------------config libx264 [armv7]-------------------- 11 | ./configure --host=armv7-linux-androideabi --cross-prefix=arm-linux-androideabi- --enable-static --disable-cli --enable-pic --prefix=./qj_armv7 \ 12 | || exit 1 13 | 14 | echo ---------------make libx264 [armv7]-------------------- 15 | make clean 16 | make all || exit 1 17 | make install || exit 1 18 | 19 | echo ""; echo ok; echo "" -------------------------------------------------------------------------------- /src/9_build_ffmpeg_armv7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ls -d ./std_toolchain > /dev/null || { echo please execute ./0_make_ndk_toolchain.sh first; exit 1; } 4 | 5 | export PATH="$PWD/std_toolchain/bin:$PATH" 6 | export CC=arm-linux-androideabi-gcc 7 | 8 | cd ./ffmpeg_src || { echo please download ffmpeg source to [./ffmpeg_src]; exit 1; } 9 | 10 | echo ---------------make cpu-features lib-------------------- 11 | printenv ANDROID_NDK_ROOT > /dev/null || { echo please export ANDROID_NDK_ROOT=root_dir_of_your_android_ndk; exit 1; } 12 | mkdir ./otherlib 13 | $CC -c $ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c -o ./otherlib/cpu-features.o || exit 1 14 | echo ""; echo ok; echo "" 15 | 16 | echo ---------------config ffmpeg [armv7]-------------------- 17 | #extra flags for webm/vp8 and h264 18 | export CFLAGS="$CFLAGS -I./libvpx_src/qj_armv7/include -I./libx264_src/qj_armv7/include" 19 | export LDFLAGS="$LDFLAGS -B./libvpx_src/qj_armv7/lib ./otherlib/cpu-features.o -B./libx264_src/qj_armv7/lib" 20 | 21 | ./configure --enable-cross-compile --cross-prefix=arm-linux-androideabi- --target-os=linux \ 22 | --arch=armv7 --cpu=armv7-a \ 23 | --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-symver --disable-debug --disable-everything \ 24 | --enable-protocol=pipe --enable-protocol=file --enable-protocol=tcp \ 25 | --enable-static \ 26 | --enable-filter=scale --enable-filter=crop --enable-filter=transpose \ 27 | --enable-demuxer=rawvideo --enable-decoder=rawvideo \ 28 | --enable-muxer=image2 --enable-muxer=image2pipe --enable-muxer=mjpeg --enable-encoder=mjpeg --enable-encoder=png \ 29 | --enable-demuxer=image2 --enable-demuxer=image2pipe --enable-demuxer=mjpeg --enable-decoder=mjpeg --enable-decoder=png \ 30 | --enable-libvpx \ 31 | --enable-muxer=webm --enable-encoder=libvpx_vp8 \ 32 | --enable-demuxer=matroska --enable-decoder=libvpx_vp8 \ 33 | --enable-libx264 --enable-gpl \ 34 | --enable-muxer=mp4 --enable-encoder=libx264 \ 35 | --enable-demuxer=mov --enable-decoder=h264 \ 36 | || exit 1 37 | 38 | echo ---------------make ffmpeg [armv7]-------------------- 39 | make clean 40 | make all || exit 1 41 | 42 | cp -fv ./ffmpeg ../../bin/ffmpeg || exit 1 43 | 44 | echo ""; echo ok; echo "" -------------------------------------------------------------------------------- /src/build_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./0_make_ndk_toolchain.sh || exit 1 4 | ./1_download_ffmpeg.sh || exit 1 5 | ./1_download_libvpx.sh || exit 1 6 | ./1_download_libx264.sh || exit 1 7 | ./2_build_libvpx_armv7.sh || exit 1 8 | ./3_build_libx264_armv7.sh || exit 1 9 | ./9_build_ffmpeg_armv7.sh || exit 1 10 | --------------------------------------------------------------------------------
28 | Ubuntu 12 64bit
29 |