视频反序倒播

视频反序倒播(纯视频)
pull/107/head
xufulong 6 years ago
parent 3b990b18ae
commit 72a0760592
  1. 11
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
  2. 15
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
  3. 11
      app/src/main/res/layout/activity_video_handle.xml
  4. 1
      app/src/main/res/values/strings.xml

@ -69,6 +69,7 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
findViewById(R.id.btn_combine_video).setOnClickListener(this);
findViewById(R.id.btn_play_video).setOnClickListener(this);
findViewById(R.id.btn_multi_video).setOnClickListener(this);
findViewById(R.id.btn_reverse_video).setOnClickListener(this);
}
private void setVisible() {
@ -82,6 +83,7 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
findViewById(R.id.btn_combine_video).setVisibility(View.VISIBLE);
findViewById(R.id.btn_play_video).setVisibility(View.VISIBLE);
findViewById(R.id.btn_multi_video).setVisibility(View.VISIBLE);
findViewById(R.id.btn_reverse_video).setVisibility(View.VISIBLE);
}
private void setGone() {
@ -95,6 +97,7 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
findViewById(R.id.btn_combine_video).setVisibility(View.GONE);
findViewById(R.id.btn_play_video).setVisibility(View.GONE);
findViewById(R.id.btn_multi_video).setVisibility(View.GONE);
findViewById(R.id.btn_reverse_video).setVisibility(View.GONE);
}
@Override
@ -131,6 +134,9 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
case R.id.btn_multi_video:
handleType = 9;
break;
case R.id.btn_reverse_video:
handleType = 10;
break;
default:
handleType = 0;
break;
@ -219,6 +225,11 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
String outputFile = PATH + File.separator + "multi.mp4";
commandLine = FFmpegUtil.multiVideo(input1, input2, outputFile, VideoLayout.LAYOUT_HORIZONTAL);
break;
case 10://视频反序倒播
String input = PATH + File.separator + "beyond.mp4";
String output = PATH + File.separator + "reverse.mp4";
commandLine = FFmpegUtil.reverseVideo(input, output);
break;
default:
break;
}

@ -249,4 +249,19 @@ public class FFmpegUtil {
return multiVideo.split(" ");
}
/**
* 视频反序倒播
* @param inputFile 输入文件
* @param targetFile 反序文件
*
* @return 视频反序的命令行
*/
public static String[] reverseVideo(String inputFile, String targetFile){
//FIXME 音频也反序
// String reverseVideo = "ffmpeg -i %s -filter_complex [0:v]reverse[v];[0:a]areverse[a] -map [v] -map [a] %s";
String reverseVideo = "ffmpeg -i %s -filter_complex [0:v]reverse[v] -map [v] %s";//单纯视频反序
reverseVideo = String.format(reverseVideo, inputFile, targetFile);
return reverseVideo.split(" ");
}
}

@ -10,7 +10,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_marginTop="10dp"
android:text="@string/video_transform"/>
<Button
@ -103,4 +103,13 @@
android:layout_marginTop="10dp"
android:text="@string/video_multi"/>
<Button
android:id="@+id/btn_reverse_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/btn_multi_video"
android:layout_marginTop="10dp"
android:text="@string/video_reverse"/>
</RelativeLayout>

@ -35,6 +35,7 @@
<string name="video_slow">慢放</string>
<string name="video_fast">快进</string>
<string name="video_multi">画面拼接</string>
<string name="video_reverse">视频倒播</string>
<string name="swap">切换</string>
<string name="start">开始</string>

Loading…
Cancel
Save