GithubHelp home page GithubHelp logo

jossydeleon / ztuber Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 536 KB

Android app to download videos from YOUTUBE

Home Page: http://ztuber.josymardeleon.com

ffmpeg-wrapper ffmpeg-android-java mp3 youtube android

ztuber's Introduction

ffmpegDroid (FFmpeg library for Android)

This tutorial will show how to compile ffmpeg 3.0 to use the powerful command line tool in any Android application. You can download this app to see how works FFmpeg in android: http://ztuber.josymardeleon.com

Enviroment:

  • Ubuntu 16.04 LTS
  • Memory 3.8 GiB
  • Intel® Core™ i5-3320M CPU @ 2.60GHz × 4

Software required:

  • FFmpeg 3.0
  • Android NDK
  • Android Studio
  1. Open a terminal and download Android NDK, then unzip
  • wget http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
  • unzip android-ndk-r12b-linux-x86_64.zip

or download the latest android ndk from here: https://developer.android.com/ndk/downloads/index.html and unzip

  1. Inside NDK folder go to sources and create a new folder called external-libs (if you want to compile any other lib with ffmpeg like libmp3lame, libx264, etc)

  2. Download FFmpeg 3.0 from https://www.ffmpeg.org/releases/ and unzip inside sources folder. You will have ffmpeg-3.0 folder

  3. Update the file configure inside Ffmpeg folder

Replace this:

SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'

For this:

SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'  
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'  
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'  
SLIB_INSTALL_LINKS='$(SLIBNAME)
  1. Create temporal folder named ffmpegtemp inside FFmpeg folder.

  2. Create new document called ffmpeg_build.sh inside FFmpeg folder and copy this: Note: You can edit this file with the options that you want to setup for ffmpeg

edit the NDK variable with your NDK path

Copy this:

#!/bin/bash
export TMPDIR=/your/path/ffmpeg/ffmpegtemp
NDK=/your/android/ndk/path/android-ndk
PLATFORM=$NDK/platforms/android-14/arch-arm
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

echo ""
echo ""
echo "********************* Zoe Developers by Josymar ***********************"
echo ""
echo "Compiling Shared library FFmpeg 3.0 for Android"
echo ""
echo "****************************************************************" `

function build_one
{
./configure \
    --prefix=$PREFIX \
    --target-os=linux \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --arch=arm \
    --sysroot=$PLATFORM \
    --extra-cflags="-I$NDK/sources/external-libs" \
    --extra-ldflags="-L$NDK/sources/external-libs" \
    --cc=$TOOLCHAIN/bin/arm-linux-androideabi-gcc \
    --nm=$TOOLCHAIN/bin/arm-linux-androideabi-nm \
    --disable-static \
    --enable-shared \
    --disable-runtime-cpudetect \
    --enable-gpl \
    --enable-small \
    --enable-cross-compile \
    --enable-asm \
    --enable-neon \
    --enable-yasm \
    --disable-debug \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-postproc \
    --disable-avdevice \
    --disable-symver \
    --disable-stripping \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j$(nproc)
make install

}

#for arm 
CPU=arm
PREFIX=$(pwd)/android/$CPU 
ADDI_CFLAGS="-marm"
build_one
  1. Open a terminal and give permissions to the file created
  • chmod +x ffmpeg_build.sh
  1. Now compile the FFmpeg
  • bash ffmpeg_build.sh Note: This process will take some time, depending your machine.
  1. After this, you will see a new folder called android. Your compile files will be inside the folder arm/lib. Just keep the files with a dash and number. For example libavcodec-57.so. You can deleted the original versions libavcodec.so

Integrate FFmpeg binaries with Android Studio

  • Create an android project using Android Studio IDE
  • Create a folder called jni at the same level of src.
  • Inside jni folder create two folders: ffmpeg and so
  • Inside so folder copy the binaries generated by the compiler: libavcodec-57.so, libavfilter-6.so, libavformat-57.so, libavutil-55.so, libswresample-2.so, libswscale-4.so
  • Inside ffmpeg folder copy the folder include generated by the compiler.

Please give me some time to finish this tutorial.

ztuber's People

Contributors

jossydeleon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.