What’s a video container?
A video container format, like any other digital container format, is essentially a digital wrapper for your content. They’re easy to distinguish because they determine the extension of your video file. Popular container formats include MP4 (.mp4), AVI (.avi), QuickTime (.mov) and Matroska (.mkv). The different container formats all have different strengths and weaknesses, with certain formats preferred by certain content providers. Not all containers support all compression standards or allow for secondary features like subtitles and chapters. The container itself doesn’t effect the quality of the video directly, but it can limit the compression codecs available for use. If you’re choosing a container format to use for an encoded video, you’ll want to pick one that has the right mix of supported compression codecs and features.
Popular container formats
Matroska (.mkv): The Matroska format is one of the most flexible container formats available, but it’s not widely supported. It can hold just about anything and supports a full range of subtitle, chapter and audio options. However, encoding and playback requires the installation of third-party utilities like MakeMKV and VLC. It’s also freely licensed, avoiding the patent-encumbered status of most container formats. MP4 (.mp4): MP4s are widely supported and flexible and might be the best all-purpose container format for current usage. They’re not as infinitely flexible as .mkv files, but they support the majority of modern-day codecs and include options for streaming, chapters, subtitles and more. MP4 files are natively supported by nearly every modern device. QuickTime (.mov): Apple’s proprietary QuickTime format is the choice for professional video, supporting a huge range of high-quality codecs for the highest-fidelity content delivery. QuickTime files can be played back in Microsoft’s Media Player and are supported by many non-Apple devices. AVI (.avi): The AVI format is likely the worst on this list. It doesn’t support chapters, captions or subtitles by default, and it can’t support menus or streaming. Even players that support AVI playback typically break when seeking through a video. However, AVIs are extremely flexible, accommodating just about any video codec that exists. This once made it a key choice for heavily-compressed videos, but it has since been supplanted by Matroska’s superior implementation and flexibility.
You can see more comparisons on other video container formats on the Wikipedia page devoted to the topic.
Popular compression codecs
Compression codecs are the algorithms used to compress digital video for distribution. Unlikely container formats, they’re essentially invisible to the viewer. There are dozens in existence, but only a handful are widely used.
H.264/MPEG-4 AVC: While H.264 might be the most popular modern codec, its days are numbered. It’s a powerful compression codec designed specifically for digital HD video, achieving a good mix of quality of space savings. H.264 playback is nearly universally supported, from DSLR video to embedded playback. However, the steady move towards higher-resolution video means that H.264 won’t be around for much longer. H.265/HEVC: Unlike it’s predecessor, H.264, the H.265 codec can handle video up to 8K UHD. This modern successor to H.264 also compresses video twice as efficiently, with files of the same visual quality using up about half as much disk space. It’s not yet supported on every device, but its popularity will continue to grow in the years to come. WMV: Microsoft’s proprietary WMV format has drawn some flack over the years for its association with broken digital rights management implementations. It’s a custom implementation of the MPEG-4 Part 2 standard and is supported almost exclusively by Microsoft software. It’s fallen out of use in favor of more broadly-usable compression codecs. MPEG-2: The ancient MPEG-2 codec was originally created for DVDs, and its age shows. It should only be used for legacy hardware compatibility or when mastering DVDs specifically. Pro-Res: This professional-grade codec is used for sharing high-resolution footage with minimal degradation, and it’s best suited for content delivery by multimedia professionals.
Conclusion
If you need to choose a video container and compression codec, a combination of MP4 container and H.264 codec will probably be the best choice. It’s flexible and broadly playable, making it a great fit for delivery to unknown devices. But if you work with higher-resolution video, you’ll want to further investigate the H.265 standard.