3DExtended
3DExtended

Reputation: 151

How to get pixelcolor for given frame from mp4 files? - Without libs

I want to get the pixel color for a frame from a mp4-file.

My code structure:

  1. I load the file in bytes
  2. I read the header file to get important information
  3. I make a data struct for the mdat container

My question is now: How is the data about the shown image stored in a mp4-file? I found this spec-information, but I can't figure out, how to read the needed data.

I don't want to use any libaries or packages.

I hope you can help me. (Every hint can help)

Upvotes: 1

Views: 1256

Answers (1)

szatmary
szatmary

Reputation: 31120

You don't. mp4 is just a container format. The video is compressed using a codec. The spec you pointed to will tell you how to locate a coded frame, Once you parse the mp4 file, you will need to decode the frame to read the pixel values. While it is of course 'possible' to write all this yourself, It would require tens or hundreds, of thousands of lines of code. And that is after you have studied and understood the full specification. If the video is h.264 for example, the specification is over 750 pages. And that is assume you already understand concepts around integer inverse discreet cosine transformation, subpixel motion estimation/vectors, deblocking, content adaptive binary arithmetic coding, just to name a few things.

TLDR use a library

Upvotes: 2

Related Questions