From 5475fd59df8228fe85a35b5d68eb7e6f36c93138 Mon Sep 17 00:00:00 2001 From: xufuji456 <839789740@qq.com> Date: Fri, 13 Aug 2021 23:15:32 +0800 Subject: [PATCH] Adjust adding and removing watermark --- .../java/com/frank/ffmpeg/activity/VideoHandleActivity.kt | 4 ++-- app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt index 9e5f8ea..acd005d 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt @@ -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 -> { diff --git a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java index efccb4b..8cd1ced 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java +++ b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java @@ -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(" ");