Video encoding is the process of exporting digital video into a format and specification suitable for playback by a user.
Each video file contains two elements:
- Codecs, or “compression-decompression“ algorithms which compress the video
- and formats, the type of file the data is compressed to.
Imagine a shipping container filled with packages of many types. In this analogy the shipping container is the format, and the codec is the tool that creates the packages and places them in the container.
Video codecs used today include H.264, HEVC, VP9, and AV1. Common formats includes MKV, AVCHD, MP4, and WebM. There are pros and cons to each video codec and file format. There is no silver bullet when it comes to streaming content on the web. Certain video codecs and video formats are open source, meaning the source code is available to the user, who is given the rights to study, change, and distribute software to anyone for any purpose. VP9 and AV1 are both open source codecs types. MKV and WebM are also both open source, developed by nonprofit organizations and allowed to be used without a license.
Video formats are often equated to a file’s extension, for example the .mp4 in Video. mp4. Video formats are much more than that and include a whole package of files, including a files video stream, the audio stream, and any metadata included with the file. All of the data put together, both of the streams and the metadata, is read by a video player to stream video content for playback. A file’s video stream includes the data necessary for motion video playback, while the audio stream includes any data related to sound. Metadata is any data outside of audio and sound, including bitrate, resolution, subtitles, device type, and date of creation.
Bitrate or bit rate, is the rate at which bits are processed or computed over time. The higher the bitrate, the more data there is, which generally means a higher quality video file. When choosing a bitrate it is important to consider the device your videos will be played on. High bitrate file streams need lots of processing power to encode, and a fast internet connection to download for playback. If you’re having trouble choosing the right bitrate, file format, video codec, and video resolution, maybe it’s time to consider api.video.
With the api.video product you can easily and quickly transcode video for your audience no matter the quality, format or bitrate. We wrote this article to help you sort through the hundreds of codecs and formats, and help you take the guesswork out of streaming video content on your site, application, or platform.
The Most Popular Codec: H.264
First let’s talk about H.264, also known as AVC.
H.264 is the most widely used video codec. Sure, the H.264 codec may be a bit outdated by now, but this type of compression technology is present everywhere, with decoders available for pretty much every platform and mobile device. H.264 likely won’t be the standard for long. HEVC, short for High Efficiency Video Coding, or H.265 is slowly becoming ubiquitous thanks to the proliferation of 4K content. If AVC or H.264 was the codec of 1080p content, then HEVC and H.265 is the codec for the 4K era. H.265 compresseses videos far more efficiently (hence the “high efficiency”) when compared to H.264. This means H.265 4K content that is easier to stream and at a higher quality than 4K content compressed using H.264.
New Codecs: H.265 and VP9
H.265 is a licensed codec, meaning you have to pay to use it. It’s main competitor, VP9 is a royalty free and open source codec developed by Google. This means that anyone can use the codec to compress their videos license free. Generally, VP9 produces more consistent or more reliable streams, whereas H.265 (HEVC) produces videos of higher quality.
The differences between the two codecs are due to the strengths and weaknesses of their compression algorithms. VP9 was developed to produce videos with a smaller file size and therefore ones that are easier to stream. H.265 compresses videos using a large variety of processing techniques which ultimately create a compressed video that retains a very high level of detail.
In addition to VP9, there is another open source codec still under development called AV1. AOMedia Video 1 (AV1) is an open source, royalty-free video coding format specifically designed for streaming video content over the internet. AV1 was developed to succeed the VP9 codec and compete directly with HEVC codec on both video quality and file size. AV1 is still a highly experimental codec, but is supported by Firefox, Google Chrome, VLC media player, FFmpeg among others.
The Most Popular Video Formats
We mentioned this before, but formats are the entire set of storage rules that package a video file’s container, codecs, and metadata. File formats are used so that a variety of devices, platforms, and players can process and playback any number of codecs. Formats are developed to improve image quality, decrease file sizes, allow for universal playback on a variety of devices, and provide special features such as subtitles. Since there are new formats getting developed every day it’s difficult to cover each and everyone. Instead, we’re going to focus on video formats used specifically for online distribution or content streaming.
The most popular video format is MP4, also known as MPEG 4. MP4 is a multimedia container for video, audio, and data, including things like subtitles and still images. Make sure you don’t confuse MPEG 4 and MPEG 4 Audio. MPEG 4 has the file extension .MP4, while MPEG 4 Audio has the file extension .M4A and can only contain audio files. So, why exactly is MP4 so popular? Well it mainly has to do with how ubiquitous it is across a range of devices. Both mobile and desktop devices can playback MP4 video files, so it makes sense that it would be used by most content producers.
Playback Techniques for Video and Livestreaming
MP4 files are played at a constant bit rate (CBR), meaning the quality of your video stream will remain at the same bitrate no matter the variance in your internet bandwidth. There are other file formats that support adaptive bitrate (ABR), which will adapt the quality of your stream to match the internet speed of your player. One of the most popular formats that supports ABR is HLS..
HLS or HTTP Live Streaming use adaptive bitrate streaming techniques to enable high quality streaming with small HTTP-based file segments. The key to this format’s popularity is the use of HTTP. HTTP is the universal language protocol for the internet, and allows for reduced infrastructure costs, greater reach, and simple HTML5 player implementation. Another great feature for the HLS format is the M3U8 file descriptor. This file allows the client or device to automatically select the best quality stream at any time, to prevent playback buffering regardless of bandwidth or CPU power.
Now that you know how file formats and codecs work it’s time to get streaming. Visit api.video to quickly and easily integrate streaming video content into your application, site, or workflow. Our api can accept pretty much any type of broadcast (even 4K native content), and can quickly transcode and adapt the stream for any type of network, including EDGE. No matter the screen, size, quality, or bitrate, api.video can manage it for you. Our web service is built to answer the most demanding video and streaming needs. If you want to learn more check out our website at api.video or shoot us an email at email@example.com. Good luck and happy streaming!
You May Also Like...
If you liked this article, you may also be interested in: