Improved Interleaving in MP4 Multiplexor

I’ve improved the interleaving in the MP4 multiplexor to limit the maximum offset between the same timestamp in different streams. Previously, the multiplexor would divide up streams into chunks of about 1 second, and the offset between the same timestamp in different streams could be as much as 2 seconds’ of data.

In this version, there is a 400kb limit on the interleave size, and a few other changes to ensure that one stream does not run ahead of the others. Search for MAX_INTERLEAVE_SIZE if you want to change this limit from 400kb. The previous one second limit is applied as well, so each interleave piece must be smaller than both the time and byte size limits.

I’ve also incorporated some comments on NALU parsing from Dmitri Vasilyev and added support for ADTS AAC audio.

Download the latest source and binary here.

3rd April 2013