Skip to main content

Vorbis encoder

Vorbis: An open-source and royalty-free audio compression technology, part of the Ogg multimedia project, known for providing better sound quality than MP3 at lower bit rates.

Vorbis encoder is used to encode files in OGG, WebM, MKV, and some other formats.

Use the VorbisEncoderSettings class to set the parameters.

Block info

Name: VorbisEncoderBlock.

Pin directionMedia typePins count
InputPCM/IEEE1
Outputaudio/x-vorbis1

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline();

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

var vorbisEncoderBlock = new VorbisEncoderBlock(new VorbisEncoderSettings());
pipeline.Connect(fileSource.AudioOutput, vorbisEncoderBlock.Input);

var oggSinkBlock = new OGGSinkBlock(new OGGSinkSettings(@"output.ogg"));
pipeline.Connect(vorbisEncoderBlock.Output, oggSinkBlock.CreateNewInput(MediaBlockPadMediaType.Audio));

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.