Log in

View Full Version : How to tell if a mp4 file has metadata at the begining or not?


karasu
5th September 2013, 08:25
As I'm working with files for the web, I sometimes need to know if the mp4 files I recieve have their metadata at the begining. Mediainfo does not seems to provide such informations.
What tool can I use to check that? (Linux or OSX)

Thank you.

sneaker_ger
5th September 2013, 08:50
With the l-smash (http://code.google.com/p/l-smash/) boxdumper you could look whether the Media Data Box is at the end or not.

LoRd_MuldeR
5th September 2013, 18:08
Parsing MP4 files is not that complicated. You always have "boxes" (aka "atoms"), each of which starts with an 8 Byte header (4 Byte size field + 4 Byte name in ASCII).

Boxes may also contain other boxes, but you don't need to care here. Just do the following in a loop: Read the 8 Byte header, then check the name and finally skip over exactly size-8 Bytes to the next box.

Either you will encounter the "moov" box before the "mdat" box - or the other way around. All the meta-data and all the fancy tables are stored within the "moov" box.

ganymede
5th September 2013, 19:02
What tool can I use to check that? (Linux or OSX)MP4Box from the gpac package (http://gpac.wp.mines-telecom.fr/mp4box/) can do that.
MP4Box -info -v file.mp4
If you only need to check that moov is before mdat, -v (verbose) is not even necessary : MP4Box -info will display "File suitable for progressive download (moov before mdat)".

karasu
7th September 2013, 15:46
Thank you, MP4Box is exactly the tool I need.