如何在Android / Java中为视频添加水印

时间:2016-06-16 09:00:30

标签: java android video mp4 webm

我试图在给定视频文件的情况下生成带有水印的新视频。在我的情况下,我不会将水印放在视频上,而是作为乐队覆盖它。例如,如果视频大小为100x100,我想在100x30顶部区域生成带有自定义图像的100x130视频。

实现这一目标的最简单方法是什么?

由于

1 个答案:

答案 0 :(得分:1)

使用此代码可以帮助您在视频中制作水印:

String[] complexCommand2 = {"ffmpeg", "-y", "-i",
                        "/sdcard/videokit/in.mp4",
                        "-i", "/sdcard/videokit/bb.m4a",
                        "-strict", "experimental", "-filter_complex",
                        "[1:a]atempo=1.0[a1];" + "movie=/sdcard/videokit/ic_gc.png [watermark];"
                                + "[0:v][watermark] overlay=main_w-overlay_w-10:10 [outv]",     //overlay here
                        "-map", "[outv]", "-map", "[a1]", "-s", "320x240", "-r", "30", "-b",
                        "15496k", "-vcodec", "mpeg4", "-ab", "48000", "-ac", "2", "-ar", "22050",
                        "-shortest", "/sdcard/videokit/out_water.mp4"};