Codec

Main Hero

Definition

A codec is a software or hardware tool used to compress and decompress digital media files such as audio, video, or images. The term comes from "coder-decoder." Codecs reduce file sizes for storage and transmission, then decode the data for playback.

Different codecs are optimised for different needs. Some prioritise quality with less compression, while others reduce file size for faster streaming and lower bandwidth usage. Codecs are essential for media distribution across devices, platforms, and networks.

Advanced

At an advanced level, codecs use algorithms that balance compression efficiency, quality, and processing requirements. Video codecs such as H.264, H.265 (HEVC), AV1, and VP9 are common in streaming, while MP3, AAC, and FLAC are used for audio. Lossy codecs remove some data for smaller files, while lossless codecs preserve all information for maximum quality.

Performance considerations include compatibility with playback devices, encoding speed, decoding efficiency, and licensing costs. Emerging codecs like AV1 are designed to deliver high-quality video at lower bitrates for modern streaming environments.

Why it matters

  • Enables efficient storage and distribution of media.
  • Balances quality with bandwidth and file size.
  • Ensures compatibility across platforms and devices.
  • Supports scalability for streaming services and media applications.

Use cases

  • Compressing video for online streaming platforms.
  • Encoding audio files for podcasts and music services.
  • Preparing broadcast media for transmission.
  • Optimising video calls for low-bandwidth environments.

Metrics

  • Compression ratio between raw and encoded files.
  • Bitrate efficiency at given resolutions.
  • Playback compatibility across devices and browsers.
  • Encoding and decoding latency.

Issues

  • Poor codec choice may reduce quality or increase file size unnecessarily.
  • Incompatible codecs may prevent playback on certain devices.
  • Licensing costs can limit the adoption of proprietary codecs.
  • High compression may introduce artifacts such as blurring or distortion.

Example

A streaming service adopts H.265 (HEVC) to deliver 4K video. Compared to H.264, it achieves similar visual quality at nearly half the bitrate, reducing bandwidth costs while maintaining a smooth viewing experience for users.