Skip to content

Verified way of saving custom metadata in mp4 files

Mradul Dubey edited this page Sep 26, 2022 · 4 revisions

The header of a mp4 file (moov) box has movie header(mvhd) and track headers (trak/tkhd) boxes to store metadata. But the format of these boxes is pretty much fixed.

Any other metadata given by user can be saved in the user data box (udata) box.

  • Inside the moov/udata there is a meta box.
  • Each meta box has a given structure: hdlr and ilst. The ilst box is a item list box similar to
  • box in html or map in programming.
  • Each element in ilst has a key box which has the data box.
  • The value is stored in data.Value

Important: For the metadata stored in moov/udta/ilst/ the length of the keys has to be 4.

Side Note: there is also a moov/meta box which stores all metadata key value pairs with key format starting with com.*.* but I havent been able to get it to work.