在Android Studio java中使用命令时,未知编码器“libx265”

czfnxgou  于 2023-05-27  发布在  Android
关注(0)|答案(1)|浏览(101)

我尝试使用库压缩视频,并在我用java编写的Android应用程序中运行FFmpeg命令(尽管库是在Kotlin中)我设法进行基本操作,但我将向您展示的当前操作总是失败,并出现以下错误代码:未知编码器'libx265'
库期望输入是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");

整个代码

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() {
        }
    })
}

The Log from the code
我在build.gradle文件中添加的内容

implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.8'

结果(精确)
未知编码器'libx265'

t98cgbkg

t98cgbkg1#

使用此库

implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.2.LTS'

这个命令

String cmd = "-y -i " + oldPath + " -c:a copy -r 30 -vcodec libx264 -crf 28 -preset ultrafast " + newFile.getPath();

相关问题