Addev
Addev

Reputation: 32221

How to add a watermark to a video in Android/Java

I'm trying to, given a video file, generate a new video with a watermark. In my case, I don't the watermark to be over the video, but as a band over it. For example if the video size is 100x100 I want to generate a 100x130 video with a custom image in the 100x30 top region.

What is the easiest way of achieving this?

Thanks

Upvotes: 0

Views: 2885

Answers (1)

parik dhakan
parik dhakan

Reputation: 787

use this code that will help you to make watermark in your video:

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"};

Upvotes: 1

Related Questions