Keyboard shortcuts

Press ← or → to go to the previous or next page

Press S or / to search the docs

Press ? to show this help

Press Esc to hide this help

Reference

Video codecs

iroh-live encodes H.264 and H.265. H.264 is the default, and every build can encode and decode it: moq-video’s openh264 software codec is always compiled in. H.265 has no software codec in iroh-live. It needs a platform codec backend on both sides of a broadcast.

Select the codec with irl publish --codec h265, or from Rust with the codec field of a VideoRendition’s encoder config. The --codec flag applies to every rendition of the ladder. From Rust, each rendition has its own codec.

Backends per platform

PlatformBackendH.264H.265Feature
Linux, Intel and AMDVA-APIencode, decodeencode, decodevaapi
Linux, NVIDIANVENC, NVDECencode, decodeencode, decodenvidia
Linux, ARM SoC (Raspberry Pi 4)V4L2 memory-to-memoryencode, decodenonev4l2
macOSVideoToolboxencode, decodeencode, decodenone
WindowsMedia Foundationencode, decodeencode, decodenone
AndroidMediaCodecencode, decodeencode, decodemoq-video’s mediacodec
Every platformopenh264 (software)encode, decodenonealways on

Automatic selection tries the hardware backends first and then openh264. For H.265, no software backend is left to try, so the encoder or decoder fails to open when no platform backend accepts the stream. A backend that you name with --encoder or --decoder is the only one tried.

The NVDEC and MediaCodec decoders also decode AV1. VP8 and VP9 decode only when the application turns on moq-video’s vpx feature, which needs libvpx on the build host. irl does not turn it on.

Platform notes

  • VA-API: the H.265 encoder and decoder have run on Intel Meteor Lake and Arrow Lake (iHD) and on an AMD Radeon RX 9070 (radeonsi). Some AMD encoders refuse H.265 narrower than 384 pixels, so a small rendition can fail to open there. Whether the driver offers H.265 at all depends on how the distribution built Mesa.
  • NVIDIA: NVENC and NVDEC handle 8-bit 4:2:0 H.265. NVDEC refuses 10-bit streams.
  • Raspberry Pi: the V4L2 codecs and --video rpicam are H.264 only, and --video rpicam refuses --codec h265. A Pi has no H.265 path in iroh-live.
  • macOS: VideoToolbox opens the session without a hardware requirement, so a Mac without an H.265 block can use Apple’s software codec.
  • Windows: the encoder uses hardware encoder MFTs only. The decoder needs a Direct3D 11 device and an HEVC decoder MFT, such as Microsoft’s HEVC Video Extensions or one from the GPU vendor. Without one, H.265 does not decode.
  • Android: MediaCodec opens the device’s preferred codec. On a device without H.265 hardware, that can be a software codec. The workspace takes moq-video without default features, so an Android app must turn on mediacodec, as demos/android/rust does.
  • Browsers: the media relay’s web viewer decodes with WebCodecs. Support for H.265 depends on the browser, the operating system, and the GPU. The viewer checks each rendition with VideoDecoder.isConfigSupported and skips one that the browser cannot decode.

Stream format

Encoders produce 8-bit Main profile H.265 as an Annex-B stream, with the VPS, SPS, and PPS in front of every keyframe. The catalog names the codec with an hev1 string. The decoders also take hvc1 tracks, whose parameter sets are in the catalog.

A file: source publishes H.264 and AAC only. An MP4 file with H.265 video cannot be published, with or without --reencode.

Reach viewers without H.265

A viewer without an H.265 decoder cannot show an H.265 rendition. To reach every viewer, publish an H.264 rendition beside the H.265 one from Rust. A player whose decoder fails to open for a rendition marks that rendition as failed and selects another one.

The backends are documented upstream in moq-video. See Platform support for what we test on each platform.