Skip to main content

MP3 encoder

MP3 encoder is used when encoding files in MP3, AVI, MKV, and some other formats.

Use the MP3LameEncoderSettings class to set the parameters.

Block info

Name: MP3EncoderBlock.

Pin directionMedia typePins count
InputPCM/IEEE1
Outputaudio/mpeg1

The sample pipeline

FileSourceBlock FLACEncoderBlock FileSinkBlock

Sample code

var pipeline = new MediaBlocksPipeline(false);

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

var mp3EncoderBlock = new MP3EncoderBlock(new MP3EncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.Output, mp3EncoderBlock.Input);

var fileSinkBlock = new FileSinkBlock(@"output.mp3");
pipeline.Connect(mp3EncoderBlock.Output, fileSinkBlock.Input);

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android