#
WebM output
WebM is used on the Internet as a free alternative to the MP4 format, using the VP8/VP9 codec for video and Vorbis for audio.
Use the WebMSinkSettings
class to set the parameters.
#
Block info
Name: WebMSink.
#
The sample pipeline
graph LR; UniversalSourceBlock-->VPXEncoderBlock; UniversalSourceBlock-->VorbisEncoderBlock; VPXEncoderBlock-->WebMSink; VorbisEncoderBlock-->WebMSink;
#
Sample code
The following sample code can convert the source video file to the WebM file with a VP8 video stream and Vorbis audio stream.
var pipeline = new MediaBlocksPipeline();
var filename = "test.mp4";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));
var vp8EncoderBlock = new VPXEncoderBlock(new VP8EncoderSettings());
pipeline.Connect(fileSource.VideoOutput, vp8EncoderBlock.Input);
var vorbisEncoderBlock = new VorbisEncoderBlock(new VorbisEncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.AudioOutput, vorbisEncoderBlock.Input);
var webmSinkBlock = new WebMSinkBlock(new WebMSinkSettings(@"output.webm"));
pipeline.Connect(vp8EncoderBlock.Output, webmSinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));
pipeline.Connect(vorbisEncoderBlock.Output, webmSinkBlock.CreateNewInput(MediaBlockPadMediaType.Audio));
await pipeline.StartAsync();
#
Platforms
Windows, macOS, Linux, iOS, Android.