MP3 encoder
MP3 (MPEG Audio Layer III)
: A popular lossy audio format that revolutionized digital music distribution by compressing files while retaining a reasonable sound quality.
An MP3 encoder can convert audio streams into MP3 files or embed MP3 audio streams in formats like AVI, MKV, and others.
Use the MP3EncoderSettings
class to set the parameters.
Block info
Name: MP3EncoderBlock.
Pin direction | Media type | Pins count |
---|---|---|
Input | PCM/IEEE | 1 |
Output | audio/mpeg | 1 |
The sample pipeline
Sample code
var pipeline = new MediaBlocksPipeline();
var filename = "test.mp3";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));
var mp3EncoderBlock = new MP3EncoderBlock(new MP3EncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.AudioOutput, mp3EncoderBlock.Input);
var fileSinkBlock = new FileSinkBlock(@"output.mp3");
pipeline.Connect(mp3EncoderBlock.Output, fileSinkBlock.Input);
await pipeline.StartAsync();
Platforms
Windows, macOS, Linux, iOS, Android