Sri
4th June 2009, 19:19
:helpful:I have a question regarding the MPEG4 stream. I have finished developing the code to parse the mpeg4 file. I have successfully finished parsing all the boxes except one box, mdat. I able to get all the information of trak boxes, including stsc, stsz, stco boxes of each trak found in the stream. But I am unable to use the data to map them in to mdat box. The stsz box gives the sample sizes, stco gives the chunk offset in the stream from the start of file, stsc gives the samples per chunk and sample description index indicating to which sample description it belongs. My question is, how do we use stco, stsc, stsz data to get the samples (audio and video data) from mdat. According to standards and explanation found on online, a group of samples are grouped under a chunk from a trak (video or audio). These chunks are interleaved with different trak data. Therefore to get data of video get the offset from stco box records and associated stsc entry, stsz entry which is size added to given offset gives where the required sample can be found. But none of the data gives the size of the sample, how many bytes to read. I am stuck here to demultiplex the MPEG4 stream. Also, I did try to use in a way that I take the stsz records as samples sizes of the first chunk samples based on number of samples given in stsc record for each chunk offset given in the stco record. I am not sure to use the data the way I am using. Please help me to make me understand the how to use data. Thank you.