I try to compress a video using a library and running a FFmpeg command in my android app written in java (although the library is in Kotlin) I manage to do basic operations but the current one I am going to show you will always fail with the following error code: Unknown encoder 'libx265'
The library expects the input to be a String[] and I assume that there is something going wrong but I cannot find what exactly.
the command line
val query:Array<String> = arrayOf("-i", videoPath , "-c:v" , "libx265" ,"preset", "fast", "-crf", "30", "-tag:v", "hvc1", "-c:a", "eac3", "-b:a", "224k" , "$videoPath.mp4");
the entire code
fun videoCompress(videoPath: String) {
val query:Array<String> = arrayOf("-i", videoPath , "-c:v" , "libx265" ,"-preset", "fast", "-crf", "30", "-tag:v", "hvc1", "-c:a", "eac3", "-b:a", "224k" , "$videoPath.mp4");
CallBackOfQuery().callQuery(query, object : FFmpegCallBack {
override fun statisticsProcess(statistics: Statistics) {
Log.i("FFMPEG LOG : ", statistics.videoFrameNumber.toString())
}
override fun process(logMessage: LogMessage) {
Log.i("FFMPEG LOG : ", logMessage.text)
}
override fun success() {
Log.d("yyyy", "success: ")
}
override fun cancel() {
}
override fun failed() {
}
})
}
what I added to my build.gradle file
implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.8'
the result (exact)
Unknown encoder 'libx265'
-report
argument (after"$videoPath.mp4"
), and post the content of the created log file (as text - not as image). I think your FFmpeg in not built withlibx265
, but I have not experience with JAVA and Android.