From .WEBM, .OGG, .MP3, .MP4 and more, there are many video file formats you can expect to come across as a developer handling audio/video content in your application. Like in our last article The Complete Image File Extension List for Developers, and How to Choose the Best Audio File Format and Codec, in this article we’ll delve into the different types of audio/video file types, and when to use which type of audio or video format for your application.
First, let’s get a couple of common questions out of the way:
Which is the best video format?
Unfortunately, there is no single “best” video format. The best video format for you depends on how you would like to balance the quality and size of the video file. Some formats are extremely small and are great for web video streaming, but are low quality. Other formats are high quality and the right choice for commercial videography but are very large in size.
What is the difference between a video codec, video container, and a video file format?
Video files are made of 2 parts: a codec and a container.
A video codec is a protocol for encoding and decoding video (the word codec comes from “enCOde / DECode”). Common codecs include H.264, MPEG-4, and DivX. A well-engineered codec has high efficiency, or ability to preserve quality while reducing file size.
The container format is a definition of how the file metadata and data are structured, excluding how the video is actually encoded (which the codec determines). The container file holds the metadata and compressed video data which is encoded using the codec. The container format is also more generally called “the format”, and is reflected in the file’s extension. Common container formats include .AVI, .MP4, and .MOV. Container formats can be paired with different codecs that influence what devices and programs the file will be compatible with.
Which file format is my video file?
On Mac, right-click the video file and click “Get Info”, then under “More Info” you should see both the video and audio codec.
On Windows, right-click the file and click “Properties”. Under the “Details” tab you will see the file format and codecs used.
Which video format is the smallest?
As of now, the HEVC or H.265 codec is one of the most efficient available on the market and is commonly used to compress 8K UHD video. However, using the codec requires paying a licensing fee so it is not widely compatible or supported by devices or browsers. On the web, .WEBM and its corresponding VP8/VP9 codec are a widely compatible and popular way of making video files smaller.
However, it’s important to consider factors besides size: where the files will be played and the required quality of the video. Next, we’ll dive into each of the most popular container formats to understand the tradeoffs.
Video File Formats
Like the .WEBP image file, .WEBM was created by Google as an efficient means of disseminating media to a large audience. .WEBM video files are relatively small in size, and as such are not as high in terms of quality as some of the other file types on this list. The .WEBM video file format is used for HTML5 video streaming sites, such as YouTube.
.MPG, .MP2, .MPEG, .MPE, .MPV
.MPG, .MP2, .MPEG, .MPE, .MPV files can play audio/video media, or simply audio. They are low in file size but also relatively low in quality. They also have lossy compression, meaning their quality will degrade after being edited numerous times. .MPG, .MP2, .MPEG, .MPE, .MPV files are best used when video will be recorded once and never edited.
.OGG files are an open-source alternative to .MPG files, and are used for high-quality videos to be streamed via the internet. Though .OGG files are used for streaming, they are higher in quality than .WEBM files – meaning they will take longer to be delivered to the end-user. Due to .OGG files being open sourced, they can be used in a variety of applications, including GPS receivers and media players (both desktop and portable).
.MP4, .M4P, .M4V
.MP4, .M4P, .M4V are similar to .MPG files in that they can contain audio and video, or can simply be solely audio files. .MP4, .M4P, and .M4V are used for streaming video via the internet. They are generally higher in quality than .WEBM files, but tend to be larger in file size. .M4V files are proprietary iTunes files that share the same qualities of .MP4 and .M4P files. M4V files are DRM copy-protected.
.AVI files are one of the oldest and most compatible video file formats. Many different codecs can be used with an .AVI file, which means that this format has more flexibility in choosing a balance between quality and size. However, these files tend to be larger than the previously mentioned formats, which makes it less ideal for the web and more ideal for storing movies on a computer.
.WMV is a video file format created by Microsoft and stands for Windows Media Video. The codec used by these files results in small file sizes but poor quality. This format is useful if you are sending video to someone with an older Windows computer.
.MOV and .QT files were developed by Apple to use with its Quicktime player. These files are of high quality but large in size. And they have poor compatibility with non-Quicktime players. This format is useful if you intend to archive a high-quality video on an Apple computer.
.FLV and .SWF files were designed by Adobe as the video file format for Flash. The use of these file formats has declined rapidly as Flash has become less popular, especially after Flash support ended for iOS devices. The use of these formats is only recommended if you need to support a legacy system that can only accept this type of file.
AVCHD or Advanced Video Coding High Definition files are the format generated by many digital camcorders. These files use the H.264/MPEG-4 video codec and are similar to an .MPG file.
How to choose the best video file format
Choosing the right video file format depends entirely on what you plan on using the video for. You should choose a format that achieves the quality of video you require, but nothing more. Unnecessarily high-quality video files can be unwieldy to move, share, convert, and manage. In addition, how the video files will be viewed is important. Not all programs, browsers, and devices can open a specific video format. Consider a couple of scenarios:
- If the video will be viewed on the web, choose a format that is supported by most browsers. This way, your video will be able to be played without downloading the file and using a separate player. Browser compatible video formats include MP4 and WEBM.
- If you are archiving a home video, choose a format that is high quality and has a good chance of being playable in the future. Open source formats are more future-proof than proprietary formats that are controlled by a specific company. Formats that fit this category are MP4 or AVI (using an open codec).
- If you work at a company that uses older Windows computers, you should choose a format that is highly compressed and compatible with Windows. In this case, you’d want to use a WMV file.
In summary, the most common video file types are:
- .MPG, .MP2, .MPEG, .MPE, .MPV
- .MP4, .M4P, .M4V
- .AVI, .WMV
- .MOV, .QT
- .FLV, .SWF
How to convert video file formats
There are certain times when it is best to use one file format over another, and often, you have to convert between file formats. To programmatically convert between audio or video file types, you can use Filestack’s audio and video transcoding API. Filestack’s API also supports extracting audio files from video files, cropping or resizing video files, extracting thumbnails from videos, and more. Get started for free with Filestack today.
Read More →