Single Command to crop, animate (effects) and add

2019-08-19 04:57发布

问题:

I want to create a command where i can perform single operation.

I have few commands which are working well individually

Add Background Music Command

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

Multiple Image OverLay Command

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

Image OverLay Command

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

Cropping Command

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

Effect

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

But I don't have any clue how to combine this all to one single command. Please help me out.

Thanks in advance.