# FLAC encoder

Media Blocks SDK .Net

FLAC (Free Lossless Audio Codec): An audio format that compresses without any loss of quality, ensuring perfect sound reproduction, commonly used by audiophiles.

FLAC Encoder is used to encode files into FLAC, WebM, MKV, and other formats.

Use the FLACEncoderSettings class to set the parameters.

# Block info

Name: FLACEncoderBlock.

Pin direction Media type Pins count
Input PCM/IEEE 1
Output FLAC 1

# The sample pipeline

graph LR;
    UniversalSourceBlock-->FLACEncoderBlock;
    FLACEncoderBlock-->FileSinkBlock;

# Sample code

var pipeline = new MediaBlocksPipeline();

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

var flacEncoderBlock = new FLACEncoderBlock(new FLACEncoderSettings());
pipeline.Connect(fileSource.AudioOutput, flacEncoderBlock.Input);

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

await pipeline.StartAsync();

# Platforms

Windows, macOS, Linux, iOS, Android.