What Is a Video Codec?
A video codec is a piece of software or hardware that compresses (encodes) and decompresses (decodes) video data. The word codec is a portmanteau of coder and decoder, reflecting this dual role. Without codecs, digital video would be impractical. A single second of uncompressed 1080p video at 30 frames per second requires approximately 186 megabytes of storage. A two-hour movie at that rate would consume over 1.3 terabytes. Codecs make digital video viable by reducing these enormous data requirements to manageable file sizes.
Codecs work by exploiting redundancy in video data. Most video frames contain large areas of similar color, and consecutive frames in a video sequence are often nearly identical with only small differences due to motion. Codecs use sophisticated mathematical algorithms to identify and eliminate this redundancy, storing only the information that changes between frames and using efficient representations for the remaining data.
The compression process involves several stages. The encoder divides each frame into blocks, predicts each block's content based on surrounding blocks or previous frames, calculates the difference between the prediction and the actual content, transforms and quantizes this difference to reduce its data size, and then applies entropy coding to compress the result further. The decoder reverses this process, using the stored predictions and differences to reconstruct the original video.
Every codec makes tradeoffs between compression efficiency (how small the file can be), visual quality, encoding speed (how long it takes to compress), decoding complexity (how much processing power is needed to play back), and feature support (resolution limits, color depth, HDR). Understanding these tradeoffs is essential for choosing the right codec for your specific use case.
Codec vs. Container: Understanding the Difference
One of the most common sources of confusion in digital video is the difference between a codec and a container. These two concepts are related but distinct, and understanding the difference is fundamental to working with video files effectively.
A codec is the compression algorithm that encodes and decodes the video and audio data. H.264, H.265, VP9, and AV1 are all codecs. They determine how the visual information is compressed, what quality you get at a given file size, and what hardware or software is needed to play the video.
A container (also called a wrapper or format) is the file format that packages the compressed video, audio, subtitles, metadata, and other streams into a single file. MP4, MKV, WebM, AVI, and MOV are all containers. The container determines which codecs it can hold, how multiple streams are organized, and what metadata features are supported.
The relationship between codecs and containers is many-to-many. A single container can hold video encoded with different codecs. For example, an MP4 file can contain H.264 video, H.265 video, or AV1 video. Similarly, a single codec can be stored in different containers. H.264 video can live inside an MP4, MKV, AVI, or MOV container.
This is why file extension alone does not tell you everything about a video file. Two MP4 files can have completely different codec requirements. One might play perfectly on your device while the other fails, even though both have the .mp4 extension. The difference is the codec inside the container.
When troubleshooting video playback issues, the first step is to identify both the container and the codec. A file that will not play might have a supported container but an unsupported codec, or vice versa. Tools like MediaInfo can reveal the full technical details of any video file, showing you exactly which container, video codec, audio codec, resolution, bitrate, and other parameters are in use.
When converting video files with tools like ConvertFree, you are often changing both the container and the codec simultaneously. For example, converting an MKV file with VP9 video to an MP4 with H.264 changes both the container (MKV to MP4) and the codec (VP9 to H.264). Understanding this distinction helps you make informed choices about which conversions are necessary and which are not.
H.264 (AVC): The Universal Standard
H.264, also known as Advanced Video Coding (AVC) or MPEG-4 Part 10, is the most widely deployed video codec in history. Standardized in 2003 by the ITU-T Video Coding Experts Group and the ISO/IEC Moving Picture Experts Group, H.264 has been the backbone of digital video for over two decades.
H.264 was a revolutionary improvement over its predecessors. Compared to MPEG-2 (the codec used for DVDs), H.264 achieves roughly twice the compression efficiency, meaning it delivers the same visual quality at half the bitrate. This dramatic improvement enabled the streaming video revolution, making it practical to deliver high-quality video over the bandwidth-limited internet connections of the mid-2000s.
The codec operates by dividing each frame into macroblocks of 16x16 pixels. It uses both intra-frame prediction (predicting pixel values from neighboring blocks within the same frame) and inter-frame prediction (predicting from previous or future frames using motion estimation). The differences between predictions and actual values are transformed using integer transforms, quantized to reduce precision, and then compressed with context-adaptive binary arithmetic coding (CABAC) or context-adaptive variable-length coding (CAVLC).
H.264 defines several profiles that offer increasing compression efficiency at the cost of decoder complexity. The Baseline Profile is the simplest, suitable for mobile devices and video conferencing. The Main Profile adds B-frames and CABAC for better compression. The High Profile adds 8x8 transforms and additional optimizations, delivering the best compression. Most modern H.264 content uses the High Profile.
The greatest strength of H.264 is its universal compatibility. Every smartphone, tablet, computer, smart TV, streaming device, gaming console, and web browser supports H.264 decoding, usually with dedicated hardware acceleration. This universality makes H.264 the default safe choice whenever compatibility is the top priority.
H.264's limitations become apparent at high resolutions. While technically capable of encoding 4K video, H.264 requires very high bitrates to maintain quality at 4K, making the resulting files impractically large for many use cases. For 4K and higher resolutions, newer codecs like H.265, VP9, and AV1 are significantly more efficient.
Licensing is another consideration. H.264 is covered by patents held by multiple companies, managed through the MPEG-LA patent pool. While the licensing terms are relatively straightforward compared to H.265, there are still costs associated with commercial use in certain contexts. Free internet video streaming is covered by the license at no cost, which has helped maintain H.264's dominance for web video.
H.265 (HEVC): Double the Efficiency
H.265, officially known as High Efficiency Video Coding (HEVC), was standardized in 2013 as the successor to H.264. Its primary goal was to achieve the same visual quality as H.264 at approximately half the bitrate, and it delivers on that promise across a wide range of content and resolutions.
H.265 achieves its efficiency improvements through several architectural changes. The most significant is the move from H.264's fixed 16x16 macroblocks to flexible Coding Tree Units (CTUs) that can range from 16x16 to 64x64 pixels. Larger blocks are more efficient for encoding uniform regions of the image, while smaller blocks handle detailed areas precisely. This flexibility lets H.265 adapt its encoding strategy to the content at a much finer granularity than H.264.
H.265 also introduces improved intra-prediction with 35 angular prediction modes compared to H.264's 9. More prediction modes mean the encoder can more accurately predict pixel values from neighboring blocks, reducing the amount of residual data that needs to be stored. Motion prediction is improved with quarter-pixel precision and advanced merge modes that allow blocks to inherit motion information efficiently.
The transform stage in H.265 supports transform sizes from 4x4 to 32x32, compared to H.264's maximum of 8x8 (in High Profile). Larger transforms are more efficient for smooth areas of the image. The deblocking filter is enhanced, and H.265 adds a new Sample Adaptive Offset (SAO) filter that reduces banding and ringing artifacts.
In practical terms, H.265 typically reduces file sizes by 40 to 50 percent compared to H.264 at the same visual quality. For 4K content, the savings can be even more dramatic because larger frames benefit more from H.265's flexible block structures. This efficiency makes H.265 the preferred codec for 4K streaming, 4K Blu-ray discs, and modern smartphone recordings.
Apple has been one of the strongest proponents of H.265, adopting it as the default recording codec for iPhones starting with the iPhone 7 and using it extensively in the Apple ecosystem. Netflix and other streaming services use H.265 for their 4K and HDR content.
However, H.265's adoption has been hampered by its complicated patent licensing situation. Three separate patent pools (MPEG-LA, HEVC Advance, and Velos Media) plus individual patent holders who are not members of any pool make the licensing landscape complex and expensive. This has motivated the development of royalty-free alternatives like VP9 and AV1.
Device support for H.265 is strong but not universal. Most devices manufactured after 2015 include H.265 hardware decoding, but some older computers, budget Android devices, and certain web browsers (notably older versions of Firefox on some platforms) lack support. When compatibility is uncertain, H.264 remains the safer choice.
VP9: Google's Royalty-Free Answer
VP9 is an open-source, royalty-free video codec developed by Google and released in 2013. It was designed as a competitive alternative to H.265/HEVC, offering similar compression efficiency without the patent licensing complications that plague HEVC.
VP9 achieves compression efficiency roughly on par with H.265. Independent comparisons show that VP9 and H.265 trade blows depending on the specific content, encoding settings, and quality metrics used. In some tests VP9 edges ahead, in others H.265 wins slightly. For practical purposes, they deliver similar quality at similar bitrates, making VP9 a viable substitute for H.265 in scenarios where royalty-free licensing is important.
The codec uses a superblock structure that divides frames into 64x64 pixel blocks, which can be recursively subdivided into smaller blocks down to 4x4. It supports 10 intra-prediction modes and advanced inter-prediction with up to 3 reference frames. VP9 includes an adaptive loop filter and supports 10-bit and 12-bit color depth for HDR content.
VP9's most prominent user is YouTube. Google encodes a large portion of YouTube's content library in VP9, serving VP9 streams to browsers and devices that support it. This means billions of people watch VP9-encoded video every day, even if they are not aware of it. Google has stated that VP9 has saved the company significant bandwidth costs compared to H.264.
Browser support for VP9 is excellent in Chrome (which is logical given Google's involvement), Firefox, and Edge. Safari added VP9 support in version 16 (2022), though hardware-accelerated decoding depends on the specific Apple hardware. Android devices support VP9 natively, and most modern smart TVs include VP9 decoding capability.
VP9's main limitation compared to H.265 is hardware encoder support. While hardware decoding is widespread, hardware encoding for VP9 is less common in consumer devices. This means VP9 encoding typically relies on software, which is slower than hardware-accelerated H.265 encoding available on many GPUs and mobile processors.
The codec is typically found inside WebM containers, though it can also be stored in MKV and some other containers. The VP9/WebM combination is the standard for Google's ecosystem, including YouTube, Google Meet, and Chrome-based WebRTC applications.
For web developers and content creators targeting browser-based playback, VP9 offers an attractive combination of excellent compression, zero licensing costs, and broad browser support. It is particularly effective when used alongside an MP4/H.264 fallback, ensuring that modern browsers receive the more efficient VP9 stream while older clients fall back to the universally compatible H.264 version.
AV1: The Next Generation
AV1 (AOMedia Video 1) is the newest major video codec, developed by the Alliance for Open Media (AOMedia) and released in 2018. AOMedia's membership reads like a who's who of the technology industry: Google, Apple, Microsoft, Amazon, Netflix, Meta, Intel, AMD, NVIDIA, ARM, Samsung, and many others. This broad industry support gives AV1 a level of backing that no previous codec has enjoyed.
AV1 was designed from the ground up to be royalty-free while surpassing the compression efficiency of both H.265 and VP9. It achieves this through an extensive toolkit of coding tools, many derived from Google's experimental VP10 project, Cisco's Thor, and Mozilla's Daala research codec.
In terms of compression efficiency, AV1 consistently outperforms H.265 and VP9 by approximately 30 percent across a wide range of content types. Some comparisons show even larger gains for certain content, particularly at lower bitrates and for screen content. This means a video encoded with AV1 can be roughly 30 percent smaller than the same video encoded with H.265 at the same visual quality.
AV1 includes numerous coding tools that contribute to its efficiency advantage. It uses a superblock structure with blocks up to 128x128 pixels, compared to 64x64 in H.265 and VP9. It supports over 50 intra-prediction modes. Its motion compensation system includes compound prediction (blending predictions from multiple reference frames), warped motion (handling rotation and zoom), and overlapped block motion compensation (reducing blocking artifacts at block boundaries).
AV1 also includes a film grain synthesis tool, which is particularly innovative. Instead of trying to encode random film grain directly (which is extremely expensive in terms of bits), AV1 can remove the grain during encoding, compress the clean image efficiently, and then re-synthesize grain during decoding based on stored parameters. This produces significant bitrate savings for grainy content while maintaining the intended visual appearance.
The primary drawback of AV1 is encoding speed. AV1 encoding is dramatically slower than H.264 or H.265 encoding. Depending on the settings, AV1 can be 10 to 100 times slower than H.264. This makes real-time AV1 encoding impractical on most current hardware, limiting the codec to offline encoding scenarios where time is not a constraint.
However, hardware support is expanding rapidly. Modern GPUs from NVIDIA (RTX 40 series and later), AMD (RX 7000 series and later), and Intel (Arc series) include hardware AV1 encoding and decoding. Mobile processors like Apple's A17 Pro and Qualcomm's Snapdragon 8 Gen 2 and later include AV1 hardware decoding. As hardware support matures, AV1's encoding speed disadvantage will diminish.
Browser support for AV1 is already strong. Chrome, Firefox, and Edge all support AV1 decoding. Safari added AV1 support in recent versions. YouTube has begun serving AV1 streams for supported devices, and Netflix uses AV1 for mobile streaming to reduce bandwidth consumption.
AV1 is the clear future of video compression. Its combination of superior compression efficiency, royalty-free licensing, and massive industry backing positions it to eventually succeed H.264 as the default codec for internet video. The main question is timing: how quickly hardware encoding support expands and how soon software encoders become fast enough for broader adoption.
Codec Comparison: Side by Side
Comparing the four major codecs across key dimensions helps clarify which one to use in different situations.
In terms of compression efficiency relative to H.264, H.264 serves as the baseline. H.265 delivers approximately 40 to 50 percent bitrate savings at the same quality. VP9 delivers approximately 40 to 50 percent savings as well, trading blows with H.265 depending on content. AV1 delivers approximately 50 to 60 percent savings, consistently outperforming both H.265 and VP9.
For encoding speed, H.264 is the fastest to encode, especially with hardware acceleration available on virtually every modern GPU. H.265 is moderately slower, roughly 2 to 5 times slower than H.264 at comparable quality settings, though hardware encoding narrows this gap significantly. VP9 software encoding is similar in speed to H.265 software encoding, but hardware encoding is less widely available. AV1 is by far the slowest, 10 to 100 times slower than H.264 in software, though hardware AV1 encoding on recent GPUs brings speeds to a practical level.
For decoding requirements, H.264 has the lowest decoding complexity, supported by hardware on essentially every device. H.265 decoding is more complex but well-supported by hardware in devices from 2015 onward. VP9 decoding complexity is similar to H.265 and is hardware-accelerated on many modern devices. AV1 has the highest decoding complexity, requiring recent hardware for smooth playback of high-resolution content.
Regarding licensing, H.264 is patented with licensing managed through MPEG-LA, though free for internet streaming. H.265 has a complex multi-pool patent situation that has created adoption friction. VP9 is royalty-free and open source. AV1 is royalty-free with patent defense provisions through the AOMedia patent license.
For maximum resolution support, all four codecs support 8K resolution. However, the practical maximum depends on available bitrate and decoder capability. AV1 and H.265 handle high resolutions most efficiently.
Browser support favors H.264, which works in every browser. VP9 works in Chrome, Firefox, Edge, and recent Safari. H.265 browser support is improving but remains inconsistent, with Safari being the strongest supporter. AV1 works in Chrome, Firefox, Edge, and recent Safari versions.
Device compatibility clearly favors H.264 as the universal choice. H.265 is well-supported on modern devices but not universal. VP9 has strong support on Android and in browsers but weaker support on some consumer electronics. AV1 has rapidly growing support but the smallest installed base of the four.
Which Codec Should You Use?
Choosing the right codec depends on your specific requirements for compatibility, quality, file size, and encoding workflow.
Use H.264 when maximum compatibility is your top priority. If your video needs to play on the widest possible range of devices, including older smartphones, smart TVs, gaming consoles, and all web browsers, H.264 in an MP4 container is the only codec that works everywhere. It is also the right choice when encoding speed matters, as H.264 hardware encoding is extremely fast on modern hardware.
Use H.265 when you need to balance good compression with broad compatibility on modern devices. H.265 is the best choice for 4K content delivery, smartphone video storage, and streaming to known modern devices. If you are recording video on a recent iPhone or Android phone, your device is likely already using H.265 by default. H.265 is also the right codec for Blu-ray disc authoring and for any scenario where you know the target devices support it.
Use VP9 when you are creating web-based video content and want to avoid patent licensing concerns. VP9 is particularly effective for YouTube uploads (since YouTube uses VP9 internally), web applications, and any project where open-source licensing is important. Pairing VP9 in WebM with H.264 in MP4 as a fallback gives you the best of both worlds for web video.
Use AV1 when you need the absolute best compression efficiency and your encoding workflow can accommodate slower encoding times. AV1 is ideal for content that will be encoded once and viewed many times, such as published web video, streaming libraries, and video archives. If you have access to hardware AV1 encoding through a recent GPU, the encoding speed becomes practical for regular use.
For most everyday users, H.264 remains the practical default. It is fast to encode, plays everywhere, and delivers good quality. When you need smaller files, step up to H.265 or VP9. When you need the smallest files possible, consider AV1.
ConvertFree supports conversion between formats using these codecs, allowing you to switch between containers and codecs directly in your browser. Whether you need to convert an H.265 video to H.264 for compatibility, or package VP9 video in a WebM container for web deployment, the conversion process is straightforward and runs entirely on your local device for complete privacy.