Skip to content

Video Codecs

Hossein HassanNejad edited this page Sep 10, 2026 · 1 revision

A video codec compresses and encodes video frames so that they can be stored and transmitted efficiently.

Different codecs provide different trade-offs between:

  • Video quality
  • File size
  • Encoding speed
  • Processing requirements
  • Device and platform compatibility

Codec availability depends on the FFmpeg build used by your application.


Example

await NyxConverter.convertTo(
  inputPath,
  outputDirectory,
  videoCodec: NyxVideoCodec.h264,
);

This converts the video using the H.264 codec.


Supported Codecs

Codec Type Description
H.264 Lossy Excellent balance of quality, compression, speed, and compatibility.
H.265 Lossy More compression-efficient than H.264 in many cases, but generally more demanding to encode.
Xvid Lossy MPEG-4 Part 2 implementation mainly useful for legacy compatibility.
VP8 Lossy Open codec commonly used for web-oriented video.
VP9 Lossy Successor to VP8 with improved compression efficiency.
AV1 Lossy Modern royalty-free codec designed for high compression efficiency.
MPEG-4 Lossy Older MPEG-4 Part 2 codec useful for legacy media.
MPEG-2 Lossy Older codec commonly used for DVD, broadcast, and legacy workflows.

H.264

H.264, also known as Advanced Video Coding (AVC), is one of the most widely supported video codecs.

It provides a good balance between:

  • Quality
  • File size
  • Encoding speed
  • Device compatibility

It is a good default choice when compatibility is important.

videoCodec: NyxVideoCodec.h264,

Recommended For

  • General video conversion
  • Streaming
  • Mobile devices
  • Web video
  • Social media
  • Broad device compatibility

H.265

H.265, also known as High Efficiency Video Coding (HEVC), is designed to provide better compression efficiency than H.264.

This can allow similar visual quality at a lower bitrate, depending on the content and encoder settings.

videoCodec: NyxVideoCodec.h265,

Advantages

  • Good compression efficiency
  • Suitable for high-resolution video
  • Useful when reducing file size is important

Considerations

  • Encoding can require more processing power.
  • Playback support varies between devices and platforms.
  • Actual compression efficiency depends on encoder settings and source content.

VP8

VP8 is an open video codec commonly associated with web video.

videoCodec: NyxVideoCodec.vp8,

It can be useful for web-oriented workflows and applications that require an open codec.


VP9

VP9 is a successor to VP8 and generally provides better compression efficiency.

videoCodec: NyxVideoCodec.vp9,

It is commonly used for:

  • Web video
  • Streaming
  • Online platforms
  • Bandwidth-sensitive applications

AV1

AV1, or AOMedia Video 1, is a modern royalty-free video codec designed for high compression efficiency.

videoCodec: NyxVideoCodec.av1,

AV1 can provide excellent compression, particularly for modern streaming and high-resolution video.

Considerations

AV1 encoding can require significantly more processing than older codecs, depending on encoder settings.

Playback support should also be considered when targeting older devices.


MPEG-4

Nyx Converter's mpeg4 option refers to MPEG-4 Part 2, not H.264.

videoCodec: NyxVideoCodec.mpeg4,

It is an older video codec that can be useful for compatibility with legacy applications and devices.


MPEG-2

MPEG-2 is an older video codec widely associated with DVD and broadcast video.

videoCodec: NyxVideoCodec.mpeg2,

It can be useful when working with older video workflows or systems that specifically require MPEG-2.


Xvid

Xvid is an implementation of MPEG-4 Part 2.

videoCodec: NyxVideoCodec.xvid,

It is mainly useful for legacy video workflows and older media players.

For modern applications, H.264, H.265, VP9, or AV1 are generally more appropriate depending on the target platform.


Recommendations

Goal Recommended Codec
Best compatibility H.264
Good compression H.265
Modern web video VP9
Modern high-efficiency video AV1
Legacy MPEG-4 compatibility MPEG-4 / Xvid
DVD or broadcast workflows MPEG-2

These are general recommendations. The best codec depends on the target device, platform, source video, bitrate, and encoding settings.

Clone this wiki locally