Skip to main content

OPUS encoder

OPUS encoder is used when encoding files in OGG, and some other formats.

Use OPUSEncoderSettings class to set the parameters.

Block info

Name: OPUSEncoderSettings.

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

The sample pipeline

FileSourceBlock OPUSEncoderBlock OGGSinkBlock

Sample code

var pipeline = new MediaBlocksPipeline(false);

var fileSource = new FileSourceBlock();
fileSource.Filename = "test.mp3";

var opusEncoderBlock = new OPUSEncoderBlock(new OPUSEncoderSettings());
pipeline.Connect(fileSource.Output, opusEncoderBlock.Input);

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

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.