H264 encoder
The H264 encoder block 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 IH264EncoderSettings interface to set the parameters.
Settings
MFH264EncoderSettings
Microsoft Media Foundation H264 encoder. CPU encoder.
Platforms: Windows.
NVENCH264EncoderSettings
Nvidia GPUs H264 video encoder.
Platforms: Windows, Linux, macOS.
AMFHEVCEncoderSettings
AMD/ATI GPUs H264 video encoder.
Platforms: Windows, Linux, macOS.
QSVH264EncoderSettings
Intel GPU H264 video encoder.
Platforms: Windows, Linux, macOS.
OpenH264EncoderSettings
Software CPU H264 encoder.
Platforms: Windows, macOS, Linux, iOS, Android.
Block info
Name: H264EncoderBlock.
Pin direction | Media type | Pins count |
---|---|---|
Input | Uncompressed video | 1 |
Output | H264 | 1 |
The sample pipeline
Sample code
var pipeline = new MediaBlocksPipeline();
var filename = "test.mp4";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));
var h264EncoderBlock = new H264EncoderBlock(new NVENCH264EncoderSettings());
pipeline.Connect(fileSource.VideoOutput, h264EncoderBlock.Input);
var mp4SinkBlock = new MP4SinkBlock(new MP4SinkSettings(@"output.mp4"));
pipeline.Connect(h264EncoderBlock.Output, mp4SinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));
await pipeline.StartAsync();
Sample applications
Platforms
Windows, macOS, Linux, iOS, Android.