H.265 Video

H.265 (HEVC) compressed video for maximum compression efficiency.

Overview

H.265 offers approximately 50% better compression than H.264 at equivalent quality, making it ideal for:

  • 4K and 8K video streaming
  • Limited bandwidth scenarios
  • Long-term storage

Trade-offs

Aspect H.264 H.265
Compression Good Excellent
Encoding Speed Fast Slower
Device Support Universal Modern devices
Hardware Decode Common Common on newer hardware

GStreamer Backend

MediaX uses GStreamer with VAAPI for hardware-accelerated H.265:

  • Intel Quick Sync Video (6th gen+)
  • AMD VCE (GCN 3rd gen+)
  • Software fallback available

Transmitting H.265 Video

#include "h265/gst/vaapi/rtp_h265_payloader.h"

mediax::rtp::h265::gst::vaapi::RtpH265GstVaapiPayloader payloader;

mediax::rtp::StreamInformation stream_info;
stream_info.session_name = "h265-stream";
stream_info.hostname = "239.192.1.1";
stream_info.port = 5004;
stream_info.width = 3840;
stream_info.height = 2160;
stream_info.framerate = 30;
stream_info.encoding = mediax::rtp::ColourspaceType::kColourspaceH265;

payloader.SetStreamInfo(stream_info);
payloader.Open();

// Send RGB24 frames - encoder handles conversion and compression
std::vector<uint8_t> rgb_buffer(3840 * 2160 * 3);
// Fill buffer with video frame...
payloader.Transmit(rgb_buffer.data(), true);

payloader.Close();

Receiving H.265 Video

#include "h265/gst/vaapi/rtp_h265_depayloader.h"

mediax::rtp::h265::gst::vaapi::RtpH265GstVaapiDepayloader depayloader;

mediax::rtp::StreamInformation stream_info;
stream_info.hostname = "239.192.1.1";
stream_info.port = 5004;
stream_info.width = 3840;
stream_info.height = 2160;
stream_info.encoding = mediax::rtp::ColourspaceType::kColourspaceH265;

depayloader.SetStreamInfo(stream_info);
depayloader.Open();
depayloader.Start();

// Receive decoded RGB frames
std::vector<uint8_t> rgb_buffer(3840 * 2160 * 3);
depayloader.Receive(rgb_buffer.data(), 1000);

depayloader.Stop();
depayloader.Close();

Bandwidth Requirements

H.265 achieves significant bandwidth savings:

Resolution Quality H.264 Bitrate H.265 Bitrate
1920x1080 Good 8 Mbps 4 Mbps
1920x1080 High 20 Mbps 10 Mbps
3840x2160 Good 30 Mbps 15 Mbps
3840x2160 High 60 Mbps 30 Mbps

RTP Payload Format

MediaX implements RFC 7798 for H.265 RTP payload format:

  • VPS/SPS/PPS in-band signaling
  • Fragmentation Unit (FU) for large NAL units
  • Aggregation Packet (AP) for small NAL units

Hardware Requirements

Intel VAAPI

# Check for HEVC support
vainfo 2>&1 | grep -i hevc

# Expected output should include:
# VAProfileHEVCMain            : VAEntrypointEncSlice
# VAProfileHEVCMain            : VAEntrypointVLD

AMD VAAPI

# Install AMD drivers
sudo apt install mesa-va-drivers

# Verify
vainfo

Encoding Latency

H.265 encoding introduces more latency than H.264 due to:

  • Larger coding tree units (CTU)
  • More complex prediction modes
  • Additional reference frames

For latency-sensitive applications:

  • Use hardware acceleration
  • Consider H.264 or uncompressed video
  • Tune encoder for low-latency operation

Support