I personally would not prefer to add the full FFMPEG SDK, as it increases the app size exponentially, however using Arthenica's FFMPEG-KIT seems the easiest way to get FFMPEG into a project
implementation "com.arthenica:ffmpeg-kit-min-gpl:5.1.LTS"
This new FFMPEG-KIT not only has a reduction in size, but the commands also execute quicker and have better async support and much easier implementation.
To use you just have to import
import com.arthenica.ffmpegkit.FFmpegKit
import com.arthenica.ffmpegkit.ReturnCode
and then :
FFmpegKit.executeAsync(cmdString , {
when {
ReturnCode.isSuccess(it.returnCode) -> {
println("FFMPEG SUCCESS :${it.state.name}")
}
ReturnCode.isCancel(it.returnCode) -> {
println("FFMPEG CANCELLED :${it.returnCode}")
}
it.returnCode.isValueError -> {
println("FFMPEG ERROR :${it.logs.last()}")
}
}
} , {
println("FFMEPG LOG :${it.message}")
} , {
println("FFMEPG STATS :${it.speed}")
})
here cmdString, is a string of commands, your commands should work but the only issue I ran into was that I had to use -y -i instead of -f which seemed to run the commands.
kotlin - FFmpeg Android Errors - Stack Overflow
java - How to import FFmpeg into Android project - Stack Overflow
kotlin - FFmpeg not working on Android version 10(Q) - Stack Overflow
android - Play video using FFmpeg library in androidNDK - Stack Overflow
Videos
Any tips on how to run ffmpeg on Android 10? (Without rooting the device) I searched a lot, but I didn't find anything useful.
Edit: I found this library and it worked well on Android 10 https://github.com/tanersener/mobile-ffmpeg