What Is the MP4 Format?
MP4 is a popular video format used to share, download, and stream video content. In addition to video, the format can store audio, images, and also subtitles. It is a container format, meaning it can store various types of audio and video, as long as they are encoded in a codec supported by the MP4 format.
MP4 provides strong compression, which is lossy but retains high video quality. This makes it highly suitable for streaming and downloading videos over the Internet. It can package multiple media types including video, audio, images, and 3D imagery, together with complex metadata, making it possible to deliver navigation and other interactive elements to viewers.
MP4 stands for MPEG-4 Part 14, and is based on the QuickTime File Format (.mov). Its first version (named MPEG-4 Part 12) was released in 2001, and the current version (Part 14) was released in 2003.
In this article:
- MP4 File Format Versions
- Structure of MP4 Files
- MP4 Pros and Cons
- MP4 Alternatives [C2]
- Converting Video to MP4 Or WebM With Cloudinary
MP4 File Format Versions
The MP4 file format began with MPEG-4 Part 14, an instance of the ISO/IEC 14496-12:2004 format based on the QuickTime file format. The only difference is MPEG-4 Part 14’s official support for MPEG features like initial object descriptors (IODs). The first version of the MPEG-4 file format (ISO/IEC 14496-1:2001), released in 2001, was revised from the 1999 specification, MPEG-4 Part 1: Systems.
MPEG-4 Part 14: MP4 (ISO/IEC 14496-14:2003), or version 2 of the MPEG-4 file format, replaced version 1 in 2003. It used the structure defined by the ISO base media file format (ISO/IEC 14496-12:2004). Extensions over the ISO format enabled support for MPEG-4 features like visual and audio codecs (other ISO-based formats also use these extensions).
Apple Inc. is the registration authority for identifier values (code-points). It is recommended that codec creators register their code. When a designer creates a specification based on the ISO base media file format, existing specifications can serve as examples and provide definitions. For instance, you can use existing specifications covering a media type’s storage mechanism rather than inventing new definitions.
Structure of MP4 Files
MP4 is a container file format, which does not have a strict structure. It is extensible, meaning that you can define a custom structure and hierarchy for the data in an MP4 file. MP4 files are divided into two sections:
- Media-related data containing audio and video
- Metadata such as flags and timestamps
The individual components of an MP4 file are called atoms. The minimal size of an atom is 8 bytes—the first bytes specify the size of the atom and the next 4 bytes specify its type.
Here is the list of the most common atom types used in an MP4 file:
|Root||ftyp||Specifies the file type, description, and data structures used.|
|Root||pdin||Settings for progressive loading and downloading of videos.|
|Root||moov||Stores all metadata for the video|
|Root||moof||A container with fragments of video content|
|Root||mfra||A container that has random access to a video fragment|
|Root||mdat||A data container for other media (such as images)|
|Root||ssts/stsc||Sample-to-time and sample-to-chunk tables.|
|Root||stsz||Sample sizes defining framing for the video.|
|Root||meta||Container storing metadata for the MP4 file.|
|Second-Level||mvhd||Video header information.|
|Second-Level||trak||A container including an individual video track.|
|Second-Level||udta||A container holding information about the creator and other information about the track.|
|Second-Level||iods||The MP4 file descriptor|
MP4 Pros and Cons
Pros of MP4
- Broadly supported by all common operating systems, consumer electronic devices, and many software media players, including open source players such as VLC.
- Supports metadata and additional data stored according to the Extensible MetaData Platform (EDP) format, such as subtitles, JPEG or PNG images, and even PDF files.
- Provides strong compression and has a relatively small file size, making it highly suitable for video streaming and large-scale video storage.
- Makes it possible to package video content with user navigation options, 3D visuals, and other interactive elements.
- Provides several variants including .m4a for files that only contain audio, and .m4v for visual bitstreams.
Cons of MP4
- MP4 is strictly speaking not a video format—it is a container format. It does not have a native method of processing media, so it relies on codecs. A media player must support these codecs to play an MP4 file. However, due to the huge popularity of MP4, many of its codecs have become standards themselves.
- Codec compatibility issues can sometimes result in video being out of sync with audio.
- Playback and editing of MP4 files requires significant processing power, because a file can contain several types of multimedia content and metadata.
- MP4 compression results in good quality video, but it is still lossy. It is not a suitable choice for very high-definition video.
- The convenience of the MP4 format has made it possible to illegally distribute copyrighted media content, which is a major problem for publishers.
AVI vs. MP4
Developed by Microsoft in 1992, AVI is Windows’ standard video format. It uses the DivX codec (as opposed to MP4’s MPEG-4 AVC/H.264 codec). AVI files can provide high-quality outputs if intact because they retain the alpha channel, while MP4 files use different compression codecs to encode and ensure high quality. AVI offers slightly higher quality, but the difference is not noticeable to the bare eye.
AVI has more efficient data compression than other formats, including MP4. However, the average file sizes are enormous (2 or 3 GB/minute), making it unsuitable for uses with limited storage and requiring compression. MP4 is a lossy compression format requiring less storage space, with smaller output files than AVI, and is compatible with more media players.
Related content: Read our guide to the AVI format (coming soon)
MKV vs. MP4
Like MP4, MKV is a popular container format for storing multimedia data and streaming content online. MKV relies on support from the non-profit loi 1901 and has open specifications under a GNU L-GPL personal use license. The patented MP4 format restricts copying with DRM.
MKV stores unlimited content like audi0, video, and subtitles and supports most coding formats (MP4 supports fewer codecs).
Both formats support UHD video resolutions, but only MKV supports lossless audio compression with FLAC. MP4 only allows lossless audio with the less efficient ALAC. However, MKV files are generally larger, and the format is less compatible with mobile devices than MP4. Neither format is inherently better, and the choice should consider the content creator’s individual needs. For instance, MKV is well-suited to ripping DVDs, while MP4 is better for playing video files on an Android device.
Related content: Read our guide to MKV format (coming soon)
WebM vs. MP4
The WebM container format is especially suited to online streaming. It is a Matroska-based, open-source video format developed by Google. It uses royalty-free VP8 encoding (unlike Mp4’s patented H.264). Given its web-centric design, WebM has a higher compression ratio but is lossier than MP4.
MP4 is compatible with more devices, including mobile and desktop, and can also support online streaming on various browsers. Many sites are joining YouTube to support MP4 HEVC files. WebM lacks native support from popular devices and browsers like Safari and iPhone.
The H.264 and VP8 (Vorbis) are two competing compression codecs for HTML5 video files. Google discontinued H.264 support on Chrome in 2011 in favor of VP8, but H.264 remains the leading codec for mobile and web streaming.
Related content: Read our guide to WebM format (coming soon)
Converting Video to MP4 Or WebM With Cloudinary
MP4 is a popular file format supported by most platforms, and WebM is a modern video format that provides advanced compression. Cloudinary can help you automatically convert video files to these modern video formats for faster loading, and an enhanced user experience.
Cloudinary performs the task in the cloud through automation in three steps:
- Convert any video to MP4s or WebM through dynamic URLs.
- Resize, crop, and transform the videos generated in step 1.
- Optimize the transformed videos through a fast content delivery network (CDN).
The conversion capability is available in all Cloudinary plans, including the free tier. Do check it out.