Setting dynamic watermark in to the video using ff

2019-09-05 08:41发布

问题:

I am using this command to overlay the image into the video.

ffmpeg",i", inputVideoPath,"-i", imageToOverlay,"
-filter_complex",overlay=10:10","-strict", "-2","-b:a" ,"32k",
"-r","15","-preset", "ultrafast",outputVideoPath

Can we set the dynamic values into the "overlay=x:y" also "imageToOverlay" which is image path?

回答1:

try this command

 //  test with watermark.png 128x128, add it to /sdcard/videokit/
String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental", "-vf", "movie=/sdcard/videokit/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out.mp4"};

for more information check this link

check this link as well