Lightworks Presents: The Anti-April Fool's Sale!

It's all perks, no pranks this April! Save 45% on Lightworks every day EXCEPT the 1st. You'd be a fool to miss out!

What are Codecs? (or Codecs! WTH!?)

By David Winter
Jul 14, 2023
4 minute read

Have you ever had problems with downloading files from the Internet? We’ve all been there! A file might be in the wrong format, too big, uploaded poorly and on top of that, having a poor Internet connection doesn’t really help. Imagine how Netflix manages to stream their content to their viewers. To be able to stream all that content effectively to every device and their end-users, they need efficient codecs. Because there are so many different video codecs, it might be overwhelming to choose the right one for your needs. If you've ever asked yourself "What are codecs?" don’t fear, we’ve got you sorted!

What are Codecs?

At some point in their career, every video pro has asked the question "What are codecs?" and they've only ever been answered a fraction of times!

From shooting video, to editing and sharing the video, you need efficient codecs to output your edited footage into a more compatible format to make it accessible for different  devices. Large video files are compressed heavily from gigabytes of data into much smaller file sizes. This type of video encoding is essential when it comes to live streaming, where data needs to be quickly delivered and played back to the viewers. You need highly efficient codecs to make this happen.

So, what are codecs? A codec is a mathematical algorithm that is often software based that compresses (CO) the video data and then decompresses (DEC) for playback or editing. Processing a large raw video file into a much smaller stream of bytes shrinks the large data file so it will be easier to store, taking up much less space on your computer. 

Every stage in online video production and distribution requires codecs, so it is important to understand what their role is and how they work. Video and music files are often huge, which means transferring them swiftly over an internet connection can cause problems. To ensure speedy delivery, algorithms encode and shrink the video data for transmission and then decode it for playback. Without highly efficient codecs, downloading different video and audio files would take more than three to five times longer than they do now. 

Video container formats?

Sometimes codecs are confused with container formats, since they sometimes share the same name. After you have compressed your footage, the components of a stream are encoded into a specific file format. Container formats are file formats that can contain different types of data, from audio, video, caption text, or other associated metadata. 

Since most container formats can input multiple codecs, it is important to choose a codec and container format that is compatible for your viewers. Not all playback platforms accept all containers and codecs, and therefore a multi-format encoding is crucial when streaming to a wide audience. For example, common containers include .mp4, .mov, .ts, and .wmv. A .mov file and a .wmv file can include the same data and codecs inside, but the .mov file suits playback on Apple’s QuickTime player, while the .wmv file is more suitable for playback on a PC’s Windows Media Player. 

Lossless and Lossy?

It's important to realise when asking 'What are codecs?' that there are two kinds of codecs; lossless, and lossy. The majority of  video codecs are lossy, which means that picture information is discarded in order to make the file size smaller.

The amount of loss depends on the codec and how it's configured, but generally, the more you compress your files, the bigger the loss of information will occur. It's a tradeoff between size versus quality. What is good about lossy codecs is that even though they discard  information, they can compress the files into a much smaller format. These are great for compressing data that needs to be sent via e-mail or uploaded to the internet.

Lossy codecs can be transformative, predictive, or a combination of both. Transformative codecs cut the material into smaller pieces before compressing it. Predictive codecs compare the data you’re compressing and get rid of unnecessary data. Nevertheless, all codecs work toward the same result: compressing your data into a manageable file size with as little loss of quality as possible.

Lossless codecs, on the other hand, reproduce the same exact file data from the original camera file. Videos encoded with a lossless codec usually have great quality but they take up a lot of hard drive space. Lossless codecs are typically used for archival and local storage rather than for use on a network.

What are codecs

Which Codec or Container Do I need?

Now you know what codecs are and how they work, you can now make sure that you have a codec that works specifically for your footage. There is nothing more frustrating than having amazing footage, but no way to share it efficiently. Here are some of our recommendations for best codecs and containers:

Streaming requires the use of both audio and video codecs. H.264, also known as AVC (Advanced Video Coding), is the most common video codec. It is usually compressed with AAC (Advanced Audio Coding), which is the most common audio codec.

Even though H.265 being the best in terms of video quality, the majority of encoding output today takes the form of H.264 files, since they play on any device, deliver quality video streams and have the least problems with royalties.

The best video container that works with most of the video codecs and video players is M-PEG4 (also known as MP4). MP4 is considered as an international standard for audiovisual coding. There are still other containers like MOV, which is designed by Apple to support the QuickTime player for both Mac and Windows. Even though being a powerful container, it is not as compatible with video players compared to MP4. Another great container designed for the web is WebM. It is open, royalty-free, and highly popular on websites like YouTube and Twitter. Downside to this one is that it might need some plugins to work in some browsers.

As a result, the most common codec and container used (and recommended by Lightworks) is the H.264 codec paired with an MP4 container. Depending on your usage and where your viewers are, we would also recommend WebM, but make sure you know how to answer these following questions:

  1. Are you compressing for storage or for high quality streaming? 
  2. Do your final files need to have the highest possible quality? 
  3. Are there any browsers or computers you're willing to sacrifice compatibility with?
  4. Do you wish to use an open format, or are proprietary formats also to be considered?