Let’s first begin by talking about codecs, which deal with compressing your file
Codecs (are for compression) – or COder/DECoder
The codec of your original video file is often determined by your video camera or screen recorder, which you may or may not have control over in your camera settings. Examples of popular codecs include h.264 which is often used for digital videos, MPEG2 which is often used for DVD media and TV transmission. Now-a-days video editors and cameras take care of the codec stuff for you and unless you’re looking to get into high-end video or outputting to a very specific destination.
You may have heard the phrase video codec when referring to video files. A codec is simply the software that compresses your video, so it can be stored and played back on a device. While the word “compression” can conjure images of pixelated video, the process is both necessary and efficient with modern digital cameras. It gives you much smaller files sizes with minimal quality loss. Compression is your friend!
Its 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 to encode and shrink your video file for the intended application.
Simply put, a codec is a method for encoding and decoding data and more specifically, a protocol for compressing data, especially video. Selecting the right codec can depend on several factors. Target file size, output quality, and delivery method all factor in. Currently h.264 is the predominant codec on the web.
What is it, and why is it important?
There are two kinds of compression: lossless and lossy. Most of the time, the quality can’t be perceived by the human eye, but in some cases, it can make visuals look grainy, sounds flat and muffled, or make videos difficult to play.
- Lossy compression- algorithms search through the code to find pieces that it can delete. While lossy compression can't be used on program files, it can be used on multimedia files, where there is often information in the files that human senses cannot detect. When lossy compression is used, the file may appear to be identical, but it is very different at the code level. The process is irreversible, once you convert to lossy, you can’t go back. And the more you compress it, the more degradation occurs. JPEGs and GIFs are both lossy image formats.
One of the biggest obvious benefits to using lossy compression is that it results in a significantly reduced file size (smaller than lossless compression method), but it also means there is quality loss.
Lossy Advantages and Disadvantages:
- Advantages: Very small file sizes and lots of tools, plugins, and software support it.
- Disadvantages: Quality degrades with higher ratio of compression. Can’t get original back after compressing.
- Lossless Compression- algorithms search for long strings of code and have a method to replace them with shorter strings. Lossless compression can recreate the entire file exactly as it was. Lossless compression refers to compression in which the image is reduced without any quality loss. Usually this is done by removing unnecessary metadata from JPEG and PNG files. RAW, BMP, GIF, and PNG are all lossless image formats. It is important to note that since JPEGs are a lossy format that when using the “maximum” preset in Photoshop, this doesn’t mean it is lossless. However, even images exported from Photoshop using the “Save for Web” function can still see significant reductions.
Lossless Advantages and Disadvantages
- Advantages: No loss of quality, slight decreases in image file sizes.
- Disadvantages: Larger files than if you were to use lossy compression
To compress a video, your file must also have a corresponding codec. A codec is a software that compresses your video, so it can be stored and played back. The most common codec includes h.264, which is often used for high-definition digital video and distribution of video content. It is also important to note the bit rate, which refers to the amount of data stored for each second of media that is played. The higher the bit rate, the less compression, which results in overall higher quality. However, be aware that the higher the bit rate, the larger the file size.
Containers (are file extensions)
A container is the file that contains your video and audio streams and any closed caption files as well. It’s common for a container to be called a file extension since they are often seen at the end of file names (e.g. filename.mp4) Popular video (visuals-only) containers include.mp4, .mov, or .avi, but there are many more. Audio uses its own codecs. Often your video camera will determine the container for your original video file as well. Our Canon DSLRs record .mov to the memory card, however our Canon camcorders can do AVCHD or MP4, which can be changed in the camera settings menu. Container is what we typically associate with the file format. Containers "contain" the various components of a video: the stream of images, the sound, and anything else. For example, you could have multiple soundtracks and subtitles included in a video file, if the container format allows it. Example of popular containers are OGG, Matroska, AVI, MPEG. It is what holds the grouping of compressed video as defined by the codec. A container is also referred to as a format. The container takes care of packaging, transport, and presentation. The container is usually represented by a file extension. For example, the MPEG4 container is usually represented by a .mp4 file type.
As the digital video landscape evolves, so do the types of codecs and containers. This evolution is usually marked by increased quality and lower file sizes. As screen size and resolutions increase, an evolution that makes containers and codecs more efficient is only natural.
Choosing a container for export (Export Settings)
When it’s time to export your video after editing, you’ll most likely be tasked with choosing a file type (container). Nine times out of ten when exporting a video for the web an MP4 will be your best bet. Occasionally you may need to use a different container depending on where you plan to host your video. If you’re creating a video for a client always check to see if they have any specific file type needs. If you’re unsure or are exporting to YouTube, Vimeo, Facebook or Instagram an MP4 will do just fine. Codecs are ways of "coding" and "decoding" streams. Their job is typically to compress data (and decompress it when playing it back) so that you can store and transmit files with a smaller file size. There are many codecs available out there, each with their strengths, weaknesses and individualities, and choosing the right codec with the right settings for the right situation is close to be a form of art.