FFmpeg Android Java

Android java library for FFmpeg binary compiled using https://github.com/writingminds/ffmpeg-android

Download this project as a .zip file Download this project as a tar.gz file

FFmpeg Android Java

Supported Architecture

Adding Library to Project

Usage

Load Binary

This method copies the ffmpeg binary to device according to device's architecture. You just need to put this once in your code, whenever you are starting the application or using FFmpeg for the first time. This command does the following:

FFmpeg ffmpeg = FFmpeg.getInstance(context);
try {
  ffmpeg.loadBinary(new LoadBinaryResponseHandler() {

    @Override
    public void onStart() {}

    @Override
    public void onFailure() {}

    @Override
    public void onSuccess() {}

    @Override
    public void onFinish() {}
  });
} catch (FFmpegNotSupportedException e) {
  // Handle if FFmpeg is not supported by device
}

Execute Binary

This method executes ffmpeg command and provides callback through FFmpegExecuteResponseHandler interface. You also need to pass command as argument to this method.

FFmpeg ffmpeg = FFmpeg.getInstance(context);
try {
  // to execute "ffmpeg -version" command you just need to pass "-version"
  ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {

    @Override
    public void onStart() {}

    @Override
    public void onProgress(String message) {}

    @Override
    public void onFailure(String message) {}

    @Override
    public void onSuccess(String message) {}

    @Override
    public void onFinish() {}
  });
} catch (FFmpegCommandAlreadyRunningException e) {
  // Handle if FFmpeg is already running
}

Available Methods

Sample Application

Sample ffmpeg library gif

JavaDoc

License