mp4, mov, mkv, avi, mpeg... Formats, containers, and codecs – how to choose? Is there a video format compatible with all browsers and devices? And if there is, what is it? The answer is in this article.
These questions were raised at the beginning of our journey at Kalyzée. Initially, the question of the best format seemed quite complex as it needed to consider the distribution mode (streaming, pseudo-streaming), compatibility across browsers (Chrome, Firefox, Safari, Opera, Internet Explorer) with their various versions, and navigation devices (desktop computers, tablets, and mobiles).
The competition between Apple, Google, Microsoft, and Adobe, all major players in the choice of video formats, doesn't make things easier; each trying to assert their dominance. We all remember Steve Jobs' bold decision in April 2010 to completely halt the use of Flash (Adobe) on iPhones, iPod touches, and iPads. A courageous decision, considering Flash was present on 99% of desktop computers!
A digital video is a file that contains images, sound, and text (metadata) placed within a container. In this container, images, sound, and text are compressed because the infrastructure of distribution networks can't handle the load of native audiovisual streams. One could say that digital video files are the zips of audiovisual content. The compression and decompression of these files are carried out by codecs.
The container is a file format that holds the audio and video streams, codec information, and metadata.
A codec (abbreviation for encoding-decoding) is an algorithm for compressing/decompressing a digital audiovisual signal.
The format of a video file is indicated by the name of its container (MP4, MOV, AVI, FLV, MKV, ASF, etc.). There are around twenty containers, with the main ones mentioned below. These containers have been developed over time by different companies and communities to adapt to technological advancements. A container can encapsulate multiple audio and video tracks. Metadata can include: title, summary, keywords, credits, chapters, subtitles, etc.
For your information
When someone says:
" - I'm sending you my video in MP4 format"
It means you will receive a file on a USB drive or via the internet.
Additional information on Wikipedia.
The digital file of a video is identified by the extension of the file's name (.mp4, .mov, .avi, .flv, .mkv, .3gp, etc.). The extension and the container often have the same name. However, this is not a strict rule as there can sometimes be multiple extensions for a single container.
For your information
When someone says:
"I'm sending you my video in 3GP format"
It means you will receive a file with either the .3g2 or .3gp extension.
As mentioned earlier, the role of a codec is to compress/decompress audiovisual data. For example, the signal of an uncompressed HD video (1920 x 1080 resolution at 25 frames per second) contains a data stream of 1.5 Gbit/s. A CD-ROM could hold only 0.5 seconds of this video!
Codecs are essential to reduce the size of video streams. A codec is an electronic device or software that can compress and/or decompress a digital signal. It encodes for transmission, storage, or encryption of audiovisual streams, and decodes for editing or playback.
There are hundreds of codecs (audio, video, text), each developed for specific uses. For the web, a handful of codecs are sufficient (list below).
For your information
Before being uploaded to the web, a professionally produced video is encoded three times: 1) during shooting by cameras, 2) after film editing, and 3) before being uploaded to the web.
Xvid
What is the link between container and codec?
A good container is compatible with many codecs. For instance, the MP4 and MOV containers can encapsulate audiovisual streams encoded with most codecs.
Note: The container does not contain the codec itself (the program) but its identifier (FourCC).
Codec playback occurs locally, meaning if you can't play a video, it's likely that you don't have the right codec installed on your device.
For your information
A container does not define the quality of a video!
The quality of playback is determined by codec choice and settings during encoding.
Advice: The best way to describe a video is to specify both the container and the codec. For example, a MOV file encoded in H.264.
Many people confuse codecs and containers, especially since some companies use the same name for the codec and the container. For instance, "mpeg-4" describes both the codec and the container, even though you can have an mpeg-4 codec within an AVI container.
A codec is a program and should not be confused with a compression format or encoding format.
The format is a file, a means of storing digital data, while a codec is a program that can read or write data.
The codec is a program that creates the information.
The container is a file that contains the information.
The choice of format arises when you want to publish a video on the web. This question is relevant for those who want to distribute their own videos or use video platforms (Dailymotion, Youtube, Vimeo, etc.). If we consider the number of containers multiplied by the number of codecs, there are numerous possible combinations.
However, for internet distribution, here are the formats to use (accepted by video platforms):
.MOV
.MP4
.AVI
.WMV
.FLV
.3GP
.WebM
Today, browsers are moving towards adopting HTML5, which eliminates the need for playback plugins. To create or commission a "Master" video format for the web, we recommend MP4/h.264, AAC, which currently offers the best combination of video format and codec, along with audio codec. With this format, you will be able to upload your videos to any platform.
For those who want to self-distribute videos, it's advisable to add WebM/VP8 and Vorbis formats.
Note: This article does not discuss the encoding quality, which needs to be adjusted based on the target devices.