AAC encoder
AAC (Advanced Audio Coding)
: A lossy compression format known for its efficiency and superior sound quality compared to MP3, widely used in digital music and broadcasting.
AAC encoder is used for encoding files in MP4, MKV, M4A and some other formats, as well as for network streaming using RTSP and HLS.
Use the AACEncoderSettings
class to set the parameters.
Block info
Name: AACEncoderBlock.
Pin direction | Media type | Pins count |
---|---|---|
Input | PCM/IEEE | 1 |
Output | AAC | 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 aacEncoderBlock = new AACEncoderBlock(new MFAACEncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.AudioOutput, aacEncoderBlock.Input);
var m4aSinkBlock = new MP4SinkBlock(new MP4SinkSettings(@"output.m4a"));
pipeline.Connect(aacEncoderBlock.Output, m4aSinkBlock.CreateNewInput(MediaBlockPadMediaType.Audio));
await pipeline.StartAsync();
Sample applications
Platforms
Windows, macOS, Linux, iOS, Android.