This is a tiny FFmpeg project fork from formatBCE. Execute FFmpeg commands with ease in your Android project.
It will be get Permission denied error in targetSdkVersion 29(Android 10)
- Smaller package, only 21kb in size
- Support for most CPU architectures (including 64-bit) -- armv7 -- armv7-neon -- armv8 -- x86 -- x86_64 -- arm64-v8a
- The developer or user can choose to download the binary suitable for their device.
- Because the library itself does not contain binaries, you can bypass 64-bit detection on Google Play.
Include the dependency
implementation 'com.equationl.ffmpeg:tiny-android-ffmpeg:1.1.8'
Replace the 1.1.8 to latest version
Remember to check if the device is supported before use and if the binary exists and is available. 1.Check for support:
ffmpeg.isSupported()
2.Check if binary file exist
ffmpeg.isFFmpegExist()
3.If not exist, you need download by yourself
You can get all ffmpeg binary file at here, Please download these files and upload them to your own server, and then implement the download files in your project.
4.Apply the download file to project
ffmpeg.setFFmpegFile(file);
5.The callback of apply file
ffmpeg.setFFcheckFileListener(new FFcheckFileListener() {
@Override
public void onCopyFileFail(IOException e) {
Log.e(e);
}
@Override
public void onAllFinish() {
}
@Override
public void onVerifyFileFail() {
Log.e("check file fail!");
}
});
In this sample code we will run the ffmpeg -version command.
FFmpeg ffmpeg = FFmpeg.getInstance(context);
// to execute "ffmpeg -version" command you just need to input "-version"
String[] cmd = {"-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() {}
});
Stop (or Quit) the FFmpeg process
If you want to stop the running FFmpeg process, simply call .sendQuitSignal()
on the FFtask
that is running:
FFmpeg ffmpeg = FFmpeg.getInstance(context);
FFtask ffTask = ffmpeg.execute( ... )
ffTask.sendQuitSignal();
NOTE: This will result in onFailure
being called instead of onSuccess
.
Please check demo
This project fork from formatBCE
formatBCE fork from bravobit
bravobit fork fromWritingMinds