Is there a downside to putting the MOOV atom at the beginning of an MP4 file?

Coderer picture Coderer · Mar 27, 2013 · Viewed 13.3k times · Source

I see tons of questions about relocating the moov atom from the end of a MP4 video container to the beginning, to make the video "web optimized" or easier to stream. It seems like most tools require an explicit option to do this when first encoding the video, if it's available at all.

If placing the atom at the beginning makes streaming work better, and it's costly to do it after-the-fact, why would I ever want to encode video with the atom at the end? What's the benefit?

Answer

SirDarius picture SirDarius · Mar 27, 2013

Encoding the MOOV at the end of the file is usually a default operation for video encoders because they tend to operate by writing the output file in one-pass, and the exact contents and size of the MOOV atom can only be known after having written audio and video data entirely, because it contains absolute file sizes.

FFmpeg allows you to do a second pass and move the atom to the beginning with -movflags +faststart.

Having the MOOV atom at the end has no special benefit, it is just not as inconvenient in local playback situations where seeking at end-of-file before playback is not as costly as in progressive download delivery.