Adjust adding and removing watermark

dev
xufuji456 3 years ago
parent 0b4e896f39
commit 5475fd59df
  1. 4
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt
  2. 3
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

@ -190,7 +190,7 @@ class VideoHandleActivity : BaseActivity() {
}
//1:top left 2:top right 3:bottom left 4:bottom right
val location = 1
val offsetXY = 5
val offsetXY = 10
when (waterMarkType) {
TYPE_IMAGE// image
-> {
@ -222,7 +222,7 @@ class VideoHandleActivity : BaseActivity() {
val removeLogoPath = PATH + File.separator + "removeLogo" + suffix
val widthL = 64
val heightL = 40
commandLine = FFmpegUtil.removeLogo(srcFile, 5, 5, widthL, heightL, removeLogoPath)
commandLine = FFmpegUtil.removeLogo(srcFile, 10, 10, widthL, heightL, removeLogoPath)
}
R.id.btn_generate_gif//convert video into gif
-> {

@ -385,8 +385,7 @@ public class FFmpegUtil {
public static String[] addWaterMarkImg(String inputPath, String imgPath, int location, int bitRate,
int offsetXY, String outputPath) {
String mBitRate = bitRate + "k";
int offset = ScreenUtil.INSTANCE.dp2px(FFmpegApplication.getInstance(), offsetXY);
String overlay = obtainOverlay(offset, offset, location);
String overlay = obtainOverlay(offsetXY, offsetXY, location);
String waterMarkCmd = "ffmpeg -i %s -i %s -b:v %s -filter_complex %s -preset:v superfast %s";
waterMarkCmd = String.format(waterMarkCmd, inputPath, imgPath, mBitRate, overlay, outputPath);
return waterMarkCmd.split(" ");

Loading…
Cancel
Save