Android 如何使用FFMPEG合并两个视频?

Android 如何使用FFMPEG合并两个视频?,android,ffmpeg,Android,Ffmpeg,inputCode是执行字符串。ffmpeg命令应为 String Tmp1 = Environment.getExternalStorageDirectory() + "/" + "scary.mp4"; inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()), "-i", Tmp1, "-i", VideoPath, "-filter_complex",

inputCode是执行字符串。

ffmpeg命令应为

String Tmp1 = Environment.getExternalStorageDirectory() + "/" + "scary.mp4";
inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),
                "-i", Tmp1, "-i", VideoPath, "-filter_complex",
                "[0:v][1:v]blend=all_mode='overlay':all_opacity=0.8[v_out]", "-map", "[v_out]", "-map", "0:a", "-strict", "-2", VideoPath};

输入和输出文件不相同

使用此命令成功地将文件完全边缘化

   String Tmp1 = Environment.getExternalStorageDirectory() + "/" + "scary.mp4";
    inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),
                    "-i", Tmp1, "-i", VideoPath, "-filter_complex",
                    "[0:v][1:v]blend=all_mode='overlay':all_opacity=0.8[v_out]", "-map", "[v_out]", "-map", "0:a", "-strict", "-2", "/sdcard/OutPutVideo.mp4"};

谢谢

您提供的代码有什么问题?交叉检查应保存输出的驱动器名称可能找不到ffmpeg目录,并且您为不允许的输入和输出传递了VideoPath我认为命令中存在一些问题,因为没有生成输出文件。你能检查一下这个命令吗@Vinesh ChauhanW/System.err:java.io.IOException:运行exec时出错。命令:[/data/user/0/photo.edit.scaryvideomaker/files/ffmpeg,-i,/storage/emulated/0/ThugsLifeVideoMaker/videofiles/TL1537877161938.mp4,-filter_complex,[0:v][1:v]blend=all_mode='overlay':all_不透明=0.8[v_out],-map,[v_out],-map,0:a,-strict,-2,/sdcard/OutPutVideo.mp4]工作目录:null环境:nullhave you Initialize FFMPegeInputCode=new String[]{FileUtils.GetFFMPegetApplicationContext,-y,-i,InputPath1,-i,InputPath2,-strict,experimental,-filter_complex,[0:v]scale=480x640,setsar=1:1[v0];[1:v]scale=480x640,setsar=1:1[v1];[v0][0:a][v1:a]concat=n=2:v=1:a=1,-ab,48000,-ac,2,-ar,22050,-s,480x640,-r,30,-vcodec,mpeg4,-b,2097k,OutPutPath};
inputCode = new String[]{FileUtils.getFFmpeg(getApplicationContext()),"-y","-i",InputPath1, "-i",InputPath2,"-strict","experimental", "-filter_complex", "[0:v]scale=480x640,setsar=1:1[v0];[1:v]scale=480x640,setsar=1:1[v1];[v0][0:a][v1][1:a] concat=n=2:v=1:a=1", "-ab","48000","-ac","2","-ar","22050","-s","480x640","-r","30","-vcodec","mpeg4","-b","2097k",OutPutPath};