GPMF structure (link to GPMF structure document)
GPMF structure (link to GPMF structure document)
Find the track's hdlr atom and check if the componentSubType = "meta". There can be several tracks with meta data. GPMF is meta data.
- /moov/trak/mdia/hdlr
From that same track find the stsd atom. It will contain a sample description table where the entry should contain dataFormat = 'gpmd'
- /moov/trak/mdia/minf/stbl/stsd
Samples are read from the track in chunks of samples. The MP4 atom containing the chunk offsets table for that track that points into the MP4 file where those chunks start. One of the following 2 chunk offsets tables will be present depending on the size of the video. We will call a chunk from now on a payload.
- /moov/trak/mdia/minf/stbl/stco (32 bit values)
- /moov/trak/mdia/minf/stbl/co64 (64 bit values)
There is also an MP4 chunk size table with the same amount of entries as the chunk offset table. You could retrieve that also of you want to. But with good coding it's not really needed. And ... I don't need it :)
- /moov/trak/mdia/minf/stbl/stsz
Check this link for a full GPMF data structure reference. The GPMF payload exists of klv blocks that are nested with each other to get all the needed meta data samples. Each data type has a stream (STRM) that includes a table of the samples for that payload, the scaling factor, the units type and more data. The values are presented in itegers that need to be devided by the scalar integer value to get a precise float value.
In progress ...