I want to batch merge mp3 audio files where every single file has a specific start time. So below is the fluent-ffmpeg spawn I use right now to merge 3 files with each starting at respectively 200, 7400 and 10600.
ffmpeg -i firstFile.mp3 -i secondFile.mp3 -i thirdFile.mp3 -filter_complex
[0]adelay=200[a0];[1]adelay=7400[a1];[2]adelay=10600[a2];[a0][a1]
[a2]amix=inputs=3:dropout_transition=1000,volume=3 -f mp3 pipe:1
This works pretty good, except for longer files re-encoding makes the process take real long. So I wanted to do the same thing using concat demuxer. Since I already know how long each audio file is, I've put in silent audio files between them to create a delay until next audio file so it actually starts on the time position it is supposed to.
#concatfile.txt
file silence.mp3
outpoint 200
file firstFile.mp3
file silence.mp3
outpoint 1500
file secondFile.mp3
file silence.mp3
outpoint 2000
file thirdFile.mp3
ffmpeg -f concat -safe 0 -i concatfile.txt -c copy output.mp3
This solution also works okay when merging few files but when I merge higher count of files like 30 or 40 result file will have a slowly increasing synchronization problem where audio files actually start later than the start timestamps they are supposed to have.
Looks like an issue similar to this post
I'm open for any suggestion on solving the issue.