I'm trying to locate h264 frames in the mp4 container of a segmented file(styp). For the segmentation I'm currently using MP4Box dash. I used MP4Box parser and I noticed that in each keyframe(IDR) the size of the sample is different than the size of the same frame in the original file. I calculated the difference and it's always 37 bytes for the same file in other segments.
What do these bytes represent? They only appear in the segmented mp4 file types before each keyframe. I tested with other files and the number of these bytes vary slightly(other file was 39 bytes) and are not the same data(they share some byte patterns though). Is this something from the mp4 standard or H264 or even MP4Box? I don't have a clue.
00 00 00 19 67 ...
- H.264 SPS NAL 0x19 (25) + 4 = 29 bytes size
00 00 00 04 68 ...
- H.264 PPS NAL 0x04 (4) + 4 = 8 bytes size
In sum this gives 29 + 8 = 37 bytes of SPS/PPS. Usually for mp4 (avc1 samples) SPS/PPS are not present inband (mdat box) and stored out-of-band in avcC box. But that is not strict rule afaik and SPS/PPS can be both inband and out-of-band or out-of-band only as for avc3 samples.