Video file structure Studies

Video file structure

All computer files have a structure, and video files have several common variations. This page describes several of them. Typical names include MP4, 3GP, MOV, AVI, MTS, MPEG, MXF.

A video file typically contains two data streams, video and audio. Recent devices such as GoPro also have a stream with GPS location and motion information. The video and audio stream are compressed using a CODEC (Compress/Decode) routine to reduce the file size considerably. The format name one sees is a container around the data streams. This container normally has pointers to frames etc to make navigation of a file quick. The container will also keep the file metadata, eg dates, type of codec and camera used.

MP4, 3GP, MOV, Apple Quick Time
These formats have almost identical structures for the metadata. Such files have three sections - atoms. ftyp, moov and mdat. The order we see of these atoms can be either
<ftyp><moov><mdat> or <ftyp><mdat><moov>
ftyp - this is simple small header
mdat - this is where all the video, audio and other data is saved
moov - the metadata, indexes etc

When a video file is recorded, the mdat is written/saved in real time. This file is often limited to 4GB in length to remain comptaible with a FAT32 memory chip, but there are versions that will write any length. NB in these internal file pointers have to be larger than 32bit. Thus the moov atom can often be written at the end of the file. When a recording starts there is no way to know how large the moov atom is going to be.
On some cameras a large area is allocated in an ftyp-moov-mdat configuration, and the end of the atom is padded. The other solution is to manipulate the FAT table so that the moov atom can be physically stored at the end of the file, but logically look as if it is at the start of the file. This is one reason that many MP4 files on the memory chip are not sequential. GPR processes this correctly and automatically.

AVI is a fairly common compact camera format. It may be best described as a 'tagged' structure. After the main header 'RIFF' there are 4 byte tags with an associated 4 byte length. Each tag describes the following section, typically audio or video data. The end of the file saves index pointers. GPR does not support this format. To process this type of file use
CnW Recovery software.