I am trying to parse a mp4 and able to do parse moov
but not sure how to use moov
information to parse mdat
.
My goal is to get the track info like metadata and if possible frames from mdat
as it contains the video and audio data.
currently following QuickTime File Format Specification
Tried with Sample-to-Chunk Atoms
but all my stsc (20 bytes) looks like this:
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0]
[0 0 0 1]
[0 0 0 1 0 0 0 1]
[0 0 0 1]
fmt.Println(binary.BigEndian.Uint32(buf[0:4])) //4
fmt.Println(binary.BigEndian.Uint32(buf[4:8])) //4
fmt.Println(binary.BigEndian.Uint32(buf[8:16])) //8
fmt.Println(binary.BigEndian.Uint32(buf[16:20])) //4
Don't know currently how to approach and parse mdat
atoms.
Any help would be appreciated!
buf[0:3]
andbuf[4:7]
etc...? Your first four bytes are[0] [1] [2] [3]
so why read up to[4]
? – Finesse