Skip to main content

HEVC/H265 encoder

HEVC encoder is used for encoding files in MP4, MKV, and some other formats, as well as for network streaming using RTSP and HLS.

Use classes that implement the IHEVCEncoderSettings interface to set the parameters.

Settings

MFHEVCEncoderSettings

Microsoft Media Foundation HEVC encoder. CPU encoder.

Platforms: Windows.

NVENCHEVCEncoderSettings

Nvidia GPUs HEVC video encoder.

Platforms: Windows, Linux, macOS.

AMFHEVCEncoderSettings

AMD/ATI GPUs HEVC video encoder.

Platforms: Windows, Linux, macOS.

QSVHEVCEncoderSettings

Intel GPU HEVC video encoder.

Platforms: Windows, Linux, macOS.

Block info

Name: HEVCEncoderBlock.

Pin directionMedia typePins count
InputUncompressed video1
OutputHEVC1

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline(false);

var filename = "test.mp4";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));

var hevcEncoderBlock = new HEVCEncoderBlock(new NVENCHEVCEncoderSettings());
pipeline.Connect(fileSource.VideoOutput, hevcEncoderBlock.Input);

var mp4SinkBlock = new MP4SinkBlock(new MP4SinkSettings(@"output.mp4"));
pipeline.Connect(hevcEncoderBlock.Output, mp4SinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.