1. Since each invocation of TcasSub will create a frame buffer which is just the same size as the video resolution, e.g. for a 720p video, 1280 * 720 * 4 bytes of buffer will be created for each frame with each TcasSub invocation. So if we can merge two TCAS files into one, we can save the resource and time of allocating extra buffers.
2. By merging, we can also save some I/O
How We Can Merge
1. Think of the parsed TCAS file. If the two TCAS files have certain common properties, we can parse the two at the same time into one single TCAS file.
2. Actually, we even do not need the two files have some common properties. Again, think of the rendering of TCAS files into a single video, we just use two TcasSub invocation, regardless of the types or properties the TCAS file has.
3. So, we can negotiate the two to make a common header.
4. But to simplify the process, and concentrate on the practical use, we require the two TCAS files have the same type resolution and frame rate.
Common Header for the Output TCAS Files
1. Except for minTime maxTime and chunks, the header of the output TCAS file simply copies the header of the first input TCAS file, since the two input files have all that things in common.
2. the minTime and maxTime is calculated through min(minTime1, minTime2) and max(maxTime1, maxTime2)