FFMPEG set -ss and -to with string

2019-09-15 11:06发布

问题:

I know I can set the start with -ss and end with -to but can someone please help me to format the following so that I can enter the -ss and -to with a string?

I want -ss to come from

String start = editStart.getText().toString();

and -to to come from

String end = editEnd.getText().toString();

Here is my ffmpeg string I want to edit, I have entered -ss and -to to show where I want the above strings to be.

String s = "-i" + " " + mVideoUri.toString().replace("file:///", "") + " -filter_complex [1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v] -ss -to -map [v]" + directoryToStore + "/" + FileName + mp4;

String[] arguments = s.split(" ");

ExecuteFFMPEG(arguments);

回答1:

Ok so you get your start and end point from:

String start = editStart.getText().toString();  
String end = editEnd.getText().toString();

So instead of splitting the argument do this instead:

String[] s = {"-i" ,mVideoUri.toString(),"-filter_complex","[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v]","-ss","start","-to","end","-map","[v]",directoryToStore+"/"+"output.mp4"};
ExecuteFFMPEG(s);