Skip to main content

Speex encoder

Speex: An open-source, patent-free audio codec designed specifically for compressing voice at low bit rates, commonly used in VoIP and audio streaming applications.

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

Use the SpeexEncoderSettings class to set the parameters.

Block info

Name: SpeexEncoderBlock.

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

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline();

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

var speexEncoderBlock = new SpeexEncoderBlock(new SpeexEncoderSettings());
pipeline.Connect(fileSource.AudioOutput, speexEncoderBlock.Input);

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

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.