I am trying to concatenate multiple mp4 audio files (each containing only one audio track, all recorded with the same MediaRecorder and the same parameters) into one using t
I am looking to do the same, and thinking about it more, it can't work. Wished it did, because I need it too. It's like trying to push two bottles together and expecting them to become one bigger bottle. You need to take the... beer? from each (decode audio from each file) and then pour it in a new bottle (encode audio again, feeding from the second one when the first is done)... Once the bottle is capped, you cannot add more beer in it
Formally you can't join 2 encoded audio tracks: each track could be encoded with different parameters which are stored in headers. For sure if both files were created by the same encoder\muxer, same encoding parameters and both headers are equal it can work, but it is rather strict limitation. As far as i see you set audio format (it contains headers) to audio track in muxer to format from 1st file. So if 2nd file audio format differs it can cause different sorts of errors resulting in not correct second file audio.
Please try to put one source file twice to dst file, as first and second. If it works - than the problem is in headers. If not - then somewhere else, i think.