The stbl box holds the sample tables, and the first is stsd, which names the codec each track uses. Today you parse its entry count and the codec fourcc, telling you whether a track is avc1, mp4a, and so on.
Parse an stsd box to its entry count and first sample entry's format fourcc.
stbl, the sample table box, is where a track describes its actual media samples,
and stsd (sample description) comes first. It is a FullBox with an
entry_count followed by that many sample entries. Each entry begins with its
own size and a format fourcc naming the codec: avc1 for H.264 video, mp4a
for AAC audio, and so on. The MP4 Registration Authority lists them all.
The layout is a FullBox prefix (4), then entry_count (4), then the first entry: its size (4) at offset 8 and its format at offset 12. You only need the format fourcc for a summary, so read it and stop - the rest of the entry describes codec-specific configuration that decoding, not parsing, would use. This is the box that turns “there is a video track” into “there is an H.264 video track.”
// FullBox prefix(4) + entry_count(4), then each sample entry is// size(4) + format(4 fourcc) + ...func parseStsd(payload []byte) (count uint32, codec string) {count = readU32(payload[4:8]) // after the FullBox prefixcodec = readType(payload[12:16]) // first entry's format fourcc}