diff --git a/configs.gradle b/configs.gradle
index 00495a2..bbd6e5a 100644
--- a/configs.gradle
+++ b/configs.gradle
@@ -11,8 +11,8 @@ ext {
//支持包版本
supportLibValue = "28.0.0"
//应用 versionCode
- versionCodeValue = 420
+ versionCodeValue = 430
//应用 version 名称,更多设置里显示的
- versionNameValue = "4.2.0"
+ versionNameValue = "4.3.0"
}
\ No newline at end of file
diff --git a/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandList.java b/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandList.java
index 030b48f..1395d27 100644
--- a/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandList.java
+++ b/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandList.java
@@ -1,9 +1,13 @@
package io.microshow.rxffmpeg;
+import android.util.Log;
+
import java.util.ArrayList;
/**
- * 指令集合
+ * 指令集合,
+ * 默认会加上 ffmpeg -y,如果想去除默认的指令可以调用clearCommands()清除
+ *
* Created by Super on 2019/4/5.
*/
public class RxFFmpegCommandList extends ArrayList {
@@ -17,15 +21,27 @@ public RxFFmpegCommandList() {
/**
* 清除命令集合
*/
- public void clearCommands() {
+ public RxFFmpegCommandList clearCommands() {
this.clear();
+ return this;
}
+ /**
+ * 追加命令
+ *
+ * @param s cmd
+ * @return RxFFmpegCommandList
+ */
public RxFFmpegCommandList append(String s) {
this.add(s);
return this;
}
+ /**
+ * 构建命令
+ *
+ * @return -
+ */
public String[] build() {
String[] command = new String[this.size()];
for (int i = 0; i < this.size(); i++) {
@@ -34,4 +50,25 @@ public String[] build() {
return command;
}
+ /**
+ * 构建命令
+ *
+ * @param isLog true:构建命令后 Log打印命令日志; false :不打印命令日志
+ * @return -
+ */
+ public String[] build(boolean isLog) {
+ String[] cmds = build();
+ if (isLog) {//需要打印构建后的命令
+ StringBuilder cmdLogStr = new StringBuilder();
+ for (int i = 0; i < cmds.length; i++) {
+ cmdLogStr.append(cmds[i]);
+ if (i < cmds.length - 1) {
+ cmdLogStr.append(" ");
+ }
+ }
+ Log.e("TAG_FFMPEG", "cmd: " + cmdLogStr.toString());
+ }
+ return cmds;
+ }
+
}
diff --git a/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandSupport.java b/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandSupport.java
index 6d33f84..4c831dc 100644
--- a/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandSupport.java
+++ b/rxffmpeg/src/main/java/io/microshow/rxffmpeg/RxFFmpegCommandSupport.java
@@ -1,21 +1,32 @@
package io.microshow.rxffmpeg;
+import android.text.TextUtils;
+
/**
* RxFFmpeg 命令支持
* Created by Super on 2019/4/5.
*/
public class RxFFmpegCommandSupport {
- public static String[] getBoxblur() {
+ /**
+ * 给视频加毛玻璃效果
+ *
+ * @param inputPath 输入视频文件
+ * @param outputPath 输出视频文件
+ * @param boxblur blur效果调节,默认 "5:1"
+ * @param isLog true: 构建命令后 Log打印命令日志; false :不打印命令日志
+ * @return cmds
+ */
+ public static String[] getBoxblur(String inputPath, String outputPath, String boxblur, boolean isLog) {
RxFFmpegCommandList cmdlist = new RxFFmpegCommandList();
cmdlist.append("-i");
- cmdlist.append("/storage/emulated/0/1/input.mp4");
+ cmdlist.append(inputPath);
cmdlist.append("-vf");
- cmdlist.append("boxblur=5:1");
+ cmdlist.append("boxblur=" + (TextUtils.isEmpty(boxblur) ? "5:1" : boxblur));
cmdlist.append("-preset");
cmdlist.append("superfast");
- cmdlist.append("/storage/emulated/0/1/result.mp4");
- return cmdlist.build();
+ cmdlist.append(outputPath);
+ return cmdlist.build(isLog);
}