Table of Contents

Class FLACOutput

Namespace
VisioForge.Core.Types.Output
Assembly
VisioForge.Core.dll

Represents configuration settings for FLAC (Free Lossless Audio Codec) output format.

public sealed class FLACOutput : IVideoEditBaseOutput, IVideoCaptureBaseOutput

Inheritance

Implements

Inherited Members

Remarks

FLAC is a lossless audio compression format that reduces file size while preserving perfect audio quality. Unlike lossy formats like MP3 or AAC, FLAC decompressed audio is bit-for-bit identical to the original. This makes it ideal for archival, professional audio work, and high-fidelity music playback.

FLAC typically achieves 40-60% file size reduction compared to uncompressed PCM audio, with compression ratios varying based on audio content and encoder settings. This class provides fine-grained control over FLAC encoding parameters for optimizing compression ratio vs. encoding speed.

Key benefits of FLAC:

  • Lossless compression - perfect audio quality
  • Fast decompression with minimal CPU usage
  • Metadata support (tags, album art, etc.)
  • Free and open-source with wide software support

Constructors

FLACOutput()

Initializes a new instance of the VisioForge.Core.Types.Output.FLACOutput class with default settings.

public FLACOutput()

Remarks

Default configuration:

  • Compression level: 5 (good balance of size/speed)
  • Rice min/max: 3 (moderate partitioning)
  • LPC order: 8 (standard linear prediction)
  • Block size: 4608 samples (optimal for most content)
  • Mid-side coding: Disabled

These defaults provide a good balance between compression ratio and encoding speed for most audio content.

Properties

AdaptiveMidSideCoding

Gets or sets a value indicating whether adaptive mid-side coding will be used. False by default.

public bool AdaptiveMidSideCoding { get; set; }

Property Value

bool

Remarks

Enable adaptive mid-side coding (only for stereo streams). Like mid-side coding but the encoder adaptively switches between independent and mid-side coding, which is faster but yields less compression than mid-side coding (which does an exhaustive search).

BlockSize

Gets or sets block size. Default is 4608.

public int BlockSize { get; set; }

Property Value

int

Remarks

Specify the block size in samples. Subset streams must use one of 192/576/1152/2304/4608/256/512/1024/2048/4096 (and 8192/16384 if the sample rate is > 48kHz). The reference encoder uses the same block size for the entire stream.

ExhaustiveModelSearch

Gets or sets a value indicating whether exhaustive model search will be used.

public bool ExhaustiveModelSearch { get; set; }

Property Value

bool

Remarks

Exhaustive model search (expensive!). Normally the encoder estimates the best model to use and encodes once based on the estimate. With an exhaustive model search, the encoder will generate subframes for every order and use the smallest. If the max LPC order is high this can significantly increase the encode time but can shave off another 0.5%.

LPCOrder

Gets or sets LPC order. Default value is 8.

public int LPCOrder { get; set; }

Property Value

int

Remarks

Specifies the maximum LPC order. This number must be smaller or = 32. For Subset streams, it must be smaller or = 12 if the sample rate is smaller or = 48kHz. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger.

Level

Gets or sets level. Range is 0 - 8. 0 is fastest compression, 8 is highest compression. Default value is 5.

public int Level { get; set; }

Property Value

int

MidSideCoding

Gets or sets a value indicating whether mid-side coding will be used. False by default.

public bool MidSideCoding { get; set; }

Property Value

bool

Remarks

Enable mid-side coding (only for stereo streams). Tends to increase compression by a few percent on average. For each block both the stereo pair and mid-side versions of the block will be encoded, and smallest resulting frame will be stored.

RiceMax

Gets or sets rice max. Default value is 3.

public int RiceMax { get; set; }

Property Value

int

Remarks

Set the [min,]max residual partition order. The min value defaults to 0 if unspecified. By default the encoder uses a single Rice parameter for the subframe's entire residual. With this option, the residual is iteratively partitioned into 2^min# .. 2^max# pieces, each with its own Rice parameter. Higher values of max# yield diminishing returns. The most ang for the buck is usually with -r 2,2 (more for higher block sizes). This usually shaves off about 1.5%. The technique tends to peak out about when blocksize/(2^n)=128. Use -r 0,15 to force the highest degree of optimization.

RiceMin

Gets or sets rice min. Default value is 3.

public int RiceMin { get; set; }

Property Value

int

Remarks

Set the [min,]max residual partition order. The min value defaults to 0 if unspecified. By default the encoder uses a single Rice parameter for the subframe's entire residual. With this option, the residual is iteratively partitioned into 2^min# .. 2^max# pieces, each with its own Rice parameter. Higher values of max# yield diminishing returns. The most ang for the buck is usually with -r 2,2 (more for higher block sizes). This usually shaves off about 1.5%. The technique tends to peak out about when blocksize/(2^n)=128. Use -r 0,15 to force the highest degree of optimization.

Methods

GetInternalTypeVC()

Gets the internal output format identifier for video capture operations.

public VideoCaptureOutputFormat GetInternalTypeVC()

Returns

VideoCaptureOutputFormat

Returns VisioForge.Core.Types.VideoCapture.VideoCaptureOutputFormat.FLAC to indicate this is a FLAC audio output format.

GetInternalTypeVE()

Gets the internal output format identifier for video editing operations.

public VideoEditOutputFormat GetInternalTypeVE()

Returns

VideoEditOutputFormat

Returns VisioForge.Core.Types.VideoEdit.VideoEditOutputFormat.FLAC to indicate this is a FLAC audio output format.

Load(string)

Deserializes FLAC output settings from a JSON string.

public static FLACOutput Load(string json)

Parameters

json string

The JSON string containing the serialized FLAC output settings.

Returns

FLACOutput

A new VisioForge.Core.Types.Output.FLACOutput instance with settings restored from the JSON string.

Exceptions

JsonException

Thrown when the JSON string is invalid or cannot be deserialized.

Save()

Serializes the current FLAC output settings to a JSON string.

public string Save()

Returns

string

A JSON string representation of all FLAC encoding parameters.