Video formats usually have two technology: containers and codecs. A container is like a wrapper of the video/audio data. Codecs are used inside of a container to encode the video and audio data. The container describes the structure and it is used to package the video and its components including audio, metadata, subtitles, etc. MP4 is one of the most popular video container formats. MP4 is considered a digital multimedia container format, essentially a file containing a bunch of data compressed.

The MP4 or other video container formats specifies how the data is stored within the container itself, but not how that data is encoded. Codec is a way of encoding audio or video into a stream of bytes. Different codecs have different features and varying quality. H.264 is the most commonly used codecs for mp4 video files. With the high degree of compression codec used in MP4 videos, this allows the files to be much smaller in size than other video formats. Reducing the file size does not immediately impact the quality of the file, either. Almost all of the original quality is retained. This makes MP4 a portable and web-friendly video format.

An MP4 file usually contains the following data atoms: ftyp, pdin, moov, moof, mfra, stts, stsc, meta. The moov atom is the most important atom which defines the timescale, duration, display characteristics of the video, as well as subatoms containing information for each track in the video. More detailed mp4 file format and structure information can be found from:

MP4 Layout | Introduction to QuickTime File Format Specification