Indexing (MOOV atom) in H264 video files

Last update : July 8, 2013

MOOV atom

QTIndexSwapper 2 (to move MOOV atom)

When a streaming mp4 H264 video file won’t play immediately in a Flash video player, the reason could be a quicktime (QT) Index problem. This index is called MOOV atom. The moov atom, also referred to as the movie atom, defines the timescale, duration, display characteristics of the movie, as well as subatoms containing information for each track in the movie.

Often the moov atom is located at the end of the video file and the Flash player needs to load the entire file to read this information. The solution is simple: Move the moov atom from the end of the file to the beginning. Renaun Erickson, Developer Evangelist for Adobe Systems Inc., created a simple tool called QTIndexSwapper 2 (version 2.3.8) to do this job. This AIR application can be downloaded from his blog. Another tool to move the moov atom is MP4 FastStart (version 1.0.0). A tool with a similar name qt-faststart is available for ffmpeg :

qt-faststart old.mp4 new.mp4

Because the moov atom uses absolute file sizes in its format, putting at the beginning of the file before the entire file has been created isn’t possible. The only way to move it to the beginning is to generate the entire file with the moov atom at the end, and then re-process the entire file to move it to the beginning. This is done by Handbrake. If you use this tool to convert videos, the moov atom is set correctly if you select “web optimized”.

To see if the moov atom is at the beginning of a video, you can open the file in a text editor and look for “moov” string in the raw output:

^@^@^@ ftypisom^@^@^B^@isomiso2avc1mp41^@^Eï moov^@^@^@lmvhd

More informations about atoms in mp4 files are available at the following links :