Skip to main content

HEVC Encoders

This documentation covers the available HEVC encoders for video encoding, including AMD (AMF), NVIDIA (NVENC), and Intel QuickSync (QSV) implementations.

For Windows-only engines check the MP4 output page.

Overview

The following HEVC encoders are available:

  • AMD AMF HEVC Encoder
  • NVIDIA NVENC HEVC Encoder
  • Intel QuickSync HEVC Encoder

Each encoder has its own specific settings and capabilities. Let's explore each one in detail.

AMD AMF HEVC Encoder

The AMD AMF HEVC encoder provides hardware-accelerated video encoding on AMD GPUs.

Key Features

  • Supports various rate control methods
  • Adjustable quality presets
  • Configurable GOP (Group of Pictures) size
  • Multiple usage scenarios support

Rate Control Methods

The AMF HEVC encoder supports the following rate control methods:

  • CQP (Constant QP): Uses constant QP values for I, P frames
  • LCVBR (Latency Constrained VBR): Variable bitrate with latency constraints
  • VBR (Variable Bitrate): Standard variable bitrate encoding
  • CBR (Constant Bitrate): Maintains constant bitrate throughout encoding

Usage Scenarios

  • Transcoding
  • Ultra Low Latency
  • Low Latency
  • Web Camera

Sample Code

var encoder = new AMFHEVCEncoderSettings
{
// Basic settings
Bitrate = 3000, // 3 Mbps
MaxBitrate = 2500,
RateControl = AMFHEVCEncoderRateControl.CBR,

// Quality settings
Preset = AMFHEVCEncoderPreset.Quality,
Usage = AMFHEVCEncoderUsage.Transcoding,

// GOP and QP settings
GOPSize = 30,
QP_I = 22,
QP_P = 22,

// Additional settings
RefFrames = 1
};

NVIDIA NVENC HEVC Encoder

The NVIDIA NVENC HEVC encoder provides hardware-accelerated encoding on NVIDIA GPUs.

Key Features

  • Multiple profile support (Main, Main10, Main444, etc.)
  • Extensive level support (1.0 to 6.2)
  • B-frame support
  • Temporal AQ (Adaptive Quantization)
  • Weighted Prediction

Profiles

  • Main
  • Main10 (10-bit)
  • Main12 (12-bit)
  • Main444
  • Main444x10 (10-bit)
  • Main444x12 (12-bit)

Sample Code

var encoder = new NVENCHEVCEncoderSettings
{
// Basic settings
Bitrate = 3000, // 3 Mbps
MaxBitrate = 5000,

// Profile and level
Profile = NVENCHEVCProfile.Main,
Level = NVENCHEVCLevel.Level5_1,

// B-frame settings
BFrames = 2,
BAdaptive = true,

// Additional features
TemporalAQ = true,
WeightedPrediction = true,
RCLookahead = 20,

// Buffer settings
VBVBufferSize = 0, // Use NVENC default
};

Intel QuickSync HEVC Encoder

The Intel QuickSync HEVC encoder provides hardware-accelerated encoding on Intel GPUs.

Key Features

  • Low latency mode support
  • Adjustable target usage (quality vs speed)
  • Multiple rate control methods
  • SEI insertion control
  • HRD conformance control

Rate Control Methods

The QSV HEVC encoder supports these rate control modes:

  • CBR (Constant Bitrate)
  • VBR (Variable Bitrate)
  • CQP (Constant Quantizer)
  • ICQ (Intelligent Constant Quality)
  • VCM (Video Conferencing Mode)
  • QVBR (Quality-defined Variable Bitrate)

Profiles

  • Main
  • Main10 (10-bit)

Sample Code

var encoder = new QSVHEVCEncoderSettings
{
// Basic settings
Bitrate = 3000, // 3 Mbps
MaxBitrate = 5000,
RateControl = QSVHEVCEncRateControl.VBR,

// Quality vs Speed
TargetUsage = 4, // 1: Best quality, 4: Balanced, 7: Best speed

// GOP and reference frame settings
GOPSize = 30,
RefFrames = 2,

// Profile and features
Profile = QSVHEVCEncProfile.Main,
LowLatency = false,

// Additional settings
CCInsertMode = QSVHEVCEncSEIInsertMode.Insert,
DisableHRDConformance = false
};

Quality Presets

All encoders support different quality presets through the VideoQuality enum:

  • Low: 1 Mbps target, 2 Mbps max
  • Normal: 3 Mbps target, 5 Mbps max
  • High: 6 Mbps target, 10 Mbps max
  • Very High: 15 Mbps target, 25 Mbps max

Usage with Quality Presets

// AMD AMF
var amfEncoder = new AMFHEVCEncoderSettings(VideoQuality.High);
// NVIDIA NVENC
var nvencEncoder = new NVENCHEVCEncoderSettings(VideoQuality.High);
// Intel QuickSync
var qsvEncoder = new QSVHEVCEncoderSettings(VideoQuality.High);

Checking Encoder Availability

Each encoder provides a static method to check if it's available on the current system:

if (AMFHEVCEncoderSettings.IsAvailable())
{
// Use AMD encoder
}
else if (NVENCHEVCEncoderSettings.IsAvailable())
{
// Use NVIDIA encoder
}
else if (QSVHEVCEncoderSettings.IsAvailable())
{
// Use Intel encoder
}

Common Settings Across All Encoders

All HEVC encoders implement the IHEVCEncoderSettings interface and share these common settings:

  • ParseStream: Controls whether to parse the video stream (default: true)
  • GetEncoderType(): Returns the specific encoder type
  • CreateBlock(): Creates a MediaBlock for encoding

Best Practices

  1. Always check encoder availability before using it
  2. Use appropriate quality presets for common scenarios
  3. Adjust bitrate settings based on your target quality and bandwidth requirements
  4. Consider using ParseStream=false for SRT streaming
  5. Choose the appropriate rate control method based on your use case:
    • Use CBR for streaming
    • Use VBR for offline encoding
    • Use CQP for highest quality with variable bitrate