#
MKV output
The MKV format can be used as an alternative to the MP4 format, which has more options for supporting video and audio codecs.
Use the MKVSinkSettings
class to set the parameters.
#
Block info
Name: MKVSinkBlock.
#
The sample pipeline
graph LR; UniversalSourceBlock-->H264EncoderBlock; UniversalSourceBlock-->AACEncoderBlock; H264EncoderBlock-->MKVSinkBlock; AACEncoderBlock-->MKVSinkBlock;
#
Sample code
var pipeline = new MediaBlocksPipeline();
var filename = "test.mp4";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));
var aacEncoderBlock = new AACEncoderBlock(new MFAACEncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.AudioOutput, aacEncoderBlock.Input);
var h264EncoderBlock = new H264EncoderBlock(new OpenH264EncoderSettings());
pipeline.Connect(fileSource.VideoOutput, h264EncoderBlock.Input);
var mkvSinkBlock = new MKVSinkBlock(new MKVSinkSettings(@"output.mkv"));
pipeline.Connect(h264EncoderBlock.Output, mkvSinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));
pipeline.Connect(aacEncoderBlock.Output, mkvSinkBlock.CreateNewInput(MediaBlockPadMediaType.Audio));
await pipeline.StartAsync();
#
Platforms
Windows, macOS, Linux, iOS, Android.