Concatenate multiple mp4 audio files using android´s MediaMuxer

纵饮孤独 提交于 2019-11-29 12:08:07

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!