简体   繁体   中英

Offset of Frames/Pixel Data for MP4 file?

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.

  1. How do I know the offset from the start of the file, so that I can extract the 'frame video size'?

  2. Where can I find all the frames and their pixel data?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM