You can use FFmpeg android with the FFmpeg Android Java implementation library in your project. see below
use gradle
compile 'com.writingminds:FFmpegAndroid:0.3.2'
and implement the code in your project below.
Download binary
You must download the binary.
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) {
Run binary
Here you have the ffmpeg command for your task.
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 }
More reffer this link.
source share