From 454c18275e5590b1eac69d144cc7ea15788b6d05 Mon Sep 17 00:00:00 2001 From: Qiming Date: Sat, 5 Nov 2022 14:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=8B=BC=E6=8E=A5ffmpeg?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?:=20Unable=20to=20find=20a=20suitable=20output=20format=20for?= =?UTF-8?q?=20'file.txt'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/frank/ffmpeg/activity/VideoHandleActivity.kt | 9 ++------- app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt index 30e8233..1cb6952 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt @@ -377,15 +377,10 @@ class VideoHandleActivity : BaseActivity() { Log.e(TAG, "width=$width--height=$height") } val transformCmd2 = FFmpegUtil.transformVideoWithEncode(appendPath, width, height, outputPath2) - val fileList = ArrayList() - fileList.add(outputPath1) - fileList.add(outputPath2) + val fileList = listOf(outputPath1, outputPath2) FileUtil.createListFile(listPath, fileList) val jointVideoCmd = FFmpegUtil.jointVideo(listPath, targetPath) - val commandList = ArrayList>() - commandList.add(transformCmd1) - commandList.add(transformCmd2) - commandList.add(jointVideoCmd) + val commandList = listOf(transformCmd1, transformCmd2, jointVideoCmd) ffmpegHandler!!.executeFFmpegCmds(commandList) } diff --git a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java index 14306ca..4a30fcc 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java +++ b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java @@ -354,7 +354,7 @@ public class FFmpegUtil { */ public static String[] jointVideo(String fileListPath, String outputPath) { // ffmpeg -f concat -safe 0 -i %s -c copy %s - String jointVideoCmd = "ffmpeg -f concat -safe 0 -i file.txt -c copy %s"; + String jointVideoCmd = "ffmpeg -f concat -safe 0 -i -c copy -y"; return insert(jointVideoCmd.split(" "), 6, fileListPath, outputPath); }