What Is Codec ?
A Codec is a piece of software or hardware that compresses and decompresses audio and video data. The term “codec” is a combination of the words “compressor” and “decompressor.”
A codec is used to reduce the amount of data required to represent a video or audio signal, so that it can be transmitted or stored more efficiently. For example, a video codec format can be used to compress the data that makes up a video so that it can be streamed over the internet or stored on a hard drive with less space. A codec can also be used to decompress that data so that it can be played back.
Codecs use a variety of techniques to compress the data, such as removing redundant information, reducing the resolution, or reducing the frame rate. Different codecs are designed to work best with different types of data and under different constraints, such as bit rate, video resolution, and processing power.
There are a wide variety of codecs available, both open-source and proprietary, each with their own benefits and limitations. The most commonly used codecs for video compression are H.264 (AVC), H.265 (HEVC), VP9, AV1. for audio compression are MP3, AAC, Vorbis.
When playing back a video or audio file, it’s important that the codec used to compress the data is also used to decompress it. Codecs are often integrated into media players and web browsers, however, if a device or software doesn’t have the codec required to play a file, the media file may not play or may have degraded quality.
how do codecs work ?
A video codec is a software or hardware algorithm that compresses and decompresses video data to make it easier to transmit or store. The codec works by analyzing the video data and removing redundant information. This can include removing parts of the video that do not change significantly from frame to frame, or reducing the resolution of the video. The compressed video data is then encoded into a digital format that can be transmitted or stored. When the video is played back, the codec decompresses the data and reproduces the original video. There are many different video codecs, each with their own advantages and disadvantages. Some popular codecs include H.264, H.265, and VP9.
AVC (H.264) Vs. HEVC (H.265)
Here is a summary of the main differences between AVC (H.264) and HEVC (H.265) in table format:
Feature | H.264 (AVC) | H.265 (HEVC) |
---|---|---|
Standardization | 2003 | 2013 |
Prediction modes | 4×4, 8×8 and 16×16 block sizes | 4×4, 8×8, 16×16 and 32×32 block sizes |
Intra-frame prediction | Available | Available |
Inter-frame prediction | Available | Available |
Transform coding | DCT, 4×4 and 8×8 block sizes | DCT and Hadamard, 4×4, 8×8, 16×16 and 32×32 block sizes |
Entropy coding | CAVLC and CABAC | CABAC |
Compression efficiency | High | Very high |
Maximum resolution | 1080p | 8K |
Maximum frame rate | 60 fps | 120 fps |
Maximum Bitrate | 50 Mbps | Still being debated, generally higher than AVC |
Chroma Sampling | 4:2:0 | 4:2:0 or 4:2:2 or 4:4:4 |
Multi-Resolution, Multi-Frame support | No | Yes |
Bit Depth | 8 | 8 or 10 |
Color Space | 4:2:0 only | 4:2:0, 4:2:2, 4:4:4 |
Interlaced Support | Yes | Yes |
Profiles and Levels | 15 Profiles and 44 levels | 14 profiles, 63 levels |
Limitations | Not well-suited for very high resolution video or high frame rates | High computational complexity, Licensing issues |
Licensing | Patent-free, no fees | Patent-encumbered, fees required |
H.265 is the successor to H.264 and provides improvements on the compression efficiency with similar video quality. It can compress video with smaller file size and at a lower bit rate, which allows for streaming higher-resolution videos, such as 4K and 8K, at lower bandwidths. Additionally, H.265 supports more advanced features such as multi-resolution, multi-frame encoding, higher bit depth and color sampling, more profiles and levels and interlaced video support.
It’s also worth noting that with more advanced features, the decoder for HEVC is more complex than that for AVC, and it’s still a newer standard, which means it’s not yet as widely supported as H.264.
AVC
Advanced Video Coding (AVC), also known as H.264, is a video compression standard that is designed to provide high-definition video at relatively low bit rates. It is considered to be one of the most efficient video compression standards, and is widely used in a variety of applications, including digital television, Blu-ray, HD DVD, and internet streaming.
The Advanced Video Coding standard is a result of a joint collaboration between the International Telecommunication Union (ITU) and the Motion Picture Experts Group (MPEG). It was first standardized in 2003 and has since been updated several times to improve its efficiency and add new features.
The core of the Advanced Video Coding standard is a technique called block-based motion compensation. In this technique, the video is divided into small blocks, and the motion of these blocks is tracked from one frame to the next. The difference between the current frame and the predicted frame is then encoded, allowing for efficient compression.
Advanced Video Coding uses a number of other techniques to improve compression efficiency, including:
- Intra-frame prediction, which predicts the values of pixels within a single frame
- Inter-frame prediction, which predicts the values of pixels based on previous and/or future frames
- Transform coding, which converts the video data into a different representation, making it easier to compress
- Entropy coding, which compresses the data further by taking advantage of the patterns and redundancies in the data.
The Advanced Video Coding standard also includes support for a wide range of resolutions, from low-resolution mobile phone video to high-definition television. It is also capable of encoding video with a wide range of frame rates, from 24 frames per second (fps) for movies to 60 fps for fast-action sports.
One of the key advantages of Advanced Video Coding is that it is highly efficient, which means that it can deliver high-quality video at relatively low bit rates. This makes it well-suited for a wide range of applications, including digital television, Blu-ray and HD DVD, and internet streaming. Additionally, because the standard is widely supported, videos encoded using AVC can be played back on a wide variety of devices, including computers, smartphones, and televisions.
However, Advanced Video Coding has some limitations. For example, while the standard supports a wide range of resolutions and frame rates, it is not well-suited for very high-resolution video or high frame rates, such as those required for virtual reality or other immersive applications. Additionally, AVC is not as efficient as more recent video compression standards, such as HEVC (H.265) and AV1, which may eventually replace it for some applications.
Overall, AVC is a powerful and versatile video compression standard that has been widely adopted due to its efficiency, flexibility, and wide support. While it may have limitations and competition from newer standards, it still widely used in many digital media today.
HEVC
High Efficiency Video Coding (HEVC), also known as H.265, is a video compression standard that is designed to provide even greater compression efficiency than its predecessor, H.264 (AVC). It was first standardized in 2013, and is intended to be used for a wide range of applications, including digital television, internet streaming, and ultra-high-definition (UHD) video.
Like H.264, HEVC uses block-based motion compensation to track the motion of small blocks of pixels from one frame to the next. However, HEVC improves upon H.264 by using a number of new techniques to achieve even greater compression efficiency.
One of the key improvements in HEVC is the use of larger block sizes for motion compensation. In H.264, the block size is typically 16×16 pixels, while in HEVC it can be as large as 64×64 pixels. This allows HEVC to better exploit the spatial redundancies in the video, resulting in better compression.
HEVC also introduces a number of new prediction modes, which allow it to better predict the values of pixels in the video. For example, it includes a new intra-prediction mode called “angle-dependent” prediction, which allows it to better predict the values of pixels that are located at angles with respect to the block boundaries.
Additionally, HEVC uses a new technique called sample-adaptive offset (SAO) which adjusts the prediction errors for each block based on the sample values within that block, improving the compression performance.
HEVC also uses a new technique called “extension samples” which to improve the compression for color video.
HEVC also uses more advanced entropy coding methods than H.264, which provides more efficient compression of the remaining data after prediction and transform coding.
HEVC also allows for a wider range of resolutions and frame rates than H.264, and can handle videos at resolutions up to 8K. It also can handle videos with high frame rates up to 120 fps.
One of the main advantages of HEVC is its much higher compression efficiency compared to H.264, which means that it can deliver the same level of video quality as H.264 at a much lower bit rate. This can be very beneficial in applications where bandwidth is limited, such as internet streaming or mobile video. Additionally, because HEVC is backward-compatible with H.264, videos encoded using HEVC can still be played back on devices that only support H.264.
However, HEVC also has some limitations. One of them is the increased computational complexity required to decode HEVC-encoded video, which can be a challenge for low-power devices such as smartphones. Additionally, the standard’s licensing requirements for its use have been an issue for some adopters, and in some cases this lead to slower adoption or usage of HEVC.
how hEVC is better than aVC ?
HEVC (H.265) is considered to be better than AVC (H.264) for several reasons:
- Compression efficiency: HEVC uses a more advanced algorithm than AVC and it’s able to compress video with smaller file size and at a lower bitrate without sacrificing the video quality.
- Resolution Support: HEVC supports higher resolutions up to 8K, whereas AVC is typically limited to 1080p.
- Improved Inter-prediction: HEVC uses improved inter-prediction techniques, which is a more efficient way to predict the movement of pixels within the video, which results in more efficient compression.
- More advanced features: HEVC supports more advanced features such as multi-resolution, multi-frame encoding, higher bit depth, 4:2:2 and 4:4:4 chroma sampling, more profiles and levels, and interlaced video support.
- Greater flexibility: HEVC also has better error resilience capabilities which can help with delivering smooth playback on difficult networks, and it has more advanced coding tools which allow for more efficient encoding and less complex decoders.
- Better support for High Frame Rate video: HEVC supports frame rates up to 120 fps, whereas AVC is limited to 60 fps.
It’s also worth noting that while H.265 is more efficient, it is also a more complex codec, and requires more processing power and power to decode, which means that devices that are not powerful enough may not be able to decode the video.
In summary, HEVC provides a significant improvement in compression efficiency, resolution support and advanced features over AVC, and it has the potential to allow for higher quality video at lower bitrates, enabling new use cases for video distribution such as Ultra HD and VR.