Giter Site home page Giter Site logo

ffmpeg-binary-android's Introduction

Android Arsenal

Prebuilt FFmpeg Android

This repo contains build scripts to build FFmpeg executable binary for Android and also publish prebuilt files here. There are two build flavors: FULL and LITE

  • LITE is a version that optimized binrary size, so it only includes small set features to work with most commom formats and codecs.
    • ABI and android version supported:
      • armeabi (Android 16+)
      • armeabi-v7a, armeabi-v7a-neon, (Android 16+)
      • x86 (Android 16+)
      • arm64-v8a (Android 21+)
      • x86_64 (Android 21+)
      • mips (Android 16+) (No longer support)
      • mips64 (Android 21+) (No longer support)
    • Addition libraries: libmp3lame, libshine, libopus, libvorbis
  • FULL is a version compiled full FFmpeg feature, include https support protocol.
    • ABI and android version supported:
      • armeabi (Android 21+)
      • armeabi-v7a, armeabi-v7a-neon, (Android 21+)
      • x86 (Android 21+)
      • arm64-v8a (Android 21+)
      • x86_64 (Android 21+)
    • Include libraries in LITE version, plus with: libfdk-aac (non-free), libx264, openssl (thanks to leenjewel/openssl_for_ios_and_android)

Download

Latest build: Latest build

Build

Prerequisites:

  • Android NDK r15
  • export NDK=path/to/android-ndk

Build:

export NDK=path/to/android-ndk
cd build_scripts

FLAVOR=full       # or "lite"
TARGET=armv7-a    # Support targets: "arm", "armv7-a", "arm-v7n", "arm64-v8a", "i686", "x86_64"
BUILD_DIR=$(pwd)/build_dir
FINAL_DIR=$(pwd)/final/$TARGET

./build_ffmpeg.sh $TARGET $FLAVOR $BUILD_DIR $FINAL_DIR

The ffmpeg binary should in folder $FINAL_DIR/$TARGET/$FLAVOR/ffmpeg after build succeed.

References

FFmpeg license

This software uses code of FFmpeg licensed under the LGPLv2.1 and its source can be downloaded here.

App using this repo:

MediaConverterAndroid
Media Converter Android:

ffmpeg-binary-android's People

Contributors

khang-nt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffmpeg-binary-android's Issues

libx264 Support

Can you please provide support for libx264 in lite version?

Lite version "Codec 'mp3' is known to FFmpeg, but no encoders for it are available. FFmpeg might need to be recompiled with additional external libraries."

Hi, x86_64 lite version compiles fine and I can see it is using --enable-libmp3lame . But, when you try something like
ffmpeg -i a.wav output.mp3

you get
Automatic encoder selection failed for output stream #0:0. Default encoder for format mp3 (codec mp3) is probably disabled. Please choose an encoder manually.

then I try

ffmpeg -i a.wav -codec:a libmp3lame output.mp3

and I get

Unknown encoder 'libmp3lame'

More License details required!

I guess it would be better, if you could elaborate more on the license.

Full Version( With x264) - should be under GPLv3 License
Lite Version(Without x264) - LGPLv3 License

A quick mention on the Readme file should be good enough.

binary with hls support?

Can you compile binary version with HLS support?
ex. -hls_time does not work on the latest binary you posted

Need freetype and fontconfig libraries

hi, i need libfreetype and libfontconfig library on lite build.
i append --enable-libfreetype and --enable-libfontconfig, but ERROR: freetype2 not found.

my edit build file:

LIBFREETYPE_VERSION="2.9"
if [ ! -d "freetype-$LIBFREETYPE_VERSION" ]; then
    echo "Downloading libfreetype-$LIBFREETYPE_VERSION"
    curl -O "https://cytranet.dl.sourceforge.net/project/freetype/freetype2/2.9/freetype-$LIBFREETYPE_VERSION.tar.bz2"
    tar -xf "freetype-$LIBFREETYPE_VERSION.tar.bz2"
else
    echo "Using existing `pwd`/freetype-$LIBFREETYPE_VERSION"
fi

and

pushd freetype-${LIBFREETYPE_VERSION}
./configure \
    --prefix=$PREFIX \
    --host=$HOST \
    --enable-static \
    --disable-shared 

make clean
make -j8
make install
popd

ERROR: freetype2 not found.

can you help me?

error: cannot find -lharfbuzz

OS: Ubuntu 18.04

I just followed the tutorial and got the following error. NDK that I used https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip?hl=uk

fcstat.c: In function 'FcStatChecksum':
fcstat.c:337:34: warning: pointer targets in passing argument 2 of 'FcDirChecksum' differ in signedness [-Wpointer-sign]
         if (FcDirChecksum (file, &statb->st_mtime) == -1)
                                  ^
fcstat.c:250:1: note: expected 'time_t *' but argument is of type 'long unsigned int *'
 FcDirChecksum (const FcChar8 *dir, time_t *checksum)
 ^
  CCLD     fcarch
  CCLD     libfontconfig.la
make[3]: Leaving directory '/home/v/Downloads/ffmpeg-binary-android/build_scripts/fontconfig-2.13.0/src'
make[2]: Leaving directory '/home/v/Downloads/ffmpeg-binary-android/build_scripts/fontconfig-2.13.0/src'
Making all in fc-cache
make[2]: Entering directory '/home/v/Downloads/ffmpeg-binary-android/build_scripts/fontconfig-2.13.0/fc-cache'
  CC       fc-cache.o
  CCLD     fc-cache
/home/v/Downloads/ffmpeg-binary-android/build_scripts/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lharfbuzz
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_face_globals_free: error: undefined reference to 'hb_font_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_face_globals_free: error: undefined reference to 'hb_buffer_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_font_get_face'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_tags_from_script'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_layout_collect_lookups'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_is_empty'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_layout_lookup_collect_glyphs'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_next'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_layout_collect_lookups'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_layout_lookup_collect_glyphs'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_next'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_next'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_ot_layout_lookup_would_substitute'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_subtract'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_coverage: error: undefined reference to 'hb_set_next'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_face_globals_new: error: undefined reference to 'hb_ft_font_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_face_globals_new: error: undefined reference to 'hb_buffer_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_buf_create: error: undefined reference to 'hb_buffer_create'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_buf_destroy: error: undefined reference to 'hb_buffer_destroy'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_font_set_scale'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_clear_contents'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_add_utf8'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_guess_segment_properties'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_shape'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_clear_contents'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_add_utf8'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_guess_segment_properties'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_shape'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_get_glyph_infos'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_get_glyph_infos'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_get_length'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_cluster: error: undefined reference to 'hb_buffer_clear_contents'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_elem: error: undefined reference to 'hb_buffer_get_glyph_infos'
/home/v/Downloads/ffmpeg-binary-android/build_scripts/build_dir/lib/libfreetype.a(autofit.o):autofit.c:function af_shaper_get_elem: error: undefined reference to 'hb_buffer_get_glyph_positions'
collect2: error: ld returned 1 exit status
Makefile:512: recipe for target 'fc-cache' failed
make[2]: *** [fc-cache] Error 1
make[2]: Leaving directory '/home/v/Downloads/ffmpeg-binary-android/build_scripts/fontconfig-2.13.0/fc-cache'
Makefile:599: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/v/Downloads/ffmpeg-binary-android/build_scripts/fontconfig-2.13.0'
Makefile:483: recipe for target 'all' failed
make: *** [all] Error 2

ERROR: libx264 not found

Hi, firstly many thanks for great scripts and tutorials.

NDK=15rc
OS=macOS High Siera
We use your script files.

I uncommented x264 line both native-mac and armv7a then, added build ..sh files --enable-libx264 option for ffmpeg. Its result was native-mac compilation was successful but armv7a was failed. And then added
--disable-opencl \ for x264 into configure options, it's failed again. Updating to ffmpeg newer version did not change anything.

Could you recommend us anything else?

libvpx support

Any plans to include libvpx into precompiled full libs ?

Add h265 to full version

Hi, just an enhancement request.

Would you consider adding h265 encoding support to the precompiled version? Is there a good reason not to?

Thanks.

complete version

Hi ,Thanks for your repository .
how can we build the completed version?
or version that has filters...
could you make a complete version and push it or making an easy tutorial?

x86 has text relocations

When using the prebuilt binary I get the error

signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- Abort message: 'CANNOT LINK EXECUTABLE "/data/user/0/com.myapp.test/files/ffmpeg": "/data/data/com.myapp.test/files/ffmpeg" has text relocations (https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)' eax 00000000 ebx 000016b5 ecx 000016b5 edx 00000006 esi 00000000 edi 000016b5

Could you compile it with --disable-asm so we can use it on the newer android versions?

Thanks!

Error using ffmpeg arm-v8a with youtube-dl

/data/user/0/org.qpython.qpy/files/bin/qpython-android5.sh "/data/user/0/org.qpython.qpy/files/bin/pip4console.py" && exit
py/files/bin/pip4console.py" && exit <
Input pip commands, ie: pip install {module}
-->youtube-dl --no-check-certificate https://www.pscp.tv/w/1gqxvpbdDRwGB
[periscope] 1gqxvpbdDRwGB: Downloading JSON metadata
[periscope] 1gqxvpbdDRwGB: Downloading m3u8 information
[periscope] 1gqxvpbdDRwGB: Downloading m3u8 information
[periscope] 1gqxvpbdDRwGB: Downloading m3u8 information
[download] Destination: Бананчик - 🎀 2018-04-06 14_53-1gqxvpbdDRwGB.mp4
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.x (GCC) 20150123 (prerelease)
configuration: --prefix=/Users/khangnt/Desktop/ffmpeg-binary-android/build_scripts/build/arm64-v8a --target-os=linux --arch=arm64 --cross-prefix=/Users/khangnt/Desktop/android-ndk-r15/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android- --enable-cross-compile --sysroot=/Users/khangnt/Desktop/android-ndk-r15/platforms/android-21/arch-arm64/ --pkg-config=/usr/local/bin/pkg-config --pkg-config-flags=--static --enable-pic --enable-small --enable-gpl --disable-shared --enable-static --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-protocols --enable-protocol='file,pipe' --disable-demuxers --disable-muxers --enable-demuxer='aac,avi,dnxhd,flac,flv,gif,h261,h263,h264,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,srt,wav,webvtt' --enable-muxer='3gp,dnxhd,flac,flv,gif,image2,matroska,webm,mov,mp3,mp4,mpeg,ogg,opus,srt,wav,webvtt,ipod' --disable-encoders --disable-decoders --enable-encoder='aac,dnxhd,flac,flv,gif,libmp3lame,libopus,libshine,libvorbis,mpeg4,png,srt,subrip,webvtt' --enable-decoder='aac,aac_at,aac_fixed,aac_latm,dnxhd,flac,flv,h261,h263,h263i,h263p,h264,vp8,vp9,libopus,libvorbis,mp3,mpeg4,wavpack,png,rawvideo,srt,webvtt' --enable-libshine --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-bsf=aac_adtstoasc --disable-doc
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Unrecognized option 'headers'.
Error splitting the argument list: Option not found

ERROR: ffmpeg exited with code 1
-->

Can you help me? And as another user asked in another issue, could you compile and make available full versions of ffmpeg? I do not have any development skills, so I can not do this myself. Thank you so much for your time and great work!

ffmpeg 4.0 and demo app

Hello,

Thank you a lot for writing and making this code open source.
I've got two queries:

  • Are you thinking about updating the prebuilt files to the latest FFmpeg 4.0?
  • Any plans to include a form of utility class to make it more straightforward to use the FFmpeg library?

Your Android-Media-Converter project looks great, but I haven't gotten the time to learn Kotlin yet so finding the classes/methods that I need in order to use the binaries is kinda tough.

Thanks a bunch!

[Question]

On your release files.... what does the "native" package stands for? which archtecture can runs it

I have an error

gcc -c -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -W -Wall -pedantic -Wc90-c99-compat -Wno-long-long -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla -DHAVE_CONFIG_H -I. -I. -I./include -I./include -I./x86 -I./x86 -I./asm -I./asm -I./disasm -I./disasm -I./output -I./output -o asm/nasm.o asm/nasm.c
In file included from ./include/nasm.h:46,
from asm/nasm.c:47:
./include/nasmlib.h:194:1: error: ‘pure’ attribute on function returning ‘void’ [-Werror=attributes]
194 | void pure_func seg_init(void);

on kali linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.