单个命令可在一个视频中裁剪,设置动画(效果)并添加图像和文本

时间:2019-03-07 05:30:30

标签: android ffmpeg video-processing android-ffmpeg

我想创建一个可以执行单个操作的命令。

我很少有可以单独运行的命令

添加背景音乐命令

String[] command = {"-i", inputPath, "-i", 
audioPath, "-filter_complex", "amix", "-preset", 
"ultrafast", "-vcodec", "libx264", outputPath};

多个图像叠加命令

String[] command = {"-i", inputPath, "-i", 
audio.getAbsolutePath(), "-i", image1,
"-i", image2, "-i", image3, "- 
filter_complex","[0][1]overlay=x=W/2-w/2:y=H/2- 
h/2:enable='between(t,2,10)'[v1];[v1][2]overlay=x=W/2-w/2:y=H/2- 
h/2:enable='between(t,10,20)'[v2];[v2][3]overlay=x=W/2-w/2:y=H/2- 
h/2:enable='gt(t,20)'[v3]","-map", "[v3]", outputPath};

图像叠加命令

String[] command = {"-i", inputPath, "-i", 
image,"-filter_complex","overlay=(main_w-overlay_w)/2: 
(main_h-overlay_h)/2","-codec:a", "copy", outputPath};

裁剪命令

String[] command = {"-i", inputPath, "-filter:v", "crop=iw/2:ih:" 
+ 0 + ":" + 0, "-c:a", "copy", outputPath};

效果

String[] command = {"-i", inputPath, "-loop", "1", "-t", "2", "- 
i", image1, "-loop", "1", "-t", "2", "-i", 
image2, "-filter_complex", " 
[0]boxblur=enable='lt(t,2)+gt(t,10)'[vid]; 
[1:v]format=rgba,fade=in:st=0:d=0.5:alpha=1,
fade=out:st=1.5:d=0.5:alpha=1[img1]; 
[2:v]format=rgba,fade=in:st=0:d=0.5:alpha=1,
fade=out:st=1.5:d=0.5:alpha=1,setpts 
=PTS+10/TB[img2];[vid][img1]overlay=(main_w-overlay_w)/2:(main_h- 
overlay_h)/2[bkg];[bkg][img2]overlay=(main_w-overlay_w)/2:(main_h- 
overlay_h)/2", "-preset", "ultrafast", "-c:a", "copy", outputPath};

但是我不知道如何将所有这些结合到一个命令中。请帮帮我。

谢谢。

0 个答案:

没有答案