The very first box in a real MP4 is ftyp, which declares the file's brand - what flavour of the format it is and what it is compatible with. Today you parse its payload, giving you the first box whose contents you can actually read and print.
Parse an ftyp payload into a major brand, a minor version, and a list of compatible brands.
ftyp is the file-type box and it comes first. Its payload is a major brand
(a fourcc naming the primary spec the file claims, like isom or mp42), a
minor version (a 32-bit number - here 0x00000200 = 512), and then a list of
compatible brands, each a fourcc, filling the rest of the payload. A player
reads these to decide whether it can handle the file at all.
The compatible-brands list has no count field: you read 4-byte brands until you run out of payload, so knowing the payload length exactly (from the box size minus the header) is what tells you when to stop. That payload-length arithmetic is the first thing you formalise in the next chapter, where boxes start nesting inside each other.
type FileType struct {MajorBrand stringMinorVersion uint32CompatibleBrands []string}// payload = major(4) + minor(4) + N * brand(4) until payload endsfunc parseFtyp(payload []byte) FileType { /* fill in */ }