File Formats and Codecs
File Formats and Codecs
com/blog/film-games/vfx-file-formats-
you-need-to-know
Channels
The next option for file formats after how many colours they can support, is the
number of channels they can hold. For example a .jpg can support only colour
(RGB) so it has 3 channels. Where as a .tga can support RGB and Alpha, so it
can hold up to 4 channels of data.
Below is a chart showing the various Visual Effects file formats arranged by the
number of channels each can support.
All video files are made up of two key components: A container and a codec. Of these, the
container is the most visible to you on a computer because it's identified by its extension. For
example, a file with an .mov file extension is a video file that has the QuickTime container
extension. What's not so readily visible is the codec. A codec is the driver for how the
container format is decoded by the program. There may be hundreds of codecs that are
available for each container type and without the correct codecs installed on your computer, it
won't know how to open the video file properly.
To get a better idea of how containers and codecs work together, let's look at a metaphor in
the real world. A simple tin can have any number of things inside of it. It is, very literally, a
versatile container that could hold anything from food, oil, paint or even compressed gasses.
The label on the outside is how you know what its contents are and, by extension, what type
of container it is. Depending on the type of container is probably going to determine how
you'll open the can. For example, you probably won't try to pry open a can containing
compressed gasses in the same way you would a can that contains food. Just knowing what's
inside isn't quite good enough. You'll need to know what to do with the contents. For this,
many tin cans have some simple directions for what to do with its contents printed directly on
the label. It could be anything from instructions on how to open the can to a recipe for the
contents once you have it open.
This is essentially how a computer handles video files. The file extension is a label that tells the
computer what container type the video file is. By knowing the container type, the computer knows
how it needs to open the file. For instance, an .mov file might open in QuickTime's native player
whereas an .avi file could open in Windows Media Player. But just like knowing the container type
for the tin can isn't enough in the real world, a computer needs more than just knowing what type of
container a video file is. That's where the codec comes in. The codec is basically the directions for
how to play the video once it's opened.
The easiest way to identify the container format for any given video file is to show the file extension
on your computer. Once you've done that, the file extension will tell you what the container type is.
As mentioned previously, codecs aren't as easy to see. In most cases, you'll want to go to the
properties of the video file in your video player. The exact steps are going to vary depending on your
player. For the sake of this example, we'll use the VideoLAN Client (VLC) player because it can let
you see codecs and works on a wide range of operating systems. With VLC, once you open the video
file you can go to Tools > Codec Information to see what codec was used for the video.
https://www.makeuseof.com/tag/all-you-need-to-know-about-video-codecs-containers-and-compression/
All You Need to Know about Video Codecs, Containers, and Compression
Bryan Clark March 13, 2015
What Is a Codec?
A codec – or coder/decoder – is an encoding tool that processes video and stores it in a
stream of bytes. Codecs use algorithms to effectively shrink the size of the audio or video
file, and then decompress it when needed. There are dozens of different types of codecs, and
each uses a different technology in order to encode and shrink your video file for the
intended application.
Depending on the codec, this encoding occurs in one of two ways: lossy or a lossless
compression.
Lossy Compression
When looking for manageable file sizes, lossy compression is the most viable method
available. While you certainly lose quality in audio, video, or both, the compression is a
necessary evil (currently) in a world dominated by the need to share and store what would
otherwise amount to impractical file sizes. Your average Blu-ray, for example, can exceed 40
gigabytes, and that sort of storage space would not only be expensive, but it’d make digital
downloads and purchases inconvenient, if not an outright waste of time. The key when using
lossy compression is to settle on the highest quality compression format for your intended
use, so that you walk the fine line between loss of quality, and file size.
Lossless Compression
Lossless compression works much like a ZIP or RAR file in that after compressing and
decompressing, the file is essentially the same. Through use of smart algorithms, the file doesn’t lose
much quality, but it’s not an efficient way to store large files because there isn’t much compression
that actually takes place. In addition, online transmission of large video files uses far too much
bandwidth (although H.265 encoding may change that) to make it a viable compression option.
Unless you work in the film industry, or in video editing, it’s unlikely you’ll ever share video files in a
lossless format (if even then). To put it into perspective, even a 4k television doesn’t contain the
resolution needed to display a film shot on a modern camera and delivered without some sort of
compression. In fact, it’s not even close (yet). While 4k video is beautiful, it’s not even close to the
size of an uncompressed video format.
While a Blu-ray film is less than 50 gigabytes (if it has to fit on one disc), the first downloadable 4k
movie is a whopping 160 gigabytes!
Completely uncompressed 1080p video is a mind-boggling 410 gigabytes per hour, and that doesn’t
include the audio file, which could add an additional 7 gigabytes per hour depending on how it was
recorded. All-in-all, these files are all but useless for a consumer market with current technology.
It’s also important to note that codecs aren’t just for compression of audio and video files. Once a
file has been encoded using a specific codec, that same codec must be used to decode the file in order
for it to play on your device. Not using the correct codec is what leads to the majority of device
compatibility or playback issues. This issue is becoming less common as modern containers often
include the required audio and video codecs needed to play the file.
Popular Codecs
XviD/DivX
DivX is a commercially sold codec, while XviD is an open source utility meant to function as an
alternative to its commercial cousin. Both codecs can decode the output of the other, as they are both
built on the implementation of MPEG-4. While still widely used, its often strictly for video encoding
and in conjunction with one of the more popular packs mentioned below.
MPEG-4
MPEG-4 is the most common streaming format and it consists of many parts, of which only MPEG-4
Part II is used for video coding. MPEG-4 Part II calls on video encoders such as DivX or XviD in
order to encode the video, while audio is typically carried in MP3 format. Modern updates to MPEG-
4 are now using H.264 as well.
H.264
This is the most popular choice for high definition material. H.264 is also a relative Swiss Army knife
of the codec world as it can utilize both lossy and lossless compression depending on the settings you
choose when encoding, such as frame rate, quality, and target file size. H.264 relies on x264 for
encoded video (as well as others, such as DivX or XviD), and audio is often encoded using AAC or
MP3 audio codecs depending on the size and quality you’re targeting.
H.264 is touted as 1.5 to 2 times as efficient as basic MPEG-4 compression, which leads to smaller
file sizes and seamless playback on more devices. That said, H.264 is now included in the MPEG-4
codec (part 10, known as AVC), so it could become a moot point in the near future as the codecs
become less reliant on a single encoding technology, and instead take on the role of a codec pack
which includes multiple encoding methods in a single package.
What is a Container?
A container exists solely for the purpose of bundling all of the audio, video, and codec files into one
organized package. In addition, the container often contains chapter information for DVD or Blu-rayBlu
movies, metadata, subtitles, and/or additional audio files such as different spoken languages. The
typical container runs like an executable (.exe) file on Windows. It uses a .bat file to tell the operating
system that there are executable le commands that need to be run together in order to achieve the
intended result.
Popular Containers
Flash Video (.flv, .swf)
Macromedia originally created Flash before they were ultimately acquired by Adobe in 2005. Flash is
an aging container that is being
ng phased out due to limitations in the technology, creating what Steve
Jobs used to refer to as “buggy” file handling. This led to a very public omission from iOS devices for
Adobe and it appears that this was the beginning of the end for the format. As HTML5
standardization takes hold,, we should see less Flash videos online, and the container is most likely
going to disappear with it.
MKV
MKV is a rapidly growing format that was designed to be future-proof.proof. The container itself supports
almost any audio or video format which makes it adaptable, efficient, and highly regarded as one of
the best – if not the best – ways to store audio and video files. In addition, it even supports multiple
audio,
udio, video and subtitle files even if they are encoded in different formats. Due to the options the
container offers, as well as its handling of error recovery (which allows you to play back corrupted
files), it has quickly become one of the best containe
containers currently available.
MP4
MP4 is the recommended format for uploading video to the web,, and services such as Vimeo and
YouTube have it listed as their preferred format. The MP4 container utilizes MPEG MPEG-4 encoding, or
H.264, as well as AAC or AC3 for audio. It’s widely supported on most consumer devices, and the
most common container used for online video. You really ca can’t
n’t go wrong with MP4.
The bottom line is, a container is a (mostly) useless bit of information when referring to video. Telling
someone to send you an MP4 file doesn’t give away any useful bits of information without
understanding how the video and audio itself were encoded. The container is just that, a place to store
the audio, video and the codecs needed to decode them for playback.
So, ultimately if you’re looking for advice on what to use, H.264 is quickly becoming the standard
codec, while either mp4 or MKV are worthy containers. MP4 might get the edge here because it is
better supported in consumer devices, and is the standard for most large streaming video sites.
Ultimately, the choice is yours, and as long as the video can be decoded and played on the other end,
there really aren’t a lot of bad choices you can make in terms of what to use