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

匆匆过客 提交于 2019-12-08 09:50:59

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/37854506/how-to-add-a-watermark-to-a-video-in-android-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!