Skip to main content

Module mp4

Module mp4 

Source
Expand description

MP4 and M4A: the ISO base media file format carrying tracks rather than a picture.

§Why this is edited by deletion where HEIF is rebuilt

stco holds absolute file offsets into mdat (§8.7.5), so removing a box in front of the media moves every chunk. ADR-0034 met that sentence in HEIF and rebuilt the file; here it reverses. HEIF’s metadata is inside mdat, interleaved with the picture, so removals leave a hole and nothing translates uniformly. MP4’s metadata is entirely outside mdat — udta, meta, a top-level uuid — so each mdat moves as one rigid block and the media never changes.

The tree is therefore filtered and re-emitted: ftyp and every mdat cross verbatim, header form included, and only moov is written fresh. Every chunk offset is then remapped through a table of mdat extents, and an offset that resolves inside none of them refuses the file rather than being nudged by a delta nobody verified (ADR-0042).

Fragmented files and encrypted files are refused by name: the first keeps sample offsets in structures this handler does not rewrite, the second is ciphertext no rule here matches.

Structs§

Mp4Handler
The MP4 and M4A handler. One type, one instance per format, as super::heif does.