Reputation: 413
i'm working on merging multiple audio merge and i'm using this command
(in below command tempTxtFile is file for all audiopath)
cmd = "-f concat -safe 0 -i " + tempTxtFile + " -c copy -preset ultrafast " + filepath;
well, because i'm using -c copy it only works if selected audios are of codec mp3,but if i will use mp3 and m4a(aac) or both m4a audios,it is preventing me from merge.
So, i now i'm using another command which is as follows(for 2 audios):
cmd = "-f concat -safe 0 -i " + tempTxtFile + " -filter_complex [0:a][1:a]" + "concat=n=2:v=0:a=1[outa] -map [outa] -c:a mp3 -preset ultrafast " + filepath;
This command showing me given error when running
Invalid file index 1 in filtergraph description [0:a][1:a]concat=n=2:v=0:a=1[outa].
This is whole log
Input #0, concat, from '/storage/emulated/0/Download/tempFile.txt':
Duration: N/A, start: 0.000000, bitrate: 117 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 117 kb/s
Metadata:
handler_name : SoundHandler
Invalid file index 1 in filtergraph description [0:a][1:a]concat=n=2:v=0:a=1[outa].
Right now i'm not able to do anything and don't know any working solution.
Upvotes: 0
Views: 1186
Reputation: 92928
When codecs are different across files, you should feed all inputs individually and then use the concat filter e.g.
ffmpeg -i file1 -i file2 -i file3 -filter_complex concat=n=3:v=0:a=1 -c:a mp3 -vn out.mp3
Upvotes: 2