concat video

concat video
pull/166/head
xufulong 5 years ago
parent 180e70f81e
commit 9c30957219
  1. 29
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
  2. 10
      app/src/main/res/layout/activity_video_handle.xml
  3. 1
      app/src/main/res/values-en/strings.xml
  4. 1
      app/src/main/res/values/strings.xml

@ -98,8 +98,7 @@ public class VideoHandleActivity extends BaseActivity {
R.id.btn_denoise_video, R.id.btn_denoise_video,
R.id.btn_to_image, R.id.btn_to_image,
R.id.btn_pip, R.id.btn_pip,
R.id.btn_moov, R.id.btn_moov
R.id.btn_joint
); );
} }
@ -147,23 +146,8 @@ public class VideoHandleActivity extends BaseActivity {
int duration = 20; int duration = 20;
commandLine = FFmpegUtil.cutVideo(srcFile, startTime, duration, cutVideo); commandLine = FFmpegUtil.cutVideo(srcFile, startTime, duration, cutVideo);
break; break;
case R.id.btn_video_concat://concat video case R.id.btn_video_concat://concat video together
// commandLine = FFmpegUtil.toTs(srcFile, ts1); concatVideo(srcFile);
// 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);
break; break;
case R.id.btn_screen_shot://video snapshot case R.id.btn_screen_shot://video snapshot
String screenShot = PATH + File.separator + "screenShot.jpg"; 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)); Log.e(TAG, "move moov use time=" + (System.currentTimeMillis() - start));
} }
break; break;
case R.id.btn_joint:// joint two videos together
jointVideo(srcFile);
break;
default: default:
break; 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 * It's recommended to convert to the same resolution and encoding
* @param selectedPath the path which is selected * @param selectedPath the path which is selected
*/ */
private void jointVideo(String selectedPath) { private void concatVideo(String selectedPath) {
if (ffmpegHandler == null || selectedPath.isEmpty()) { if (ffmpegHandler == null || selectedPath.isEmpty()) {
return; return;
} }

@ -41,8 +41,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:text="@string/video_concat" android:text="@string/video_concat" />
android:visibility="gone"/>
<Button <Button
android:id="@+id/btn_screen_shot" android:id="@+id/btn_screen_shot"
@ -116,13 +115,6 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:text="@string/video_pip"/> android:text="@string/video_pip"/>
<Button
android:id="@+id/btn_joint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/video_joint"/>
<Button <Button
android:id="@+id/btn_moov" android:id="@+id/btn_moov"
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -42,7 +42,6 @@
<string name="video_pip">Video Pip</string> <string name="video_pip">Video Pip</string>
<string name="video_preview">Video preview</string> <string name="video_preview">Video preview</string>
<string name="video_moov">MOOV move ahead</string> <string name="video_moov">MOOV move ahead</string>
<string name="video_joint">Video joint</string>
<string name="swap">Swap</string> <string name="swap">Swap</string>
<string name="start">Start</string> <string name="start">Start</string>

@ -42,7 +42,6 @@
<string name="video_pip">视频画中画</string> <string name="video_pip">视频画中画</string>
<string name="video_preview">播放预览</string> <string name="video_preview">播放预览</string>
<string name="video_moov">MOOV前移</string> <string name="video_moov">MOOV前移</string>
<string name="video_joint">视频拼接</string>
<string name="swap">切换</string> <string name="swap">切换</string>
<string name="start">开始</string> <string name="start">开始</string>

Loading…
Cancel
Save