/Atoms

mp4/mov file parser

Primary LanguageObjective-CMIT LicenseMIT

Atoms

Quick and dirty mp4/mov file parser. Contains Objective-c (more complete, including basic stco and uuid editing) and cpp (basic) implementations. I used these in a previous life to inspect atom layout in video files, someone might find them useful too.

Sample output:

File read: 'Video.mp4'
[MP4File: 4 top level atoms]
['file'][0 + 4860557(4860557): 4860557]
 ├─['ftyp'][0 + 32(32): 32]
 ├─['moov'][32 + 42133(42133): 42165]
 │  ├─['mvhd'][40 + 108(108): 148]
 │  ├─['trak'][148 + 29274(29274): 29422] [vide]
 │  │  ├─['tkhd'][156 + 92(92): 248]
 │  │  ├─['edts'][248 + 36(36): 284]
 │  │  └─['mdia'][284 + 29138(29138): 29422]
 │  │     ├─['mdhd'][292 + 32(32): 324]
 │  │     ├─['hdlr'][324 + 45(45): 369] [vide]
 │  │     └─['minf'][369 + 29053(29053): 29422]
 │  │        ├─['vmhd'][377 + 20(20): 397]
 │  │        ├─['dinf'][397 + 36(36): 433]
 │  │        │  └─['dref'][405 + 28(28): 433]
 │  │        └─['stbl'][433 + 28989(28989): 29422]
 │  │           ├─['stsd'][441 + 165(165): 606]
 │  │           ├─['stts'][606 + 24(24): 630]
 │  │           ├─['stss'][630 + 104(104): 734]
 │  │           ├─['stsc'][734 + 14224(14224): 14958]
 │  │           ├─['stsz'][14958 + 8420(8420): 23378]
 │  │           └─['stco'][23378 + 6044(6044): 29422] 1507 entries
 │  ├─['trak'][29422 + 12593(12593): 42015] [soun]
 │  │  ├─['tkhd'][29430 + 92(92): 29522]
 │  │  ├─['edts'][29522 + 36(36): 29558]
 │  │  └─['mdia'][29558 + 12457(12457): 42015]
 │  │     ├─['mdhd'][29566 + 32(32): 29598]
 │  │     ├─['hdlr'][29598 + 45(45): 29643] [soun]
 │  │     └─['minf'][29643 + 12372(12372): 42015]
 │  │        ├─['smhd'][29651 + 16(16): 29667]
 │  │        ├─['dinf'][29667 + 36(36): 29703]
 │  │        │  └─['dref'][29675 + 28(28): 29703]
 │  │        └─['stbl'][29703 + 12312(12312): 42015]
 │  │           ├─['stsd'][29711 + 106(106): 29817]
 │  │           ├─['stts'][29817 + 24(24): 29841]
 │  │           ├─['stsc'][29841 + 28(28): 29869]
 │  │           ├─['stsz'][29869 + 6048(6048): 35917]
 │  │           ├─['stco'][35917 + 6044(6044): 41961] 1507 entries
 │  │           ├─['sgpd'][41961 + 26(26): 41987]
 │  │           └─['sbgp'][41987 + 28(28): 42015]
 │  └─['udta'][42015 + 150(150): 42165]
 │     └─['meta'][42023 + 142(142): 42165]
 ├─['free'][42165 + 8(8): 42173]
 └─['mdat'][42173 + 4818384(4818384): 4860557]