Share with
your colleagues!

Video ads and the MP4 MOOV atom

Written by Roy
Jan 9, 2023 • 5 min read
PDF Version
Download instantly
AdValify.io chevron_right Knowledge Base chevron_right
Video & VAST
PDF Version
Download instantly

The position of the MOOV atom in an MP4 file is important when serving video ad content. Placing the MOOV atom at the correct position will allow video ads to start more efficiently.

In this article, written for ad ops professionals and ad server vendors, you'll learn all about it.

What is the MOOV atom?

The MOOV atom (movie atom) is an important component of the MP4 video format and contains information about the file structure, the video duration and the exact location of the media stream.

The MP4 container contains many data structures, each with their own function. Important ones are ftype, mdat and moov which I'll briefly discuss here.

  • ftype: a data structure containing information about the file type
  • mvhd: an atom contains information about the video's start time, duration and time scale
  • mdia: this atom holds information regarding the the media type (audio/video) and the codec used
  • minf: sample data of each track including sample rate, size and metadata is stored here
  • mdat: container containing the compressed MP4 video/audio binary data
  • moov: and finally, this atom contains references to mdat atoms

The MOOV atom acts like a table of contents. It contains information where the exact video data can be located in the file.

Video MP4 MOOV atoms

Why should the MOOV atom be located at the beginning of the file?

The MOOV atom is typically placed at the beginning of the MP4 video file. This is especially important for video content played on the internet, and even more important for users with slow network connections.

It's impossible for the video to start playing without reading the MOOV atom first. Since it acts as a table of contents, the video player has to know where the first seconds of the video are located in the data stream. Videos that are encoded with the MOOV atom at the beginning of the file are able to start playing right after the first bits of data have been downloaded, since the table of contents is available in those first few KBs.

Here are the main reasons why it should be placed at the beginning of the file:

  1. Immediate playback. With the MOOV atom at the beginning of the file, the video player knows almost everything about the video before the actual video stream is downloaded. It will be ready to play the first seconds of the video almost immediately, during which the rest of the video stream is downloaded in the background.
  2. This allows for a great user experience with minimal buffering. It's why you'll see most MP4 videos streamed over the internet with a fast start playback option.

    In this study from Professor Ramesh K. Sitarman of the University of Massachusetts, a 2-second delay in video playing will cause users to start abandoning the video. This is obviously something you want to avoid in all cases.

  3. Faster seeking. Having the MOOV atom in the beginning of the file allows the media player to seek faster. All relevant information can be accessed from the MOOV atom in order to determine the exact location of the data.
  4. For example, if the video is seeked to 18 seconds, it knows that it has to download from 1,420,298 bytes onwards. The browser typically does this using the byte-range HTTP header. More information about that here.

  5. Reduced memory footprint. If the MOOV atom is in the beginning of the file, the browser doesn't have to download the entire video file in order for playback to begin. This can be especially useful on devices with limited RAM resources like mobile phones.

What if the MOOV atom is found at the end of the file?

If the MOOV atom were at the end of the file, the whole MP4 file has to be downloaded before playback can begin. Video ads are generally a couple of MBs in file size, which takes time to be downloaded by the user's browser.

Moreover, most VAST players have a playback threshold when the ad should begin playing. If it doesn't start playing within a certain number of seconds, it will skip the ad automatically and play the main video content. This has obvious devastating consequences for both the publisher as the advertiser.

At last, memory usage will be higher as the complete video file has to be held in memory. For users on devices with limited memory, this may have an effect on user experience.

To sum up, having the MOOV atom in the middle or at the end of the file has non-negligible consequences:

  1. Detrimental user experience. The video will only start playing when the whole data stream has been downloaded, which may take several seconds.
  2. VAST video player timeouts. The publisher's VAST video player may timeout for users on slow networks, which is a waste of opportunities, earnings and ad spend.
  3. Poor user experience. Higher memory usage and additional waiting time lead to a reduced user experience, which can effect the publisher's reputation.

It's therefore imperative for ad ops professionals doing quality assurance checks to verify the MOOV atom's location.

Here are 3 simple ways to to check the location of the MOOV atom

  1. You can use a binary file viewer to analyze the MP4 file and search for the MOOV atom (see the image at the top). If you don't have a binary file viewer installed, I can recommend using Binary Viewer for Windows.
  2. You can use this free MOOV Atom Position Detector. It shows you if the MOOV atom is at the beginning, middle or end of the file within a couple of seconds.
  3. You can use the Video Ad Validator from AdValify.io. If analyzes 25+ data points and give you a pass/fail for each test, including a MOOV atom test. See here:
Video Ad Validator (MP4)

Conclusion

Adding the MOOV atom at the beginning of the file improves streaming efficiency and the overall user experience, while reducing memory usage. It's common practice when QA-ing video ads. Online tools to analyze video ads are typically used to automate the whole video ad validation process.


Download this article as PDF?

No time to read the whole article? Download a free PDF version of this article for later:

Permalink

To link to this article, please use:
https://www.advalify.io/video-ads-and-the-mp4-moov-atom-50362

External Resources

More from AdValify.io