From e8ef428180ac1f91227450b8af45b42aa9f2c652 Mon Sep 17 00:00:00 2001 From: xufuji456 Date: Sun, 9 Oct 2022 10:55:57 +0800 Subject: [PATCH] Feature: add video transition --- app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 24bff53..24cf02e 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java +++ b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java @@ -845,4 +845,12 @@ public class FFmpegUtil { return insert(stereo3dCmd.split(" "), 2, inputPath, outputPath); } + public static String[] videoTransition(String inputPath1, int width, int height, int offset, String inputPath2, String outputPath) { + String transitionCmd = "ffmpeg -i -i -filter_complex " + + "[0]settb=AVTB,fps=24000/1001[v0];[1]settb=AVTB,fps=24000/1001,scale=%d:%d[v1];" + + "[v0][v1]xfade=transition=radial:duration=1:offset=%d"; + transitionCmd = String.format(Locale.getDefault(), transitionCmd, width, height, offset); + return insert(transitionCmd.split(" "), 2, inputPath1, 4, inputPath2, outputPath); + } + }