无法使用“mobile-ffmpeg”/“ffmpeg-kit”修剪我的视频

问题描述

我正在使用“com.arthenica:ffmpeg-kit-full:4.4.LTS”来修剪我的视频。

我在下面发布了我的代码,我曾经用它来修剪视频,但每次它都会转到 else 块(每次我的修剪失败时)。 请帮帮我

val cmd = arrayOf("-i",trimmerData.srcPath,"-ss",startTime,"-t",endTime,"-s","320x240","-r","25","-vcodec","mpeg4","-b:v","2097152","-b:a","48000","-ac","2","-ar","22050","-c","copy",trimmerData.dstPath)
val session = FFmpegKit.execute(cmd)
if (ReturnCode.isSuccess(session.returnCode)) {
Log.i("ffmpeg","Success")
scanTrimFile(trimmerData)
// SUCCESS
} 
else if (ReturnCode.isCancel(session.returnCode)) {
Log.i("ffmpeg","Cancel")
// CANCEL
} 
else {
showTrimmingError()
// FAILURE
Log.d("ffmpeg",String.format("Command Failed with state %s and rc %s.%s",session.state,session.returnCode,session.failStackTrace))
}
private fun scanTrimFile(trimmerData: TrimmerData) {
mediaScannerConnection = MediaScannerConnection(this,object : MediaScannerConnection.MediaScannerConnectionClient {
override fun onMediaScannerConnected() {
mediaScannerConnection.scanFile(trimmerData.dstPath,"video/*")
}
                override fun onScanCompleted(path: String?,uri: Uri?) {
                    mediaScannerConnection.disconnect()
                    dismissWaitingDialog()
                    getResult(Uri.parse(trimmerData.dstPath))
                }
            })
    mediaScannerConnection.connect()
}

错误

2021-04-20 09:39:09.448 20346-20706/org.xyz.ts W/ffmpeg-kit: Multiple -c,-codec,-acodec,-vcodec,-scodec or -dcodec options specified for stream 0,only the last option '-c copy' will be used.
2021-04-20 09:39:09.449 20346-20706/org.xyz.ts E/ffmpeg-kit: [mp4 @ 0xe6b84800] Could not find tag for codec amr_nb in stream #1,codec not currently supported in container
2021-04-20 09:39:09.449 20346-20706/org.xyz.ts E/ffmpeg-kit: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts E/ffmpeg-kit: Error initializing output stream 0:1 --
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts I/ffmpeg-kit: Stream mapping:
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts I/ffmpeg-kit: Stream #0:0 -> #0:0
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts I/ffmpeg-kit: (copy)
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts I/ffmpeg-kit: Stream #0:1 -> #0:1
2021-04-20 09:39:09.451 20346-20706/org.xyz.ts I/ffmpeg-kit: (copy)
2021-04-20 09:39:09.541 20346-20346/org.xyz.ts D/ffmpeg: Command Failed with state COMPLETED and rc 1.null

日志: https://docs.google.com/document/d/1yua-QLiu38LztN2frNWFHUVvl1YEedScmY4XDA2z5XU/edit?usp=sharing

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...