我有几个 M4A(声音)文件。我想合并成一个声音文件。这可以在android中使用ffmpeg库吗?
我试过这种方式。
public void myFunctionMergeAudioFiles(ShellCallback sc,List<String> mListFiles, String outPath) throws IOException, InterruptedException
{
ArrayList<String> cmd = new ArrayList<String>();
cmd = new ArrayList<String>();
cmd.add(ffmpegBin);
cmd.add("f");
cmd.add("concat");
cmd.add("-i");
for(int i=0;i<mListFiles.size();i++){
cmd.add(new File(mListFiles.get(i)).getCanonicalPath());
}
cmd.add("-c");
cmd.add("-acodec");
cmd.add("aac");
cmd.add("copy");
File fileOut = new File(outPath);
cmd.add(fileOut.getCanonicalPath());
execFFMPEG(cmd, sc);
}
我的日志:-
01-23 15:32:17.841: D/FFMPEG(12678): /data/app-lib/com.apps.messagingapp-1/libffmpeg.so f concat -i /storage/emulated/0/MGOApp/Temp/Recording #1_0.m4a /storage/emulated/0/MGOApp/Temp/Recording #1_1.m4a /storage/emulated/0/MGOApp/Temp/Recording #1_2.m4a -c -acodec aac copy /storage/emulated/0/MGOApp/Recording #1.m4a
但我没有收到任何错误。提前致谢。