Codecs & Containers Explained
Most internet users will at one point or another stumble across codecs and containers, trying to learn the difference between the two. While most people categorize video files by their format, such as MP4 files or AVI files, these are in fact just the formats of the containers.
A video format container or wrapper format is a metafile format which describes how different types of metadata and data work in a computer file. Containers can support different video compression and audio compression techniques, not being tied to just one codec. Popular containers include AVI, produced by Windows, MPEG-4, QuickTime, RealMedia and MKV, the open source container.
Audio & Video Codecs
A coder/decoder, or simply put, a codec is a tool used to encode and store audio and video. Codecs make use of algorithms to compress video & audio files and decompress them later, often on the device of the end-user. There is a multitude of codecs available, each with a different way of working but the basic idea is that codecs help deliver media files over the internet much faster.
Codecs VS Containers VS Transport
A codec is used to encode or compress data. The codecs are used with other types of software to reduce the overall size of the media file, making it easier to store and transport. The word codec actually comes from compressor-decompressor – which pretty much outline how codecs work: they take media data and compress it for storage or transport and then decompress it for viewing. Your average live stream audio and video files will be recorded, encoded, placed within a container, transported, and go through a container again before finally being decoded and displayed on your screen.
Streaming Transport Protocols, commonly known as Transports, are sets of rules which designate how the media is being sent from the camera to the viewing endpoint or an intermediate between the two. The most common transport protocols are RTMP (Real Time Messaging Protocol) and HTTP-based protocols. RTMP is mostly used for dedicated streaming servers, ensuring excellent video delivery speed while HTTP is used for consumer grade end-user devices.
Popular Containers & Codecs
There are plenty of different audio and video codecs and containers available, and even more are being developed, but the most popular ones include:
.MP4 is a container format developed by the Motion Pictures Expert Group. The technical name of this container is MPEG-4, and it allows encoding video files with H.264 and audio files with AAC.
.MOV or QTFF or QuickTime File Format is a file format used by the QuickTime framework with the .mov extension. This format designates a multimedia container file which may contain one or more tracks. Each track can store different types of data, such as text, video and audio. Both MP4 and QuickTime containers can use the MPEG-4 formats, meaning they are interchangeable and very similar altogether. All in all, MP4 is more popular than MOV, and has more support.
.MKV or Matroska Multimedia Container is a free, open source container format, a file format that can hold an unlimited number of text, pictures, audio and video tracks in the same file. Matroska uses the .MKV file extension for video files. These files may also include audio and text in the form of subtitles. .MKV is similar to MP4 or AVI, but it is entirely open in its specification.
.FLV or Flash Video is a container file format used to distribute digital content through the internet with the help of Adobe Flash Players. .FLV or Flash Video can also be embedded in SWF files as well. Flash Video can be used in two file formats, namely F4V and FLV. Both formats can be used with the Adobe Flash Player. The .FLV format was created by Macromedia and the .F4V format was created by Adobe Systems. Flash Video was the norm in terms of internet streaming up until the early 2010s, being used by VEVO, Hulu, Reuters and Yahoo! Video.
.AVI or Audio Video Interleaved is Microsoft’s multimedia container format. AVI files can contain both audio and video data in a file container which allows video with audio playback. AVI also supports multiple streaming video and audio. Although it is a very popular container format, it does not offer certain features which MPEG or MP4 have.
Popular Video & Audio Codecs
H.264/MPEG-4 AVC is the most common codec used for cameras that store files on memory cards, hard drives and so on.
HVEC stands for High Efficiency Video Coding; this codec is also known as MPEG-H Part 2 or H.265, and is considered a successor for AVC H.265 or MPEG-4. HEVC is between 25% to 50% more efficient in terms of data compression, compared to MPEG-4, for example.
VP8 is the successor of VP7, an open source, royalty free video compression format. The codec was released back in 2008 by On2 Technologies and it quickly became used, alongside HTML5, for YouTube videos.
VP9 is a newer, better version of VP8 and is comparable with MPEG’s High Efficiency Video Coding outline above. VP9 was first used for YouTube videos.
AV1 or AOMedia Video 1 is an open source royalty free video coding format mainly designed around transmitting video over the internet. AV1 offers up to 50% better data compression than other codecs.
AAC or Advanced Audio Coding was developed as the successor of MP3. AAC is an audio coding standard used for lossy audio compression which provides higher sound quality than MP3 files, but at the same bitrate. AAC is currently one of the most popular audio codecs in the world today.
MP3 or Moving Picture Experts Group Layer-3 Audio is probably the most popular audio codec available today. MP3 uses lossy compression to drastically reduce the size of audio files. Not only that, but MP3 files usually work on almost any device, making them the common choice for many content creators, including streamers. With MP3 files taking less storage space, sound quality is also lower.
OPUS was developed by the Xiph. Org Foundation and standardized by the Internet Engineering Task Force as a lossy audio coding format. OPUS can code speech as well as general audio in a single format, while maintaining low latency and low complexity, making it a great choice for real time interactive communication.
WMA or Windows Media Audio comes in two forms – lossless and lossy; this offers listeners some flexibility with their audio quality. WMA works much in the same way as FLAC or WAV files, but are generally smaller than these lossless options. The only drawback of WMA is the fact that it’s not compatible with all devices – Apple products, for example, can not open WMA files.
FLAC stands for Free Lossless Audio Codec, which is an open source, non-proprietary codec mainly used by software developers who want to use lossless audio. Although FLAC offers great audio quality, the total file size is generally larger than with other codecs such as MP3.
WAV or Waveform Audio Format is another codec that is excellent for scenarios where lossless audio is necessary. WAV files are larger in general, meaning that they can only be used for short sound bites instead of long-length audio.
ALAC stands for Apple Lossless Audio Codec, which, of course, works best with Apple products. Since this codec is lossless, the sound is high quality and identical to the original recording but file sizes are generally large, meaning it takes longer to download them.
RTMP or Real-Time Messaging Protocol was developed by Adobe as a solution for audio, video as well as data transport between different platforms. RTMP is currently one of the most common transports used in live streaming, and it currently works on iOS, Windows Mobile, Android, Linux, Mac and Windows. Gaming devices such as PlayStation and Xbox One also use RTMP.
HLS or HTTP Live Streaming is an adaptive streaming communication protocol developed by Apple. While originally it was only used by Apple-related products, now it supports Android as well as other devices.
DASH or Dynamic Adaptive Streaming over HTTP is an adaptive bitrate streaming protocol which allows streaming from conventional HTTP web servers. DASH is also known as MPEG-DASH and with it, media content is split into several HTTP-based file segments, before being delivered to the viewer.
RTSP or Real Time Streaming Protocol is a network control protocol mostly used in communications and entertainment systems to control streaming media servers. RTSP is used for controlling different media sessions between end points. RTSP does not handle the transmission of streaming data itself – Most RTSP servers use Real Time Control Protocol or RTCP and Real Time Transport Protocol or RTP for the delivery of streaming media.
WpStream currently uses some of the most efficient and reliable codecs and transports, namely Advanced Audio Coding, Real-Time Messaging Protocol, HTTP Live Streaming and AVC. Since WpStream was built with user-friendliness in mind, you don’t need to worry about all the little details related to codecs, containers or transports to stream successfully. This article is simply here to outline the basic tech concepts behind our product. That being said, if your encoder provides multiple codec choices, be sure to pick the ones compatible with WpStream – H264 and AAC.