Reputation: 141
See this documentation for mp4 file format, it's one of the clearest I found: http://xhelmboyx.tripod.com/formats/mp4-layout.txt
If you search for: 4 bytes video frame pixel size
You'll find the line with that text.
How do I know the offset from the start of the file, so that I can extract the 'frame video size'?
Where can I find all the frames and their pixel data?
Upvotes: 0
Views: 1254
Reputation: 11934
First of all, the linked file is quite poor - to actually understand the MP4 structure you should read the ISO 14496-12 standard (zipped version here). As to your questions:
1) You can't. There is no fixed offset. The structure may change since there are mandatory and optional boxes so in each file the tkhd
box which has the data you want can be at a different offset. Worst case you can scan through the file for the tkhd
box id and then try to parse that box (see the layout of it in the specification). But beware that there could by multiple tracks.
2) Frames are encoded so you do not have "pixel data" - you have "compressed video stream" which must decoded. The actual offsets can be calculated. The binary data lie inside mdat
boxes, but you must know the actual video payload sizes from other boxes to know where to split them.
Upvotes: 2