Skip to main content
Version: 2.17

H.264 Codec

H.264 is the most widely supported video codec across browsers, devices, and hardware platforms. It is the default and most reliable codec for streaming in Ant Media Server.

Thanks to its broad compatibility and support for hardware acceleration, H.264 is recommended for most real-time streaming use cases.


Why Use H264?

  • Universal Compatibility: Supported by all major browsers, including Chrome, Safari, Firefox, and Edge
  • Hardware Acceleration: Most devices (mobile, desktop, embedded) support H.264 encoding/decoding
  • Low Latency: Well-suited for real-time WebRTC streaming
  • Stable Performance: Proven and widely adopted standard

Enable H264 Codec

The H.264 codec can be enabled from application settings via the web panel.

h264

  • SFU Mode: Only H.264 streams are ingested and forwarded without transcoding.
  • Adaptive Bitrate (ABR) Mode: The stream is transcoded into multiple H.264 bitrates, allowing playback across different network conditions and devices.
info

Ant Media Server uses the libopenh264 library for software-based H.264 encoding and supports the h264_nvenc encoder for hardware-accelerated encoding on NVIDIA GPUs.


When to Use H.264

H.264 is the recommended choice when:

  • You need broad compatibility across browsers, devices, and platforms
  • You are building WebRTC-based real-time streaming applications
  • You want stable, low-latency, and reliable streaming performance
  • Your audience includes mobile, embedded, or low-powered devices
  • You want to take advantage of hardware-accelerated encoding and decoding

Streaming and Playback with H.264

Almost all protocols supports stream publishing with H.264 codec like RTMP, SRT, WebRTC, WHIP, etc.

Check out the publishing & playback section to publish/play streams with H.264.


Compatibility Check

You can verify if your device supports H.264 using the following tool:
👉 https://mozilla.github.io/webrtc-landing/pc_test_no_h264.html

Check browser compatibility here:
👉 https://caniuse.com/?search=H.264


Enable H.264 & VP8 Codecs Together

Some devices do not support the H.264 codec so in that case both H.264 and VP8 can be enabled for WebRTC.

h264andvp8

  • SFU Mode (No adaptive bitrate): Ant Media Server ingests a WebRTC stream in either H.264 or VP8; if both are available, H.264 is prioritized. The original stream is forwarded to players without transcoding.

  • Adaptive Bitrate Mode (if you have at least one adaptive bitrate): If at least one adaptive bitrate is enabled, the stream is transcoded into multiple bitrates for both H.264 and VP8. This ensures compatibility across devices that support either codec. See Adaptive streaming for details.