我正在尝试在图像上放置多个图像/ gif。我曾尝试在图像或视频上放置单个gif,它的工作效果很好,但无法同时缩放多个图像。尝试下面的代码,但出现错误:
String[] command=new String[13];
command[0]="-i";
command[1]=input;
command[2]="-i";
command[3]=thumbnail2;
command[4]="-i";
command[5]=thumbnail;
command[6]="filter_complex";
command[7]="[0:v]scale=0:0[base]";
command[8]="[1:v]scale=30:-1[img1]";
command[9]="[2:v]scale=3000:-1[img2]";
command[10]="[base][img1]overlay=70:70[tmp1]";
command[11]="[tmp1][img2]overlay=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2[out]";
command[12]="/storage/emulated/0/Pictures/logo-2000.gif";
fFmpeg.execute(command,
new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {
//for logcat
Log.w(TAG,"Cut started");
}
@Override
public void onProgress(String message) {
Log.w(TAG,message.toString());
}
@Override
public void onFailure(String message) {
Log.w(TAG,message.toString());
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(String message) {
Log.w(TAG,message.toString());
Toast.makeText(getApplicationContext(),"sucessfully saved",Toast.LENGTH_SHORT).show();
}
@Override
public void onFinish() {
Log.w(TAG,"Cutting video finished");
}
});
我遇到的错误是:
[NULL @ 0xb6591800]无法为'filter_complex'找到合适的输出格式 filter_complex:参数无效
由于我是ffmpeg的新手,请帮助我解决我仅想同时缩放和覆盖多张图像的问题。
答案 0 :(得分:1)
您需要:
-filter_complex
代替filter_complex
-filter_complex
所以代替:
...
command[6]="filter_complex";
command[7]="[0:v]scale=0:0[base]";
command[8]="[1:v]scale=30:-1[img1]";
...
要做:
...
command[6]="-filter_complex";
command[7]="[0:v]scale=0:0[base];[1:v]scale=30:-1[img1];...";
...
如您所见,所有过滤器都需要在一项中指定。