GithubHelp home page GithubHelp logo

adrgit / android-ffmpeg-with-rtmp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cine-io/android-ffmpeg-with-rtmp

0.0 2.0 0.0 286 KB

script(s) to build ffmpeg for android, including support for RTMP (and OpenSSL)

Shell 100.00%

android-ffmpeg-with-rtmp's Introduction

android-ffmpeg-with-rtmp

This repository contains script(s) to build ffmpeg for android with RTMP (and OpenSSL) support.

Instructions

  1. Install the Android NDK (tested with version r10).
  2. Ensure that cURL is installed.
  3. Ensure that pkg-config is installed.
  4. Clone this repository and cd into its directory.
  5. Run build.sh.
  6. Look in build/dist for the resulting libraries and executables.
  7. Look in build/build.log if something goes wrong.

For example:

$ git clone [email protected]:cine-io/android-ffmpeg-with-rtmp.git
$ cd android-ffmpeg-with-rtmp
$ ./build.sh

Notes

The first time you run the script, it will try to find the location where you've installed the NDK. It will also try to auto-detect your operating system and architecture. This process might take a minute or two, so the information will be saved into a configuration file called .build-config.sh which will be used on subsequent executions of the script.

The script is meant to be idempotent. However, should you want to start over from scratch, it's a simple matter of:

$ rm -rf src build .build-config.sh
$ ./build.sh

Android

To use ffmpeg with an Android app you will need to deploy the binaries along with the libraries. Here's a listing of the build/dist directory.

.
├── bin
│   ├── ffmpeg
│   ├── openssl
│   └── ssltest
└── lib
    ├── libavcodec-56.so
    ├── libavdevice-56.so
    ├── libavfilter-5.so
    ├── libavformat-56.so
    ├── libavutil-54.so
    ├── libcrypto.so
    ├── librtmp-1.so
    ├── libssl.so
    ├── libswresample-1.so
    └── libswscale-3.so

A simple way to deploy the binaries would be to archive (e.g. zip) these directories and copy the archive in a res/raw directory within the Android project. Then at runtime, unpack the archive into a directory accessible to the app and set the appropriate permissions, e.g. chmod 750 -R directory-name.

In order for the Android app to use the libraries the LD_LIBRARY_PATH must be set to the location where the libraries reside. For example:

// Change the permissions
Runtime.getRuntime().exec("chmod -R 0750 "+ abspath).waitFor();
	
//...
    
ProcessBuilder processBuilder = new ProcessBuilder(cmd);

final Map<String, String> environment = processBuilder.environment();

environment.put("LD_LIBRARY_PATH", context.getDir("lib", 0).getAbsolutePath());

Process process = processBuilder.start();

//...

Acknowledgements

Inspired by: openssl-android and FFmpeg-Android.

android-ffmpeg-with-rtmp's People

Contributors

jeffreywescott avatar newzealandpaul avatar rbiresch avatar trshafer avatar

Watchers

 avatar  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.