我试过以下这件事 首先,我使用两个这样的图像创建视频 -
String originalPath= “file “+”‘”+picturePath1+”‘”+”\n”+ “duration 3 \n”+”file “+”‘”+picturePath2+”‘”+”\n”+ “duration 3+”‘”+picturePath2+”‘””;
File myFile= generateTextFile(“MyTextFile”,originalPath); // here i convert into text file
执行完命令后,
String command[] = {“-y”, “-f”, “concat”, “-safe”, “0”, “-i”,myFile.getAbsolutePath(), “-vsync”, “vfr”, “-pix_fmt”, “yuv420p”, VideoSavePath};
能够在以下命令
中创建视频并使用创建的视频路径(VideoSavePath)String mutipleVideo[] = {“-y”, “-i”, firstVideoPath, “-i”,secondVideoPath , “-i”, VideoSavePath, “-filter_complex”,
“[0:v]scale=480×640,setsar=1[v0];[1:v]scale=480×640,setsar=1[v1];[2:v]scale=480×640,setsar=1[v2];[v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1”,
“-ab”, “48000”, “-ac”, “2”, “-ar”, “22050”, “-s”, “480×640”, “-vcodec”, “libx264″,”-crf”,”27″,”-preset”, “ultrafast”, newFinalVideoPath};
但是我在使用videopath从第一个命令获取时遇到错误(匹配没有流),如果我使用一些随机视频来代替VideoSavePath,那么第二个命令工作正常