diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d6252b8..a8af654 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,14 +1,19 @@
+
+
+
+ android:theme="@style/AppTheme"
+ tools:ignore="AllowBackup">
@@ -16,6 +21,7 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/FFmpegTestActivity.java b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/FFmpegTestActivity.java
new file mode 100644
index 0000000..e74b1b2
--- /dev/null
+++ b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/FFmpegTestActivity.java
@@ -0,0 +1,72 @@
+package com.github.xch168.ffmpeg.invoker.demo;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Looper;
+import android.view.View;
+import android.widget.Toast;
+
+import com.github.xch168.ffmpeg.invoker.FFmpegInvoker;
+
+import java.io.File;
+
+public class FFmpegTestActivity extends AppCompatActivity {
+ private String videoPath = "/storage/emulated/0/DCIM/Camera/fb639313f7f3d58cc793f20095439c88.mp4";
+
+ private FFmpegInvoker.Callback mCallback = new FFmpegInvoker.Callback() {
+ @Override
+ public void onSuccess() {
+ Looper.prepare();
+ Toast.makeText(FFmpegTestActivity.this, "处理成功", Toast.LENGTH_SHORT).show();
+ Looper.loop();
+ }
+
+ @Override
+ public void onFailure() {
+ Looper.prepare();
+ Toast.makeText(FFmpegTestActivity.this, "处理失败", Toast.LENGTH_SHORT).show();
+ Looper.loop();
+ }
+
+ @Override
+ public void onProgress(float progress) {
+
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_ffmpeg_test);
+ }
+
+ public static void open(Context context) {
+ Intent intent = new Intent(context, FFmpegTestActivity.class);
+ context.startActivity(intent);
+ }
+
+ public void cutVideo(View view) {
+ String savePath = getSaveDir() + "out.mp4";
+ String cmd = "ffmpeg -y -ss 1 -t 100 -accurate_seek -i " + videoPath + " -codec copy " + savePath;
+ FFmpegInvoker.exec(cmd.split(" "), 100, mCallback);
+ }
+
+ public void extractFrame(View view) {
+ String savePath = getSaveDir() + "out.png";
+ String cmd = "ffmpeg -ss 10 -i " + videoPath + " -vframes 1 -y " + savePath;
+ FFmpegInvoker.exec(cmd.split(" "), 100, mCallback);
+ }
+
+ public static String getSaveDir() {
+ String savePath = Environment.getExternalStorageDirectory().getPath() + "/FFmpegInvoker/";
+ File file = new File(savePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return savePath;
+ }
+}
diff --git a/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
index b4458c1..7075c4a 100644
--- a/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
+++ b/app/src/main/java/com/github/xch168/ffmpeg/invoker/demo/MainActivity.java
@@ -60,4 +60,8 @@ public class MainActivity extends AppCompatActivity {
}
return configInfoBuilder.toString();
}
+
+ public void toTestFFmpeg(View view) {
+ FFmpegTestActivity.open(this);
+ }
}
diff --git a/app/src/main/res/layout/activity_ffmpeg_test.xml b/app/src/main/res/layout/activity_ffmpeg_test.xml
new file mode 100644
index 0000000..6c9b019
--- /dev/null
+++ b/app/src/main/res/layout/activity_ffmpeg_test.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index d28a3c3..2e2173d 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,6 +6,14 @@
android:layout_height="match_parent"
tools:context="com.github.xch168.ffmpeg.invoker.demo.MainActivity">
+
+