From 9c309572190170255e79847372762f5383cb1d1f Mon Sep 17 00:00:00 2001
From: xufulong <839789740@qq.com>
Date: Sun, 10 May 2020 23:11:54 +0800
Subject: [PATCH] concat video
concat video
---
.../ffmpeg/activity/VideoHandleActivity.java | 29 ++++---------------
.../main/res/layout/activity_video_handle.xml | 10 +------
app/src/main/res/values-en/strings.xml | 1 -
app/src/main/res/values/strings.xml | 1 -
4 files changed, 6 insertions(+), 35 deletions(-)
diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
index d162480..747bfa1 100644
--- a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
+++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
@@ -98,8 +98,7 @@ public class VideoHandleActivity extends BaseActivity {
R.id.btn_denoise_video,
R.id.btn_to_image,
R.id.btn_pip,
- R.id.btn_moov,
- R.id.btn_joint
+ R.id.btn_moov
);
}
@@ -147,23 +146,8 @@ public class VideoHandleActivity extends BaseActivity {
int duration = 20;
commandLine = FFmpegUtil.cutVideo(srcFile, startTime, duration, cutVideo);
break;
- case R.id.btn_video_concat://concat video
-// commandLine = FFmpegUtil.toTs(srcFile, ts1);
-// concatStep ++;
-// String concatVideo = PATH + File.separator + "concatVideo.mp4";
-// String appendVideo = PATH + File.separator + "test.mp4";
-// File concatFile = new File(PATH + File.separator + "fileList.txt");
-// try {
-// FileOutputStream fileOutputStream = new FileOutputStream(concatFile);
-// fileOutputStream.write(("file \'" + srcFile + "\'").getBytes());
-// fileOutputStream.write("\n".getBytes());
-// fileOutputStream.write(("file \'" + appendVideo + "\'").getBytes());
-// fileOutputStream.flush();
-// fileOutputStream.close();
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// commandLine = FFmpegUtil.concatVideo(srcFile, concatFile.getAbsolutePath(), concatVideo);
+ case R.id.btn_video_concat://concat video together
+ concatVideo(srcFile);
break;
case R.id.btn_screen_shot://video snapshot
String screenShot = PATH + File.separator + "screenShot.jpg";
@@ -286,9 +270,6 @@ public class VideoHandleActivity extends BaseActivity {
Log.e(TAG, "move moov use time=" + (System.currentTimeMillis() - start));
}
break;
- case R.id.btn_joint:// joint two videos together
- jointVideo(srcFile);
- break;
default:
break;
}
@@ -298,11 +279,11 @@ public class VideoHandleActivity extends BaseActivity {
}
/**
- * joint two videos together
+ * concat/joint two videos together
* It's recommended to convert to the same resolution and encoding
* @param selectedPath the path which is selected
*/
- private void jointVideo(String selectedPath) {
+ private void concatVideo(String selectedPath) {
if (ffmpegHandler == null || selectedPath.isEmpty()) {
return;
}
diff --git a/app/src/main/res/layout/activity_video_handle.xml b/app/src/main/res/layout/activity_video_handle.xml
index c256ef1..e5de327 100644
--- a/app/src/main/res/layout/activity_video_handle.xml
+++ b/app/src/main/res/layout/activity_video_handle.xml
@@ -41,8 +41,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
- android:text="@string/video_concat"
- android:visibility="gone"/>
+ android:text="@string/video_concat" />
-
-