You can think of the
moov atom is something like the global "index table" of the MP4 file. It can be located at the beginning of the file (before
mdat atom) or at the end of the file (after
mdat atom).
For local file playback it doesn't matter much, but for streaming (progressive download) you want to have the
moov atom at the beginning of the file - for obvious reasons.
However, x264 will
append the frames to the MP4 file as they are encoded. And, since the exact size of each frame cannot be known before they have actually been encoded, the index (
moov atom) will be written
last, at the end of the file.
So you cannot make x264 output an MP4 file with
moov atom at the beginning. At least not directly. But you can achieve this easily with a tool like MP4Box or AtomicParsley!
Code:
mp4box.exe -add c:\Temp\input.mp4 c:\Temp\output.mp4